Commit Graph

161 Commits

Author SHA1 Message Date
Brad Fitzpatrick d92010ae9c blobserver/s3: add manual test
Change-Id: I5854aecdb3e4d9e03a7cf56dc7901dc859821a46
2014-02-09 08:06:56 -08:00
Tamás Gulácsi 97520583b8 Use 'uint32' instead of 'int64' for blob sizes everywhere.
Not just in blob.SizedRef, but in blobserver.Fetch and
blobserver.FetchStreaming, too.
Blobs have a max size of 10-32 MB anyway, and the index.Corpus is now using
uint32 to save memory.

Change-Id: I1172445c2f9463fdaee55bfe0f1218d44be4aa53
2014-02-08 17:58:12 +01:00
Brad Fitzpatrick 1b1087a830 Add pkg/blobserver/archiver for making Glacier archives.
From the package docs:

  Package archiver zips lots of little blobs into bigger zip files
  and stores them somewhere. While generic, it was designed to
  incrementally create Amazon Glacier archives from many little
  blobs, rather than creating millions of Glacier archives.

Change-Id: If304b2d4bf144bfab073c61c148bb34fa0be2f2d
2014-02-07 14:32:36 -08:00
Brad Fitzpatrick 4afc5d32f0 diskpacked: don't append duplicate blobs.
Change-Id: I3adce39641458a67a3cdee09bb66411dd1111acd
2014-02-07 10:46:35 -08:00
Brad Fitzpatrick 9a9da7196b localdisk: add IsDir
Change-Id: I98748d6cb8ff650e0369ef0518eeeefce73f0354
2014-02-07 10:45:43 -08:00
Brad Fitzpatrick 254239c379 diskpacked: add IsDir and New
Change-Id: Iba7bfa4772c494240104f4f67e4a1a946f64b6c8
2014-02-07 10:45:22 -08:00
Brad Fitzpatrick 1fcb446d38 dir: add new blobserver/dir package to do localdisk or diskpacked
Change-Id: I27a2d6b7a00e34490b9da264280c5b10f81c30ec
2014-02-07 09:50:59 -08:00
Brad Fitzpatrick 1046470614 Rename ResponseWriter 'conn' to 'rw'
Change-Id: Id0faeac080f678794c1db1601cb9c1a9ba92e926
2014-02-03 20:23:39 -05:00
Brad Fitzpatrick d5ec2925dd namespace: finish tests
Change-Id: Ib34364473e407e78fd691256ad1afe8c810911a9
2014-01-20 13:08:37 -08:00
Brad Fitzpatrick 2b06004813 Merge "diskpacked: keep fd open to every pack file." 2014-01-20 19:59:58 +00:00
Bill Thiede 5c884e52ca diskpacked: keep fd open to every pack file.
Bytes read/writen per pack file, as well as per configured diskpacked
configuration are now available as expvars.

Also add reader stat helpers to pkg/types and updated the original
user in server/image.go

Change-Id: Ifc9d76c57aab329d4b947e9a4ef9eac008bc608d
2014-01-20 10:50:42 -08:00
Brad Fitzpatrick aebc8f00c6 cond: add test using storagetest
Change-Id: Iffd987de42d82e1c19ff2c984ff3d2f01824e34c
2014-01-20 10:37:23 -08:00
Brad Fitzpatrick bb5059bafd namespace: implementation, and initial basic tests using storagetest.
Change-Id: Ib53822fb530f9a1bd2a3c0658120639d5bf4426a
2014-01-19 22:47:35 -08:00
Brad Fitzpatrick b0ae1a55eb replica: add test using storagetest + fix RemoveBlobs bug found with it
Change-Id: I6f33a212d0d9b7fc7eca0fe908da2b3521183fc4
2014-01-19 22:47:02 -08:00
Brad Fitzpatrick d341375188 Start of 'namespace' blob storage target.
Change-Id: I7b6f1a9eea1a7b37482e890238dabc9f1a39c4a5
2014-01-19 15:17:31 -08:00
Brad Fitzpatrick 8e92ad3c71 cond: clean-up and start of tests
Change-Id: Ie7397bde5650f997c9d6abcc1040838b55fccedf
2014-01-19 15:06:55 -08:00
Brad Fitzpatrick e29c43bfde replica: test minWritesForSuccess
Change-Id: I5c845e99b1c440c35bfb7a5a7865176fd72ae031
2014-01-18 22:53:03 -08:00
Brad Fitzpatrick cfeeda0fa9 replica: change receive strategy, fixing a TODO, and start of tests
Change-Id: I74c1206ce4bb34ddffe2601cf95fce393116c303
2014-01-18 21:16:24 -08:00
Brad Fitzpatrick 533600daff pkg/server: Run synchronous blob hooks first in blobhub.
Change-Id: I4cc04b10d97bb9aefea4f0e2ae61117b8ef15c17
2014-01-14 17:51:31 -08:00
Brad Fitzpatrick 08dd9561f9 In stat and upload handlers, return empty lists instead of null.
Fixes camlistore.org/issue/326
2014-01-06 16:30:59 -08:00
Tamás Gulácsi 36643ff986 Fix Fetch -> FetchStreaming conversion
As blob.fetcherToSeekerWrapper.Fetch erroneously asserts that FetchStreaming
returns a ReadSeekCloser everytime, it had to be changed.

Move MaxBlobSize from blobserver to constants (new package).

Change-Id: I4b4f22c302cbec84d77d21454e0c9e8aebdf73e5
2014-01-06 18:56:39 +01:00
Brad Fitzpatrick 91f8b2ad49 Change the upload protocol.
No more dynamic upload URL, which trips up half our new users behind
reverse proxies when the camlistored process doesn't know its
forward-facing URL.

The original camlistore stat + upload protocol was influenced by App
Engine's limitations at the time, and some of our indecision about
where the Camlistore design is going. We understand the Camlistore
design now, and App Engine's former limitations are gone. Time to
clean things up.

More REST-y now too.

See http://camlistore.org/issue/123

Change-Id: I92c6552f830b925cef379c204a982a2213bf2f4b
2014-01-04 20:24:58 -08:00
Dustin Sallings 3742b287a9 require auth config in storage-remote
The client configuration requires this if it's not passed in through the
environment.  Since this is for a storage service, it makes sense to
place it with the specific remote.

Since SetupAuthFromConfig was a bit awkward and not used elsewhere, it's
replaced with a more simple and explicit SetupAuthFromString to which
the exact auth details you wish to use are provided.

Change-Id: Id39ff314738794e299d48cbe634be2aa5d5c3bd1
2013-12-26 11:00:03 -08:00
Dustin Sallings 96ef529509 remote: fix crash due to nil logger
This happened in a well-timed HTTP failure:

runtime.panic(0x674580, 0x10e67b9)
	/Users/dustin/prog/eprojects/go/src/pkg/runtime/panic.c:266 +0xb6
log.(*Logger).Output(0x0, 0x2, 0xc2104e4870, 0x83, 0x0, ...)
	/Users/dustin/prog/eprojects/go/src/pkg/log/log.go:134 +0x46b
log.(*Logger).Print(0x0, 0x13b29b8, 0x1, 0x1)
	/Users/dustin/prog/eprojects/go/src/pkg/log/log.go:165 +0x66
camlistore.org/pkg/client.func·011(0x7da390, 0x13, 0xc21075d400, 0x1, 0x1, ...)
	$GOPATH/src/camlistore.org/pkg/client/upload.go:363 +0x133
camlistore.org/pkg/client.(*Client).Upload(0xc21014ec00, 0xc2109fa7b0, 0x0, 0x0, 0x0)

Change-Id: I9859bc8f03ef0dd9c9b89b7e22815c5ee5b7fd87
2013-12-26 01:27:56 -08:00
Brian Gitonga Marete 92cedc3f72 pkg/blobserver: Introduce a BlobStreaming interface.
This commit introduces the basic API required to implement
high-throughput blob streaming functionality within the various blob
storage engines.

Change-Id: Ie170d11b229196617f96b298f864ad12af62c363
2013-12-25 13:18:40 +03:00
Brad Fitzpatrick a11ff22b8e camlistored: add --reindex flag; make sqlkv a sorted.Wiper
Change-Id: I6b16c1c32187fb754d3acdbe852d02a506236078
2013-12-23 19:07:17 -08:00
mpl ab5e385113 index: move kvfile implementation to sorted
Change-Id: Ie6e676570af088246ef028a2f003b537d85dd6ae
2013-12-13 16:59:45 +01:00
Brad Fitzpatrick 617bbf5295 replica: support blobserver.Generationer
Change-Id: Iad3a0e040fcffa7bee2cfe5ff7ce8904d4ded36c
2013-12-13 11:24:34 +04:00
Brad Fitzpatrick 76171ddb3d Change sorted.KeyValue.Find to take an optional end bound; add tests.
The new package sorted/kvtest provides a generic KeyValue test for all
implementations. Memory, SQLite, and kvfile now use it.

This speeds up the index slurping start-up of my personal Camlistore
server from 30 seconds (when it was doing 17,000+ queries in small
windows) to now just 5 seconds. That 5 seconds can be improved yet
further.

Change-Id: Idd55ba9ccd3ed12a26868a41db1af676aff7b67b
2013-12-07 08:43:18 -08:00
Brad Fitzpatrick b82b8efe4c Start of new context package and *context.Context type.
Will eventually be plumbed through lots of APIs, especially those requiring or benefiting from
cancelation notification and/or those needing access to the HTTP context (e.g. App Engine).

Change-Id: I591496725d620126e09d49eb07cade7707c7fc64
2013-12-02 13:20:51 -08:00
Brad Fitzpatrick 7466336f44 storagetest: more tests, and simplify a bit
Change-Id: Ic0d6c9718ef79ff82f05cf142286022862f30236
2013-12-02 11:57:02 -08:00
Brad Fitzpatrick 6478e256f7 diskpacked: finish enumeration bug with 'after' param
Change-Id: I391a33e7672cce6c7c9a4eebc0a09c2f03546b82
2013-12-02 11:56:23 -08:00
Tamás Gulácsi f69306cbee Finish implementing storagetest
Add use into localdisk (diskpacked already uses it).
Add ErrNotImplemented error for blobserver and mention the possibility
for RemoveBlobs (diskpacked deficit).

Change-Id: I6a50f263a58c8d3d1611ff9a060ea9fa4aee6163
2013-12-01 21:05:37 +01:00
Brad Fitzpatrick f544114844 Fix diskpacked regression, add tests, start of storagetest.
Regressed from rev cb6f423e. Eventually pkg storagetest should test all methods of blobserver.Storage
for all storage target types.

Change-Id: I2c1c93b76fd9280a3eb429b1d71c64a693ed1ace
2013-11-30 13:06:04 -08:00
Brad Fitzpatrick f07ec21f5d localdisk: faster enumerate.
still not as fast as possible, compared to native unix tools (find, ls, etc).
but closer.

Change-Id: I0add6bd07257f04f232332079214312297ec689b
2013-11-29 20:53:46 -08:00
Brad Fitzpatrick fceebe1d43 localdisk: cleanup temp files in migration, clean dirs better
Change-Id: I8999fafc3e87822ec87df227e7815e7cdaf397cb
2013-11-28 21:22:00 -08:00
Brad Fitzpatrick 64f47f3a24 localdisk: move migration stuff to its own file
Change-Id: I987e0133622658dcf3117d65119723f12a4fe74f
2013-11-28 20:20:56 -08:00
Brad Fitzpatrick 8297d9614c localdisk: change hashing structure
Before the files were stored in directories like
sha1/012/345/sha-012345xxxxx.dat, meaning there were 4096 (16^3)
top-level directories, each with up to 4096 child directories.  We
never really did the math, and the result millions (up to 16.7
million) directories with 1 file each.

Now the hashing structure is only 256 wide (two hex digits). If we
considered 4096 files in a directory acceptable before, that means the
new scheme can go up to 256*256*4096 files (268 million), which is
about 512 times bigger than my personal Camlistore instance
now. Larger users should probably be using the diskpacked storage
backend, anyway.

On start-up, the code now migrates the old format to the new format.

Change-Id: I17f7e830c50a5b770c57ee92d51f122340a0afbb
2013-11-28 16:33:01 -08:00
Brad Fitzpatrick 3fd356f457 gofmt
Change-Id: I900a49b3f76aec7ef65419f2a5ecaf3eae95defb
2013-11-28 11:58:47 -08:00
Tamás Gulácsi cb6f423eeb Add diskpacked-reindex subcommand to camtool
For checking and/or rebuilding index.kv of diskpacked packs.

Change-Id: I1ad87974b2daf58b1e767bb1df6f7b64e8b6359a
2013-11-28 20:44:27 +01:00
Brad Fitzpatrick 4c01434929 blobserver: run blobhub receive hooks in parallel.
Change-Id: I918a124a01a2d75a64c26e136d28ed7f2547509d
2013-11-24 17:12:56 -08:00
Brad Fitzpatrick cf388c2f2a sync: have handler register receive hook with its source.
Lets legacy configs work, even without replicating directly to it.

Change-Id: I8bdb8651040794ae346f19d6dd67a0da07505f07
2013-11-24 16:20:11 -08:00
Bill Thiede 60e10a99ad blobserver/diskpacked: Remove TODO, close index.
https://camlistore.org/gw/1f407edd588d8ae33475818d891fc0e0058d1628 makes this
possible.

Change-Id: Ibf21f7f7d3c11139192599d6e18fa0aa5dbc7007
2013-11-24 14:28:01 -08:00
Brad Fitzpatrick 1f407edd58 sorted: add Close method to KeyValure; register 'kv' impl type for cznic/kv
Change-Id: Ie4e21450dac9dad3433c65631706f52527502cbc
2013-11-23 21:07:03 -08:00
Brad Fitzpatrick 2f802e7ecd Fix blobhub test, broken in earlier commit. :/
Change-Id: I0c6d1ab672387afcdca7af878be00745c4c29e6f
2013-11-23 21:05:52 -08:00
Brad Fitzpatrick 62fbbb61a0 encrypt: use key metaIndex for index, not meta; that was used. fixes devcam server.
Change-Id: I483c696dcc3402537bec136f8847c17767760b3b
2013-11-23 11:11:05 -08:00
Brad Fitzpatrick 2a781196e7 Add BlobHub.AddReceiveHook; clean up docs, clarify how to use BlobReceiver.
Change-Id: Icc5b55fcbabc852c7cacc9a806f12098d5e59377
2013-11-23 11:09:06 -08:00
Brad Fitzpatrick b0b054ca27 Doc tweaks
Change-Id: I7c4cdd9b0cc37b2a40084f1cf11b81d8ce3a39fa
2013-11-23 09:00:18 -08:00
Brad Fitzpatrick 90c1e48afe Rename index.Storage to sorted.KeyValue and move it into a new package.
Having index.Index and index.Storage both in the same package led to
confusing discussions about "an index". Better names now, and smaller
packages.
2013-11-22 23:24:54 -08:00
Brad Fitzpatrick 70475701d1 Get rid of QueueCreator and all its associated complexity.
Previous TODO entry was:

-- Get rid of QueueCreator entirely. Plan:
     -- sync handler still has a source and dest (one pair) but
        instead of calling CreateQueue on the source, it instead
        has an index.Storage (configured via a RequiredObject
        so it can be a kvfile, leveldb, mysql, postgres etc)
     -- make all the index.Storage types be instantiable
        from a jsonconfig Object, perhaps with constructors keyed
        on a "type" field.
     -- make sync handler support blobserver.Receiver (or StatReceiver)
        like indexes, so it can receive blobs.  but all it needs to
        do to acknowledge the ReceiveBlob is write and flush to its
        index.Storage. the syncing is async by default. (otherwise callers
        could just use "replica" if they wanted sync replication).
        But maybe for ease of configuration switching, we could also
        support a sync mode.  when it needs to replicate a blob,
        it uses the source.
     -- future option: sync mirror to an alternate path on ReceiveBlob
        that can delete. e.g. you're uploading to s3 and google,
        but don't want to upload to both at once, so you use the localdisk
        as a buffer to spread out your upstream bandwidth.
     -- end result: no more hardlinks or queue creator.

Change-Id: I6244fc4f3a655f08470ae3160502659399f468ed
2013-11-22 14:33:31 -08:00