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 entity matcher w/o preload, add matcher fn for consuming bytes #52

Merged
merged 1 commit into from
Jul 7, 2023

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Jun 16, 2023

Draft, WIP, for experimenting with filecoin-project/lassie#306

  • Added MatchUnixFSEntitySelector as a replacement for MatchUnixFSPreloadSelector that doesn't use unixfs-preload. Added a possible deprecation notice to MatchUnixFSPreloadSelector.
  • Added BytesConsumingMatcher as a matcher function for traversal.WalkMatching that will slurp bytes for you upon match, designed for use with the Match* selectors in here.

@rvagg
Copy link
Member Author

rvagg commented Jun 16, 2023

FYI, this .. works, replacing unixfs-preload

	return ssb.ExploreInterpretAs("unixfs-preload", ssb.Matcher())

with

	return ssb.ExploreInterpretAs("unixfs", ssb.ExploreUnion(ssb.Matcher(),
		ssb.ExploreRecursive(
			selector.RecursionLimitDepth(1),
			ssb.ExploreAll(ssb.ExploreRecursiveEdge()),
		),
	))

and consuming bytes in a matcher.

But I think it fails for the non-unixfs case where we want to match "entity". I wonder was that why this approach wasn't taken with the original request that sparked unixfs-preload (filecoin data explorer IIRC)? Or was there something else I'm missing?

@willscott
Copy link
Collaborator

My explanation here is that preload when implemented was focused almost entirely on the directory case rather than on the file case.

@hannahhoward
Copy link
Collaborator

hannahhoward commented Jun 17, 2023

@rvagg doesn't this still traverse the dir links? It's not the same no? Therefore it traverses more than the required bytes?

@rvagg rvagg force-pushed the rvagg/nopreload-byte-ranges branch from de5cbf7 to 166be19 Compare July 7, 2023 09:04
@rvagg rvagg changed the title feat: no unixfs-preload use, matcher for consuming bytes feat: add entity matcher w/o preload, add matcher fn for consuming bytes Jul 7, 2023
@rvagg rvagg marked this pull request as ready for review July 7, 2023 09:06
@rvagg
Copy link
Member Author

rvagg commented Jul 7, 2023

Ready for review now, updated OP with this:

  • Added MatchUnixFSEntitySelector as a replacement for MatchUnixFSPreloadSelector that doesn't use unixfs-preload. Added a possible deprecation notice to MatchUnixFSPreloadSelector.
  • Added BytesConsumingMatcher as a matcher function for traversal.WalkMatching that will slurp bytes for you upon match, designed for use with the Match* selectors in here.

Copy link
Collaborator

@hannahhoward hannahhoward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hannahhoward hannahhoward merged commit 056398d into main Jul 7, 2023
18 checks passed
rvagg added a commit to ipld/frisbii that referenced this pull request Sep 2, 2023
rvagg added a commit to ipld/frisbii that referenced this pull request Sep 2, 2023
@rvagg rvagg deleted the rvagg/nopreload-byte-ranges branch September 23, 2023 12:04
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.

3 participants