Commit Graph

40 Commits

Author SHA1 Message Date
Brad Fitzpatrick 194d4f9443 blobserver, all: add contexts to ReceiveBlob, Fetch & million resulting deps
I had intended for this to be a small change.

I was going to just add context.Context to the BlobReceiver interface,
but then I saw blob.Fetcher could also use one, so I decided to do two
in one CL.

And then it got a bit infectious and ended up touching everything.

I ended up doing SubFetch in the process by necessity.

At a certain point I finally started using context.TODO() in a few
spots, but not too many. But removing context.TODO() will come in the
future. There are more blob storage interfaces lacking context, too,
like RemoveBlobs.

Updates #733

Change-Id: Idf273180b3f8e397ac5929c6d7f520ccc5cdce08
2018-01-18 16:22:16 -08:00
Brad Fitzpatrick 57648c6b83 all: update copyright holder from Google Inc to The Perkeep Authors
The AUTHORS file is the list of copyright holders.
2018-01-03 16:52:49 -08:00
Brad Fitzpatrick d6a0b05df0 Rename import paths from camlistore.org to perkeep.org.
Part of the project renaming, issue #981.

After this, users will need to mv their $GOPATH/src/camlistore.org to
$GOPATH/src/perkeep.org. Sorry.

This doesn't yet rename the tools like camlistored, camput, camget,
camtool, etc.

Also, this only moves the lru package to internal. More will move to
internal later.

Also, this doesn't yet remove the "/pkg/" directory. That'll likely
happen later.

This updates some docs, but not all.

devcam test now passes again, even with Go 1.10 (which requires vet
checks are clean too). So a bunch of vet tests are fixed in this CL
too, and a bunch of other broken tests are now fixed (introduced from
the past week of merging the CL backlog).

Change-Id: If580db1691b5b99f8ed6195070789b1f44877dd4
2018-01-01 16:03:34 -08:00
mpl 5fef0785f2 pkg/server: make DownloadHandler also handle directories when zipping
The DownloadHandler only accepted file schemas as input for building a
zip archive so far.

It can now zip directories and their contents as well.

Non-regular files (socket, fifo, symlink) are now handled too.

As previously, no compression is applied when zipping.

When the DownloadHandler's Fetcher is a caching fetcher, all the files
that are supposed to be included in the archive are read, so we can
report reading errors even before starting to create the archive. We now
also take advantage of this optimization to build a
blobRef->filepath mapping when checking the files. Then, when the zip
archive is actually being built, the file path can be looked up in the
map, instead of having to assemble it again with recursive concatenation
of directory names.

Change-Id: I853c495798a9a43e12f3386603a70560ff46a237
2017-09-06 00:06:45 +02:00
Tamás Gulácsi 7402cc0efd Delete misc unused objects
Using honnef.co/go/unused/cmd/unused

Change-Id: I672b3cb77f09e9bd80dcdc149cde4f7f2939e451
2016-04-06 17:59:51 +02:00
mpl e0d719ba21 pkg/types: remove
Most of it replaced with vendor/go4.org/types and
vendor/go4.org/readerutil

u32 went where needed in pkg/blobserver/*
invertedBool went in pkg/types/serverconfig
atomics64 went in pkg/fs

Change-Id: I230426cda35be4b45ed67e869f14e6fdae89be22
2016-02-05 18:28:47 +01:00
mpl 8d76f0563b vendor: go4.org/syncutil/singleflight
Previously pkg/singleflight

Imported from github.com/camlistore/go4/ at rev
039bcc4ca7e407e5611cbdf15a1f208be0bceda0

Also reimport vendor/go4.org/syncutil because some of it got split into
github.com/camlistore/go4/syncutil/syncdebug

Change-Id: Iaf48de71928d17e0410442ea6f5bef7262ba60d2
2015-11-24 17:28:28 +01:00
mpl 12eddf9c19 vendor: go4.org/strutil go4.org/syncutil
They were internal packages (under pkg), which we are now moving to
go4.org, so we in turn need to vendor them in now.

Change-Id: I92224f731404d0bd4ca1c57492bed37cb3367ed4
2015-11-21 00:21:20 +01:00
Gina White 56bb5d1a38 Address TODO by moving CAMLI_DEBUG checks into env
I also wonder if we want to take a more comprehensive approach to
environment variables, perhaps populating a struct at startup that other
code can consult later.  But it might be too soon for that kind of thing
in this project.

Change-Id: I65a34622bf906c1256ceb357ba983bc5acd6b887
2015-08-25 07:22:14 -07:00
Brad Fitzpatrick 50cced8b7b schema: modify ForeachChunk to give schema blob path, not just parent
Then in blobpacked, use it, so we don't miss any intermediate 'bytes' schema blobs.

Change-Id: I8eedab562f26ad23a340aca8e24a7154a8414029
2014-09-06 20:14:27 -07:00
Brad Fitzpatrick d63bcc04c2 blobpacked: export, document Manifest type. slight tweaks to zip format.
Change-Id: I9fbb005f0ecc6f013575255fae9e62b8397701ee
2014-09-01 16:25:37 -07:00
Brad Fitzpatrick 8d79f59908 blobpacked: first cut at packing, creating zip files with contiguous chunks.
See package docs in blobpacked.go for background & rationale.

Will minimize disk seeks, regardless of the underlying storage
system. I always knew this day would come, but we've been putting it
off. It's finally time to separate out logical (tons of small chunks)
storage from physical (big contiguous layout for how they'll be
accessed).

First 80% is done. Last 80% remains: mostly lots of tests and more
paranoia, and fsck things, for when we inevitably lose indexes. (but
each zip file is self-describing, so the index is redundant).

Change-Id: I13f9aa79c4d9d87b5fdcece0d99d97eba031d608
2014-08-30 00:09:10 -07:00
Brad Fitzpatrick 1be26ea3a4 schema: rewrite FileReader.LoadAllChunks, delete GetChunkOffsets
LoadAllChunks is now written in terms of ForeachChunk and is bounded.

GetChunkOffsets was never meant to be exported and was unused elsewhere.
It's now unused entirely.

Change-Id: I0653385fe805fda721e0b45ea0a17d9839c3ba6e
2014-08-29 15:26:36 -07:00
Brad Fitzpatrick 3388e363b9 schema: add FileReader.ForeachChunk
Will be used by the blobpacked storage server.

Also, we can then rewrite much of the legacy crufty methods on
FileReader in terms of this.

Change-Id: Ia371001f1ed502fa1da2dbc4a8e1c29e5f0c9e8c
2014-08-29 14:51:33 -07:00
Brad Fitzpatrick 766919ec33 schema: more minor FileReader cleanups
Change-Id: Ia37d82024faf16c262f339d8f7f807d23670edda
2014-08-11 17:32:00 -07:00
Brad Fitzpatrick 71a1a1ff8d schema: reduce FileReader blob reads 32-85x by caching the last blob read
Little reads into big blobs kept re-reading the same blob.

Change-Id: I098c9d9a9443dacc93f60f96fff1edd421ced198
2014-08-11 15:55:50 -07:00
Brad Fitzpatrick fe481e5da7 schema: some FileReader cleanups: use blob.Ref as map key, simplify zeroReader
Change-Id: I37ec27bfe9673e7d5566216269d94d109215ac99
2014-08-11 15:53:33 -07:00
Brad Fitzpatrick f3a519d3e5 schema: remove FileReader.FileSchema returning private type
Change-Id: I66af87155edfb7672294072fe18878af0811cf62
2014-06-13 15:47:14 -07:00
Brad Fitzpatrick bf94a73859 Get rid of SeekFetcher vs StreamingFetcher distinction and complexity.
StreamingFetcher is now just Fetcher, and its FetchStreaming is now
just Fetch.

SeekFetcher is gone. Blobs are max 16 MB anyway, so we can slurp to
memory when needed. The main thing that cared about SeekFetcher
was the GET handler, ServeBlobref, because http.ServeContent needed
one for range requests. That's rewritten in an earlier commit, using
the FakeSeeker from another earlier commit.

Lot of code got simpler as a result.

Change-Id: Ib819413e48a8f9b8d97f596d0fbf771dab211f11
2014-03-14 12:29:13 -07:00
Brad Fitzpatrick 99ea128752 schema: fix a race on errors in FileReader.GetChunkOffsets, add tests
Change-Id: I51635d01c3c88c5f97ac15172c5b565f07dde350
2013-09-22 13:10:16 +01:00
Brad Fitzpatrick 0bdf20884b all: delete pkg/blobref; convert all from *blobref.BlobRef to new blob.Ref
Change-Id: Id2dfb7f19452bedf4f3c9310b36227fd8117b225
2013-08-03 19:54:30 -07:00
Brad Fitzpatrick b0bff61d30 types: move ReadSeekCloser types from pkg/blobref to pkg/types
Change-Id: I24e2b2a068d9b09479b145409a3b7e5693dd8ac5
2013-07-28 20:08:55 -07:00
Brad Fitzpatrick ca58d8e2e0 Remove noisy var _ = log.Printf lines.
Change-Id: Ia58b8ef5f271f542ae4fe61c7fb1497322770322
2013-06-14 12:55:55 -07:00
Brad Fitzpatrick 070592444a schema: unexport Superset
Change-Id: If45569b1b6d72b1cb6450b9d634f59e88fae4851
2013-01-22 10:32:15 -08:00
Brad Fitzpatrick cfc32e4a05 schema, camget: more work on deleting the Superset type.
not much more remains.

Change-Id: I6cfe4145f67b100a0e2509f88ce6e1c580b7f9fe
2013-01-22 09:32:40 -08:00
Brad Fitzpatrick 1bf01d7315 schema: lot of Blob/Builder work, and kill schema.Map.
Next up: unexport schema.Superset.

Change-Id: Ia4bb34790abba75bdb4d4101df7a4f15875f4237
2013-01-21 20:56:12 -08:00
Brad Fitzpatrick bdb54d7cef schema: various FileReader optimizations and bug fixes
Now much faster.

Change-Id: I94920b7ab6903e986b045a6ed862eff0796a7f7e
2013-01-06 10:50:41 -08:00
Brad Fitzpatrick e95e6db11d schema: actually populate the superset cache map. whoops.
Change-Id: I461c789bdf01a3341867faa30cac07e645c510e5
2013-01-06 08:53:29 -08:00
Brad Fitzpatrick 3e5940a7ff camget, schema: read chunks more aggressively
Change-Id: I31bc3a145fc2f3a51c3cecbaa33872da077e7bd7
2013-01-05 23:12:42 -08:00
Brad Fitzpatrick a0b7d2e0b2 schema: use singleflight for FileReader superset loading
Change-Id: Ia3db1a3521ea805440f6ceb884c4f4e6ed76f409
2013-01-05 20:07:38 -08:00
Brad Fitzpatrick 3cd8af2c7d schema: more incremental work on making FileReader faster
Change-Id: I033df1654a062dfa57dfe0afce7030f605e88450
2013-01-04 20:20:41 -08:00
Brad Fitzpatrick e8ab934464 schema: start of more efficient/aggressive file reading
Change-Id: I027881c9844b0df3d70c1e05da69b04d853da883
2013-01-04 18:11:40 -08:00
Brad Fitzpatrick 3a8b9078ec schema: delete the old FileReader.Skip method
Change-Id: I025bee0d2a4cc8b2cae4e825d0c3b37f14ee8b57
2013-01-04 16:29:16 -08:00
Brad Fitzpatrick 997e52d6b1 schema: split DirReader off into its own file
Change-Id: I69fcbe43912f37cc32567b3d46cabe8579ae00de
2013-01-03 17:16:26 -08:00
Brad Fitzpatrick 2fca641619 schema: minor cleanups
Change-Id: I7565ccc925e6ae816799242310e26d604a4c42ae
2013-01-03 17:14:23 -08:00
Brad Fitzpatrick 898e522126 Close FileReaders. Hunting an fd leak, but this isn't it,
since FileReader.Close is back to doing nothing.

Change-Id: I65e906d75cf2825b9476ed5008ce042f44582113
2012-12-31 18:02:13 -08:00
Brad Fitzpatrick 08f09ebf2b schema: fix FileReader bugs, simplify, add exhaustive tests
Change-Id: I5d098d7b12892d278190391dd5abd7272ed997c2
2012-12-25 17:27:52 -08:00
Brad Fitzpatrick e557066f1d schema: more cleanup, making FileReader a ReaderAt.
testing TODOs and further cleanup TODOs remain.

Change-Id: I997153c66805cfe3220d3d735322be14b68b75dc
2012-08-23 20:09:31 -07:00
Brad Fitzpatrick faf3c90d6f schema: more docs and some FileReader work
Change-Id: Id9e754e3b6358a651a826a4cdeb00efb330e3c3a
2012-08-23 18:44:03 -07:00
Brad Fitzpatrick 0714a463c9 Update from r60 to [almost] Go 1.
A lot is still broken, but most stuff at least compiles now.

The directory tree has been rearranged now too.  Go libraries are now
under "pkg".  Fully qualified, they are e.g. "camlistore.org/pkg/jsonsign".

The go tool cannot yet fetch from arbitrary domains, but discussion is
happening now on which mechanism to use to allow that.

For now, put the camlistore root under $GOPATH/src.  Typically $GOPATH
is $HOME, so Camlistore should be at $HOME/src/camlistore.org.

Then you can:

$ go build ./server/camlistored

... etc

The build.pl script is currently disabled.  It'll be resurrected at
some point, but with a very different role (helping create a fake
GOPATH and running the go build command, if things are installed at
the wrong place, and/or running fileembed generators).

Many things are certainly broken.

Many things are disabled.  (MySQL, all indexing, etc).

Many things need to be moved into
camlistore.org/third_party/{code.google.com,github.com} and updated
from their r60 to Go 1 versions, where applicable.

The GoMySQL stuff should be updated to use database/sql and the ziutek
library implementing database/sql/driver.

Help wanted.

Change-Id: If71217dc5c8f0e70dbe46e9504ca5131c6eeacde
2012-02-18 21:53:06 -08:00