Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add UnixFSPathSelectorBuilder #45

Merged
merged 1 commit into from
Mar 13, 2023
Merged

feat: add UnixFSPathSelectorBuilder #45

merged 1 commit into from
Mar 13, 2023

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Mar 9, 2023

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:

  • Made the target selector something you have to provide, so you can do something custom at the target rather than the 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.
  • Added a 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.
  • Rewired UnixFSPathSelector to use UnixFSPathSelectorBuilder 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, only leading slash optional passes on the old form because others have extraneous / characters that were strictly treated previously.

Refactored and extracted out of Lassie

Ref: filecoin-project/lassie#142
@rvagg
Copy link
Member Author

rvagg commented Mar 10, 2023

This branch pulled back into lassie and used from there: filecoin-project/lassie#142 - note the use of the global SelectorSpecs from here in place of the original full bool.

@rvagg rvagg merged commit f859a00 into main Mar 13, 2023
@rvagg rvagg deleted the rvagg/selector branch March 13, 2023 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant