Expose selector traversal options for SelectiveCar #251
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Expose
Options
forNewSelectiveCar()
for two new features available in go-ipld-prime:traversal.LinkVisitOnlyOnce
which I've calledTraverseLinksOnlyOnce
here - defaulting tofalse
traversal.Budget#LinkBudget
which I've calledMaxTraversalLinks
here - defaulting to disabledI've gone with the same
Options
pattern as in v2 and taken @masih's advice here to keep it generic (rather than useSelectiveCarOptions
) so the same pattern can be used for the non-selective CAR usage functions. We'll just have to be clear about what options apply to what functions I suppose.I've put
Traverse
in both option names for this reason - to try and make it clear that they are for selector traversal. But, in the future we could retire the merkledagWalk
use here and replace it with ipld-prime's traversal (but withLinkVisitOnlyOnce
enabled by default which would make it equivalent in functionality). So both of these options would make sense for that case too. I'm open to critique of the naming if anyone has stronger opinions.I also extracted
TestRoundtripSelective
to the newselectivecar_test.go
, but the other two top-level tests in there are new.