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

Constant for common selectors #171

Closed
willscott opened this issue May 19, 2021 · 9 comments
Closed

Constant for common selectors #171

willscott opened this issue May 19, 2021 · 9 comments

Comments

@willscott
Copy link
Member

There is currently no way to easily get an ipld.Node version of a selector representing "give me the whole dag".
This is a very common request, and that it involves something like

	ssb := builder.NewSelectorSpecBuilder(basicnode.Prototype__Any{})
	ss := ssb.ExploreRecursive(selector.RecursionLimitNone(), ssb.ExploreUnion(
		ssb.Matcher(),
		ssb.ExploreAll(ssb.ExploreRecursiveEdge()),
	))
	ss.Node()

but there isn't documentation or examples of that anywhere leads to a lot of confusion.

@ribasushi
Copy link
Contributor

@willscott @mvdan fwiw markets does put it behind a const-like function: https://pkg.go.dev/github.com/filecoin-project/go-fil-markets/shared#AllSelector

@ribasushi
Copy link
Contributor

@willscott ... and it is different from your example... confusing 🤔

@willscott
Copy link
Member Author

the difference is if you want to 'match' all nodes, or just 'cover' all nodes

see https://github.com/ipld/go-ipld-prime/blob/master/traversal/selector/matcher.go#L9-L18

@rvagg
Copy link
Member

rvagg commented Jun 4, 2021

What's the practical difference between these two operations? matching vs covering? I don't grok the difference in how you'd consume these things as distinct operations. It seems to me that the AllSelector version is doing a dag walk, while the ExploreUnion + Matcher is ... addressing the entire dag? What are the usage patterns that make this distinction helpful?

@willscott
Copy link
Member Author

willscott commented Jun 4, 2021 via email

@ribasushi
Copy link
Contributor

@willscott just checking in case I missed a thread elsewhere: has here been any movement on this?

@willscott
Copy link
Member Author

@ribasushi there is: it's in #199

@mvdan
Copy link
Contributor

mvdan commented Jul 21, 2021

I'd love it if we could get this over the finish line :) Another person is struggling to use go-car with selector nodes: ipld/go-ipld-adl-hamt#24 (comment)

@warpfork
Copy link
Collaborator

#199 did introduce some of these, and is now merged, so I think this can be marked closed as a success.

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

No branches or pull requests

5 participants