We have code to traverse a DAG in many places: * The best in that it can do it in parallel and non-recursively is https://pkg.go.dev/github.com/ipfs/boxo/ipld/merkledag#WalkDepth, but also does sequential+recursive. It is used for pinning traversal. * There is a subpackage to that package that also does traversal in the same way: https://pkg.go.dev/github.com/ipfs/boxo@v0.35.2/ipld/merkledag/traverse, but you can specify traversal order (unsure if anyone uses other than the default). * Kubo core/commands has its own implementations: * For refs -r https://github.com/ipfs/go-ipfs/blob/4bdc9ad22011cab1c58332e69e9889affb95b7f2/core/commands/refs.go#L213-L264 * And there is https://pkg.go.dev/github.com/ipld/go-ipld-prime@v0.21.0/traversal#WalkLocal which is used by Blockservice and for DAG-providing We should be able to consolidate into one or two of these...
We have code to traverse a DAG in many places:
We should be able to consolidate into one or two of these...