ipfs-unixfs: Walker support for skipping or detaching subtrees #213
Description
The current unixfs/examples/get.rs
is actually an example of ipfs ls
but with different formatting. It would be "compatible" with ipfs ls
if ipfs_unixfs::walk::Walker
(re-exported as ipfs::unixfs::ll::walk::Walker
) would support subtree skipping. Skipping was thought of but turned out it was out of scope for /get
in #189. Skipping in turn could be used as a form of "detaching the next work items" suitable to be put in a work queue shared by multiple workers at the expense of cloning the accumulated paths for each work item.
For ipfs ls
compatibility in the example skipping would always happen deeper than the root directory block(s) (multiple in case of HAMT sharded directory). To skip files it would mean replacing the Option<FileVisit>
inside InnerEntry
of InnerKind::File
with None
, or returning a new Walker
value just for that file. For skipping directories It would mean popping elements for any larger depth than the current depth, or returning them as a single or multiple Walker
values. Symlinks are single blocks so skipping should not do anything on them.