Expand description
Directory walker for :upload-collection. Recursively reads a
local directory and produces the Vec<CollectionEntry> that
bee.file().upload_collection_entries(...) consumes.
§Why a separate module
:upload-file is one tokio::fs::read away from a working
upload — it doesn’t need its own module. Collections are
different: traversal rules (skip hidden, skip symlinks),
caps (size + entry count), and tar-friendly path normalisation
all want unit tests against synthetic on-disk fixtures.
Keeping the walker pure (no Bee API, no tokio runtime) makes it
straightforward to test that.
§Path normalisation
Tar entries within a collection use forward-slash separators
regardless of host OS — Bee resolves them to manifest forks
literally. We strip the input-dir prefix from each walked path,
convert backslashes to forward slashes (Windows safety), and
reject any path that escapes the root via .. (defense in
depth — WalkDir shouldn’t surface them when symlinks are
ignored, but we keep the explicit check).
Structs§
- Walked
Collection - Result of a directory walk.
Enums§
Constants§
- MAX_
COLLECTION_ BYTES - Total bytes an
:upload-collectioninvocation is allowed to pack. Same ceiling as:upload-file: keeps the cockpit’s event loop responsive on operator-typical hardware. Operators with larger payloads should driveswarm-cliout of process. - MAX_
COLLECTION_ ENTRIES - Cap on entry count. A 10k-file collection is already extreme
for a TUI verb (the tar build is in-memory) but the cap is
generous enough that a typical static-site
dist/directory fits without question.
Functions§
- walk_
dir - Walk
rootrecursively, returning every regular file as aCollectionEntry. Hidden files / directories (any path component starting with.) and symlinks are skipped.