simple fetchers (#1492)

* network: disable shouldNOTRequestAgain
* vendor singleflight
* network: disable shouldNOTRequestAgain
* network, storage: fix tests
* network/storage: remove HopCount and SkipCheck
* network/stream: use localstore when providing chunks a node has offered
* storage: refactor lnetstore
* storage: rename FetcherItem to Fetcher
* storage/feed: no distinction between catastrophic err or chunk not found
* network/stream: remove TestDeliveryFromNodes, as FindPeer is changed, and Swarm connectivity is not a chain
* network/stream: fixed intervals tests
* swarm: fixes for linter
* storage: use LRU cache for fetchers
* network, storage: better godoc
* storage/netstore: explicit errors
* storage/feed/lookup: Clarify ReadFunc expected return error values
* storage: address comments by elad
This commit is contained in:
Anton Evangelatov
2019-06-18 08:47:27 +02:00
committed by acud
parent f57d4f0802
commit d589af14a8
23 changed files with 746 additions and 2246 deletions

View File

@@ -93,20 +93,20 @@ func newTestClient(t string) *testClient {
}
}
func (self *testClient) NeedData(ctx context.Context, hash []byte) func(context.Context) error {
func (self *testClient) NeedData(ctx context.Context, hash []byte) (bool, func(context.Context) error) {
self.receivedHashes[string(hash)] = hash
if bytes.Equal(hash, hash0[:]) {
return func(context.Context) error {
return false, func(context.Context) error {
<-self.wait0
return nil
}
} else if bytes.Equal(hash, hash2[:]) {
return func(context.Context) error {
return false, func(context.Context) error {
<-self.wait2
return nil
}
}
return nil
return false, nil
}
func (self *testClient) Close() {}