Commit Graph

22 Commits

Author SHA1 Message Date
aviau 127297ff99 go fmt ./... + add CI test
Some code was merged without being fmt-compliant. This
PR runs `go fmt ./...` and adds a test to github workflows
to verify that pull requests are fmt-compliant.
2021-01-16 23:12:12 -05:00
mpl 20ffe5af92 pkg/index: convert more funcs to using a GPG key ID
corpus.AppendPermanodeAttrValues and corpus.PermanodeAttrValue now take
a GPG key ID as their signer filter attribute, instead of a blob Ref.

Fix search package accordingly.

Fixes #1069

Change-Id: I0ef519fc16cf357adb84c32fa6e5bf92d8a0de26
2018-03-02 19:58:18 +01:00
mpl 0c1b99b4c5 pkg/index: fix location in corpus to use signer ID instead of blobRef
Follow-up of ec66bcc871

Updates #537

Change-Id: Ib4dc62ae6be91c061dc6de4bfdd617785abdaab6
2018-01-23 19:11:52 +01:00
mpl 22734c9d29 pkg/index: fix corpus tests
Follow-up of ec66bcc871

I had run the pkg/search tests to see if no high-level search was
broken, for forgot about pkg/index itself, whoops.

Change-Id: Iec3aa28aca82ac6773983ea9df9ade26a48fc4a7
2018-01-19 20:53:41 +01:00
Brad Fitzpatrick 38f10a7bd0 all, testhooks: use sha224 by default, add hook for some tests to use sha-1
Remove the blob.SHA{1,224}From{Bytes,String} constructors too. No
longer used. This adds blob.RefFromBytes which was missing. We had
blob.RefFromString. Now everything uses blob.RefFrom* instead of
specifying a hash function.

Some tests set a flag to force use of SHA-1 because there was too much
golden data to update. We can remove those one-by-one over time as we
fix up tests.

Updates #537

Change-Id: Ibe6428089a6221594c2b751f53f98b03b5a28dc2
2018-01-09 20:03:38 -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 d717b58fd3 pkg/index: fix enumeration tests
related to 93c6d682d2

Change-Id: I2fa0df6da70df1297712ee0c9279a625b0ac88ca
2017-08-30 01:01:56 +02:00
Brad Fitzpatrick 93c6d682d2 pkg/search: change corpus enumeration signatures for speed
Avoid select overhead in hot paths. Just use funcs.

Also, for sort-by-map searches, don't do a describe and pass over all
the results doing location lookups a second time. Remember the
location from the initial matching. Cache it on the search value.

Reduces some sort-by-map searches from 10 seconds to 3 seconds for
me. (still too slow, but good start)

Change-Id: I632954738df9accd802f28364ed11e48ddba0d14
2017-08-29 11:10:10 -07:00
Attila Tajti 0f55bfe980 index: improve Corpus attr lookup with signer filter
Keep attributes for each signer in PermanodeMeta
to make Corpus methods AppendPermanodeAttrValues,
PermanodeAttrValue perform well even with a signerFilter.

Also add index/util_test.go to the notAnIndexer slice
of index/index_test.go.

Fixes #861

Change-Id: Ic25470b7d42e40a6f9d0ed0bf868ef3755413289
2016-10-06 18:01:28 +02:00
mpl 1fcacd8e85 pkg/index: add missing locking for some tests
As rev e93e4f3822 moved the responsibility
of locking the corpus to a higher up locking of the index, some tests
now need to add some locking of their own to avoid data races.

Context: issue #750

Change-Id: Ifaf87e275432fe5e66639fae2699d27b566c93aa
2016-05-03 15:07:49 +02:00
Brad Fitzpatrick e93e4f3822 Fix deadlock in search/index.
The describe requests were launching a storm of RLocks which weren't
safe in the presence of goroutines trying to acquire write locks.

Instead, make the corpus locking the responsibility of the caller and
add Lock/Unlock/RLock/RUnlock methods to the index and move locking up
a level.

This also adds a fair bit of context.Context plumbing which was used
in earlier debugging.

Fixes camlistore/camlistore#709

Change-Id: I8d7254d1e1da541f8c080d62f5408aac807fd3b1
2016-04-22 14:57:10 -07:00
mpl 8580b811cf pkg/index: make corpus RLock take a context
Also remove extra (deadlocking) RLock in pkg/search.

Updates issue #709

Change-Id: I556a1fbf9217f482b6a51e74c28a019dea8369a2
2016-04-21 11:28:24 -07:00
Tamás Gulácsi 8d6b156a0b Misc syntax cleanup found by gosimple.
https://github.com/dominikh/go-simple

Thanks to Dominik Honnef for this great little tool!

Change-Id: I789b3a37e18f535df1ff0da47c0366ed01b2429e
2016-04-04 17:19:57 +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
Attila Tajti 44b4e855d2 index/Corpus: add Attrs cache to PermanodeMeta
- add an Attrs map to PermanodeMap that is kept in sync with Claims
- update Attrs map on scanFromStorage and whenever a new blobRef is added
- add fast path to AppendPermanodeAttrValues(Locked),
  PermanodeAttrValueLocked and PermanodeHasAttrValueLocked
- fix bugs in and add tests for PermanodeHasAttrValueLocked and
  PermanodeAttrValueLocked slow path

Change-Id: Ib0dcdcf9355dd5fa8588c872721a029ec114cb6b
2016-01-27 17:09:18 +01:00
Tamás Gulácsi 9f7e1df32b Remove pkg/context
Use golang.org/x/net/context instead.

Fixes #648.

Change-Id: I676a2f25458be97610a49d6f954f2102cbd373fa
2015-12-12 23:09:02 +01:00
mpl 94f598ddb9 index/corpus: cache sorted (by time) permanodes
Context: http://camlistore.org/issue/298

Change-Id: I599f430e0f7691e54df38e10344c62cbdb6429a0
2014-06-24 02:39:25 +02:00
mpl 2088ce739b search: sort by creation time
Change-Id: I3695d91dde0d42419c62a23f20ba19416c53e5ef
2014-05-08 18:55:53 +02:00
mpl 0fdca769e0 corpus: deleted check when enumerating permanodes
http://camlistore.org/issue/354

Change-Id: I7d76c654eb3b875ad8017a14a08a5c909bd696a0
2014-03-10 18:43:57 +01:00
Brad Fitzpatrick 328706b8c6 index: bunch of TODOs and planning for edge tracking
Also, change to storing a pointer to claims so those pointers can be re-used elsewhere.

Change-Id: Ib0979d622ba48f1e2389575d07d7a0930264ebea
2013-12-09 17:15:34 +04:00
Brad Fitzpatrick de3de4c499 index: remove 2 allocs (3% of mem) in kvClaim, via Corpus.mergeClaimRow
And some tests.

Change-Id: Ifd57b027e193d0356bca140c93c18963be664bae
2013-12-03 21:52:12 -08:00
Brad Fitzpatrick 1ec41b95f0 Speed up in-memory permanode attribute search.
Finishes Corpus.AppendPermanodeAttrValues and uses it in
PermanodeConstraint.

Change-Id: I031789e0974add24886cc0060e52ba538535c4e1
2013-11-27 12:47:04 -08:00