Skip to content

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.

2 participants