perkeep/pkg/client
mpl 6f5a718ad1 cmd/camget: update client share chain when getting blobs from cache
When fetching shared blobs, we rely on the share chain to verify if a
blob can be reached. This chain is updated whenever we fetch an
additional link of the chain, by updating the Client.via map. However,
when some blobs of the chain are already cached in camget's DiskCache,
because we get them from the cache, we don't fetch them with
Client.FetchVia, which means the Client.via map isn't updated. And thus
the chain is broken.

This change adds Client.UpdateShareChain, and sets it as a hook to be
called by the CachingFetcher in the event of a cache hit. That way, we
ensure that the share chain is updated even when we get blobs from the
cache (instead of from the Client).

We also add a mutex to guard Client.via, because it is accessed by
concurrent smartFetch calls in case of a static-set.

As FetchVia was undocumented and not used by anyone, I made it
unexported. We can always export it again later when needed.

Fixes #856

Change-Id: I767cbec4b6f382cbccc25c0b97782b2a7472deb8
2016-09-26 19:03:04 +02:00
..
android add canonical import paths 2016-03-13 19:57:14 -07:00
client.go cmd/camget: update client share chain when getting blobs from cache 2016-09-26 19:03:04 +02:00
config.go website: update doc URLs 2016-04-27 08:48:50 -07:00
config_test.go pkg/client: fix method to find a server in the config 2014-01-07 18:52:48 -08:00
enumerate.go Remove pkg/context 2015-12-12 23:09:02 +01:00
get.go cmd/camget: update client share chain when getting blobs from cache 2016-09-26 19:03:04 +02:00
ignored_test.go Misc syntax cleanup found by gosimple. 2016-04-04 17:19:57 +02:00
remove.go gofmt 2014-03-20 12:29:45 -07:00
stat_test.go httputil: add DecodeJSON and CloseBody helpers, then use them everywhere 2014-01-28 22:00:52 -08:00
stats.go
transport_test.go pkg/client: fix transport tests for fba8b457de 2016-01-07 15:50:47 +01:00
upload.go Delete misc unused objects 2016-04-06 17:59:51 +02:00
upload_test.go pkg/client: set camliType, use correct blobref 2016-01-06 17:44:08 +01:00