Closed rvagg closed 1 year ago
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?
My explanation here is that preload
when implemented was focused almost entirely on the directory case rather than on the file case.
@rvagg doesn't this still traverse the dir links? It's not the same no? Therefore it traverses more than the required bytes?
Ready for review now, updated OP with this:
MatchUnixFSEntitySelector
as a replacement for MatchUnixFSPreloadSelector
that doesn't use unixfs-preload. Added a possible deprecation notice to MatchUnixFSPreloadSelector
.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.
Draft, WIP, for experimenting withhttps://github.com/filecoin-project/lassie/pull/306MatchUnixFSEntitySelector
as a replacement forMatchUnixFSPreloadSelector
that doesn't use unixfs-preload. Added a possible deprecation notice toMatchUnixFSPreloadSelector
.BytesConsumingMatcher
as a matcher function fortraversal.WalkMatching
that will slurp bytes for you upon match, designed for use with theMatch*
selectors in here.