Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit 737e98c

Browse files
committed
update blocking readme
1 parent 0b8a0ad commit 737e98c

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

hamt/hamt.go

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,23 @@ func (ds *Shard) EnumLinksAsync(ctx context.Context) <-chan format.LinkResult {
352352
defer cancel()
353353
getLinks := makeAsyncTrieGetLinks(ds.dserv, linkResults)
354354
cset := cid.NewSet()
355-
// FIXME: The Shard.cid field which `dag.Walk` depended on is not always
356-
// set on the Shard creation (only when loading from a node). We extract
357-
// the node here then, but this of course means fetching all the shards
358-
// beforehand which is exactly what we don't want. Will look at alternatives
359-
// to make this more standard.
355+
// FIXME: The `dag.Walk` interface depends on the CID of the root of
356+
// the DAG being traversed.
357+
// When this function is called from `io.sizeBelowThreshold` we may
358+
// not have that available (as the directory has changed and the last
359+
// CID from which the `io.HAMTDirectory` was loaded from, if any, might
360+
// be outdated).
361+
// Ideally we would need to extend the DAG walk function to handle Shards
362+
// and not IPLD nodes. (See https://github.com/ipfs/go-ipld-format/blob/master/walker.go
363+
// as an example of a more generic walker that doesn't necessarily depend
364+
// on IPLD nodes and CIDs, although it may not be the correct choice here.)
365+
//
366+
// For the moment, to make the current PR tests pass, we force the Shards
367+
// to serialize to an IPLD node to extract its CID for the `Walk` API,
368+
// but this of course means fetching all the shards in the directory
369+
// beforehand which is exactly what we don't want (defeating the initial
370+
// purpose of the `io.sizeBelowThreshold` that tries to retrieve as little
371+
// shards as possible).
360372
rootNode, err := ds.Node()
361373
if err != nil {
362374
emitResult(ctx, linkResults, format.LinkResult{Link: nil, Err: err})

0 commit comments

Comments
 (0)