Skip to content

Graphsync Simplication Idea: Refactor go-ipld-prime selector traversals so we don't need ipldutil.Traverser #260

Open
@hannahhoward

Description

@hannahhoward

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/daysEstimated to take multiple days, but less than a weekkind/discussionTopical discussion; usually not changes to codebase

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions