Graphsync Simplication Idea: Refactor go-ipld-prime selector traversals so we don't need ipldutil.Traverser #260
Labels
effort/days
Estimated to take multiple days, but less than a week
kind/discussion
Topical discussion; usually not changes to codebase
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
The text was updated successfully, but these errors were encountered: