swarm: Debug API and HasChunks() API endpoint (#18980)

(cherry picked from commit 41597c2856)
This commit is contained in:
holisticode
2019-02-07 09:49:19 -05:00
committed by Rafael Matias
parent 637a75d61a
commit d1ace4f344
12 changed files with 145 additions and 37 deletions

View File

@@ -158,6 +158,13 @@ func (n *NetStore) get(ctx context.Context, ref Address) (Chunk, func(context.Co
return chunk, nil, nil
}
// Has is the storage layer entry point to query the underlying
// database to return if it has a chunk or not.
// Called from the DebugAPI
func (n *NetStore) Has(ctx context.Context, ref Address) bool {
return n.store.Has(ctx, ref)
}
// getOrCreateFetcher attempts at retrieving an existing fetchers
// if none exists, creates one and saves it in the fetchers cache
// caller must hold the lock