Graphsync Simplication Idea: Refactor go-ipld-prime selector traversals so we don't need ipldutil.Traverser
- Dominant language
- Go
- Stars
- 103
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
# What
Rather than use ipldutil.Traverser, refactor go-ipld-primes selector traversal code so you can directly interact at the block level.
# Why was it this way
Go-ipld-prime's selector traversal returns information -- assembled ipld nodes -- that are unrelated to what we want to send over the wire -- IPLD blocks. As a result, all of the logic to send and receive data happens inside of a callback you pass to the selector traversal for block loading.
# Consequences
We do a lot to work around the fact that the interface for go-ipld-prime's selector traversal fundamentally does not meet the needs of go-graphsync. We've ended up with a complex module called the Traverser that masks the actual structure of the ipld-prime traversal call inside of an interface that is slightly more suited to the needs of go-graphsync. It contains a hidden go-routine and while the channel logic works, it's quite complicated and has needed several revisions.
# Why leave it as it is
To some extent, refactoring selector traversal would just move the complexity to go-ipld-prime. However, if we can built a version with no go-routines and less recursion,specifically suited to the needs of go-graphsync, this would make debugging much easier
Contributor guide
Assessment
This issue has not been assessed yet.