feat: add UnixFSPathSelectorBuilder #45
Merged
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.
Refactored and extracted out of Lassie and modified a bit for here.
Ref: filecoin-project/lassie#142
I've done two things aside from pulling code out of Lassie:
full
bool we have in Lassie. But I've added some standard ones as globals here that can be easily used—we'll just use two of those for lassie.matchPath
option, like https://github.com/ipld/go-ipld-selector-text-lite/blob/1e69f951f8e30621f39f7090dac8c8f49200f1e4/parser.go#L40, to give the optionality to visit the path elements. I'm not sure if there's a great case for this but I don't really want to break the API by adding it later on and explore vs match is a feature of selectors as they are today.UnixFSPathSelector
to useUnixFSPathSelectorBuilder
underneath—this does have some subtle breaking changes, however: extraneous/
are ignored—leading and trailing and duplicate, previously it did a strict split on/
and treated the elements as necessary, even if they were""
. If you look at the tests I added for this function, onlyleading slash optional
passes on the old form because others have extraneous/
characters that were strictly treated previously.