Commit Graph

55 Commits

Author SHA1 Message Date
Brad Fitzpatrick 995a4ccb0e indextest: force timezone when testing receive
Otherwise JPEGs with EXIF can be interpretted differently.

Change-Id: Ia3fe64a92d7a8f0642363d758f2d1f402f1e4a1f
2014-07-13 10:04:03 -07:00
mpl 443f405962 index: fix data race on BlobSource, make it private.
index.New was starting outOfOrderIndexerLoop in a goroutine. And
outOfOrderIndexerLoop had an if index.BlobSource == nil check, on which
it relied to go on. However, since BlobSource was public and unguarded,
the following sequence was possible:

ix, _ := index.New()
ix.BlobSource = bs

which is racy because the BlobSource assignment may or may not happen
before the check within outOfOrderIndexerLoop.

TestOutOfOrderIndexing was relying on the fact that apparently most
of the time the assignment seems to be happening before the check.

This patch:
-makes BlobSource (now blobSource) private, rendering the race impossible
out of the index package.
-moves the initialization of blobSource, as well as the execution of
outOfOrderIndexerLoop at a unique point, in InitBlobSource (new method).
-makes sure all accesses to blobSource are guarded with the index mutex
(now a RWMutex).

Context: while working on tests for http://camlistore.org/issue/454

Change-Id: I9605f26b41abd62b42880be0620b06ce143761bc
2014-06-27 22:29:29 +02:00
Brad Fitzpatrick da86ded96a Merge "index: Index MusicBrainz album IDs from music files." 2014-05-14 00:02:06 +00:00
mpl 2088ce739b search: sort by creation time
Change-Id: I3695d91dde0d42419c62a23f20ba19416c53e5ef
2014-05-08 18:55:53 +02:00
Daniel Erat aa391ecdd1 index: Index MusicBrainz album IDs from music files.
Index "MusicBrainz Album ID" ID3v2 frames as
"musicbrainzalbumid" media tags to facilitate downloading
cover art from coverartarchive.org.

Change-Id: Ie81017dd6f76ec355ee0d1daedfb7180cb70ad59
2014-05-05 20:45:58 -07:00
Brad Fitzpatrick bf2f09cab3 index: reschedule indexing a claim blob if public key blob isn't yet available
Change-Id: Ie0174bf830eb4790080b2b5e7cdc4ea0af25406f
2014-04-02 13:39:36 -07:00
Daniel Erat 5603ea8e0d pkg/index: Index audio duration.
Add pkg/media with code to calculate MPEG audio duration.
Index it in a "durationms" property.

Change-Id: Ifb6251657cadc365ef3f5667a0512fde17575560
2014-01-25 10:40:06 -08:00
Daniel Erat 404548d31a pkg/index: Index more music-related properties.
Add disc and mediaref (a hash of the audio portion of the
file).

Also relocate taglib code to
third_party/github.com/hjfreyer/taglib-go.

Change-Id: I58364f525b787484af894663125163095256d7c6
2014-01-22 21:25:05 -08:00
Daniel Erat 704d3c6bfc pkg/index: Rename audiotag to mediatag.
Also fix up keys and values and add tests.

Change-Id: I7e6c5c4315705442e3517456f2ba16419af49f2f
2014-01-20 21:46:39 -08:00
Brad Fitzpatrick 79fb299ff6 search: server-side search expression eval + result set continuation tokens
Search expressions (e.g. "tag:funny location:Portland") can now be
evaluated server-side (expr.go and expr_test.go, still nascent). Next
step is to remove this parsing and construction from the javascript UI
code.

In addition, the search result now contains a continuation token to
continue interating through the result sets in a subsequent query.
The Javascript UI should use this now instead of parsing out
modification times of things and altering the search.  If there's no
continuation token, that either means the end has been reached, or
that search type doesn't [yet] support iteration. Currently only
permanode-based queries are supported at many layers, including
continuation, but will be implemented later.

For now, the web UI should send a search query "expression" value of
non-zero length but just whitespace (like a single space: " ") to get
the home page (recently-modified permanodes") because setting both to
the zero value is an input validation error.  We should probably make
an expression operator to be more clear here (like "want:permanode
sort:recent").  But the empty space hack works for now.

Change-Id: I3ea92eb8c776159f53c49db1a7439a91c507940a
2013-12-21 15:59:11 -08: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
mpl 6c75ceb8b5 pkg/index: do not record a keySignerAttrValue on DelAttributeClaim
Change-Id: Ib1f81fe4879de2be7d484a5a40cc6bf0449893d5
2013-11-30 00:56:09 +01:00
mpl 1ee5fd20c5 search: deletions are not modifications
1) pkg/search: documented that deletions times do not
qualify as modtimes

2) pkg/index: got rid of DeletedAt, and keyDeletes

http://camlistore.org/issue/191

Change-Id: I39578913345454d36af4599e29e7053f46577846
2013-11-29 00:29:57 +01:00
mpl fa32346860 pkg/index: check for deletions in EdgesTo
Also introduced and used kvEdgeBackward

http://camlistore.org/issue/191

Change-Id: Ifdca9f2453ec0c7db55afc40cf0b5f1441b83158
2013-11-28 19:41:40 +01:00
mpl 2095a2c913 pkg/index: another delete test case
This test verifies that a permanode is still considered
deleted until all its deleters have been deleted.

http://camlistore.org/issue/191

Change-Id: Ifa4f17f031884b766d9ac90f1643a62ada591ae5
2013-11-28 16:34:49 +01:00
mpl 15bb5f142e pkg/index: use IsDeleted in some of the search methods
1) Done in AppendClaims, PermanodeOfSignerAttrValue,
SearchPermanodesWithAttr, PathsOfSignerTarget,
and PathsLookup.

2) camtypes.Path.DateClaim is now a time.Time, and used
as such in Path search methods.

3) Added kvSignerAttrValue, kvPathBackward, and kvPathForward

4) More Delete tests. We probably want more cases, but that's
a start.

http://camlistore.org/issue/191

Change-Id: I1d42485f2c6d1eea024f70378daacaaad9197768
2013-11-28 16:08:23 +01:00
Brad Fitzpatrick 3730cbafbb Merge "pkg/index: update the deletes cache when receiving a delete claim" 2013-11-27 18:29:02 +00:00
mpl 5f966c2f99 Merge "pkg/index: change deletes cache structure and meaning" 2013-11-27 17:45:52 +00:00
mpl 42e37d4456 pkg/index: update the deletes cache when receiving a delete claim
http://camlistore.org/issue/191

Change-Id: I49da2ef4e43675fba6a80db29ba96a473c159403
2013-11-27 18:44:39 +01:00
mpl 45b630f766 pkg/index: change deletes cache structure and meaning
1) The deletes cache now simply reflects all the keyDeleted index entries,
instead of trying to always hold the computed deletion state of the
blobs.

2) The IsDeleted and DeletedAt methods have been changed accordingly.
Moreover, while they previously were only taking into account the most
recent delete claim that affected the input blob, they now take
into account all delete claims that concern said blob.
In other words, a blob is considered "active" only if all of its past
deleters are deleted too (or it does not have any deleter).

http://camlistore.org/issue/191

Change-Id: I1b276dac0b3c6a3fb3beaf96828a45a85d27e4c6
2013-11-27 17:02:03 +01:00
Bill Thiede 0e00fd6198 search & index: change 'before' logic, and tests.
Change-Id: I62f43f26b295c46b9da63efe018d324f9105606b
2013-11-26 21:51:06 -08:00
Brad Fitzpatrick a918fac281 search: let GetRecentPermanodes take a before param.
For infinite scroll.  Will be done better later, but this works for now.

Change-Id: I88dc7793b643226a4a5e3a583c5de5d4c7fa4819
2013-11-25 20:35:59 -08:00
mpl c81f3147f6 pkg/index: write relevant keys when receiving a delete claim
This change:

1) Checks if the incoming claim is a delete claim with the use
of GetBlobMeta.

2) write the keyDeleted and keyDeletes keys when it's a delete
claim, plus the usual keys when the target is a permanode.

Yet to be done in the next CLs:
1) update the index deletes cache upon reception of a delete claim
2) update most of the search functions so they use deletedAt properly
3) add new keys necessary for GetRecentPermanodes to give a fully
correct result.

I also made indextest.DumpIndex public because it turned to be useful
to debug within pkg/search/ as well.

http://camlistore.org/issue/191

Change-Id: I8d8b9d12a535b8b1de0018b4a0e359241f14d52a
2013-11-19 18:02:12 +01:00
Brad Fitzpatrick 0b07171c0c index: change GetOwnerClaims interface for efficiency, rename to AppendClaims
Change-Id: Icec235961ed8a09256df87c5fe1455cbad81ae3f
2013-11-17 14:54:30 -08:00
Brad Fitzpatrick 272db6545a index: change GetBlobMIMEType to GetBlobMeta. mime types on a blob was wrong anyway.
And some more of in-memory search, which this makes easier / less garbage-y.

Change-Id: If1fa7dd44842244ae5e5440f84e92d66dc3321fb
2013-11-16 19:40:14 -08:00
Brad Fitzpatrick 705107ad80 search/index: invert depedency. search now depends on index.
creates new package types/camtypes for misc types needed by both. might eventually go away as
search matures.

Change-Id: Ib771ead7bea39936ba478b7e5d58de997060861b
2013-11-16 15:00:30 -08:00
Brad Fitzpatrick 25eca52283 Merge "pkg/search: add modtime in WANT to fix tests" 2013-11-16 22:26:28 +00:00
Brad Fitzpatrick 8a5161ec30 search: multiple constraints at top level
Change-Id: I964a0d394c3c03e2409c91fb1d240847ff07ddb3
2013-11-16 11:21:30 -08:00
mpl 01a8dbb163 pkg/search: add modtime in WANT to fix tests
Also fixed fakeindex clock to use a time.Time.
And synchronized the fakeindex and the indextests clocks to the
same origin.

Change-Id: I986abca300d61241069132619028f470cacd61da
2013-11-15 23:31:24 +01:00
mpl fdaf030bc0 index: add deletedAt method, and cache for deletion status
This method will be used to find out when a permanode or claim
was (un)deleted for the last time.

This change also introduces the keyDeletes index entry which
allows to find the permanodes/claims that a delete claim deletes.

Finally, since some index keys have changed, this CL introduces
a check for an index schema version, to force users to reindex
when needed.

http://camlistore.org/issue/191

Change-Id: I6f8e5d3030a6ddc8b21ff5dc5db311f2ea16f613
2013-11-06 23:34:13 +01:00
mpl 304f5c4b38 camput attr: support -del
Change-Id: I28460fed5b572ba9a83cfcb04f38e42124fa723f
2013-10-03 15:07:43 +02:00
mpl d488c576fc search: support for static directory children
This change introduces a new index entry
to help with finding the children of a static directory.
It also fixes ResolvePrefixHop so that it takes
into account static directories, and not only collections.

This is the first step to support publishing static directories.

http://camlistore.org/issue/179

Change-Id: I5666e5caa6c782004054ae4c19a6b6119d4fda8b
2013-09-10 23:06:48 +02:00
mpl 3a26c433db devcam: 'put' and 'get' commands, replace dev-camput and dev-camget
Also added -port flag, and untied the port to the
password in devcam server, always 'pass3179' now.

http://camlistore.org/issue/212

Change-Id: Iadf693951763d47907be17c53d4807a4706eb150
2013-09-01 10:25:09 -07: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 9468e5ba70 More docs. Every package is documented now.
misc.CountingReader moves into readerutil.

pkg/atomics is folded into pkg/types.

pkg/test/testdep is folded into pkg/test, with better name/docs.

Old cruft from pkg/webserver is deleted.

Change-Id: I3f72d8b29804254ef944995fb085837c878f79f5
2013-07-07 21:12:30 -07:00
Brad Fitzpatrick ace9474d95 index: index file times too, and return in index.GetFileInfo.
Change-Id: I59d91f0938c725a4cbdf5ca933cdff3529e25f5f
2013-02-18 21:31:41 -08:00
Brad Fitzpatrick 059b21f4d2 Merge branch 'master' of ssh://camlistore.org:29418/camlistore 2013-02-18 13:14:35 -08:00
Brad Fitzpatrick a74a3ec716 Add a version of dude.jpg with EXIF info.
Change-Id: Ic6d23d027690d56c97a800d411b125fbe2c4fb7e
2013-02-18 13:14:29 -08:00
Brad Fitzpatrick 8155b3867a Fix case of MimeType to MIMEType, per Go style.
Change-Id: I6c67a61cea2c71d7fa5d52c4ae283e33e993fd0f
2013-02-18 11:16:13 -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
mpl e95b1637b9 index: added tests for SearchPermanodesWithAttr
Change-Id: I6ad4a8092c5cc173a395a6ec847ba14be3763ca5
2013-01-18 23:24:45 +01:00
mpl cd32b0b5b9 move findGoPathPackage to osutil, and use it to define closureDir
Change-Id: I838a2e665591d13ecf3bb2689df1931d7e14465b
2012-12-13 12:31:56 +01:00
Brad Fitzpatrick 3057358cfc Index the dimensions of images. 2012-11-07 23:54:00 +01:00
Brad Fitzpatrick 832b774025 search: add EdgesTo handler and tests 2012-11-05 15:09:34 +01:00
Brad Fitzpatrick f696007a14 index: implement EdgesTo
For finding back references in the graph.
2012-11-05 10:29:42 +01:00
Brad Fitzpatrick e783ad1717 Add another search handler test, for recent permanodes.
Change-Id: Iaf40cd94aba7b96c16fa1b04c2bfcebdfeea870e
2012-11-04 15:26:13 +01:00
Brad Fitzpatrick 933375019d Remove *testing.T from IndexDeps constructor; use Fataler interface
Change-Id: I1cfcc2fa8059dca3f4e082c1dae896974d3d0e02
2012-11-04 12:27:45 +01:00
Brad Fitzpatrick 69e155af64 Replace panics with t.Fatal
Change-Id: I7a514f4a67dbf44eff2448a423082c528e9ee365
2012-11-03 14:54:53 +01:00
Brad Fitzpatrick 1466c77198 Add 'edgeback' key to index, for going backwards.
Change-Id: I43057a6fb96c3e8d9364002288d5c7b9ad2fd034
2012-11-03 14:25:48 +01:00
mpl 83ce85b59f old TODOs
Change-Id: Ifa8877f594e65e081536b97f536106301f5c9836
2012-10-19 23:37:14 +02:00