Expand description
Pull a whole bundle: every blob a bundle manifest names, into an output
directory, over the paid cdn/client/v1 path.
A bundle is a JSON manifest of (path, hash, size, chunks) entries
(adr/appendix-bundles.md). BundlePuller fetches each distinct blob
once, from one shared payment pool, and lands it at every path that names
it. It resumes from what an earlier run left: a file already on disk is
skipped, a byte-identical file elsewhere in the output directory is linked,
a range a sibling entry shares is spliced from disk, and a .partial an
interrupted run left is the next fetch’s prefix.
§A pull, end to end
- Resolve the holders once for the run with
select_nodes: the pinned node, or every active registered node for each entry to sample. - Build a
BundlePullerover the chain, the local site, an endpoint, a buyer-pool store and theFundingthe pull pays from. - Get the manifest:
BundlePuller::fetch_manifestit by its hash, orBundleManifest::parsebytes you already hold. - Drop the entries you do not want, then
BundlePuller::pullthe rest. Progress reaches aBundleObserver; the result is aBundleOutcome. BundlePuller::finishwaits for the lanes’ watermark writes.
The pull future is not Send: every entry and lane runs on the task that
awaits it. Await it in place, or on a tokio::task::LocalSet.
Structs§
- Bundle
Manifest - A bundle manifest: the files a bundle publishes (
adr/appendix-bundles.md). - Bundle
Outcome - How a bundle pull ended, and what it did.
- Bundle
Puller - Pulls bundles into a directory over one paid run: one pool, one connection per node, one progress clock.
- Bundle
Puller Builder - Builds a
BundlePuller(BundlePuller::builder). - Bundle
Report - What a bundle pull did. Counts are per entry, and
fetched,linked,skipped,reused,failedandnot_runadd up to the manifest’s entry count. Every byte total butSelf::paid_bytesis content bytes and leaves out the bao proof overhead. - Entry
Failure - One entry a bundle pull failed to land.
- Entry
Landed - One blob that landed (
BundleObserver::entry_landed). No byte counts in more than one ofpaid,splicedandresumed. - Foreign
Path - A path a pull may replace that no record vouches for (
foreign_paths). - Manifest
Chunk - One chunk of a
ManifestEntry: an independently BLAKE3-addressed run of the file’s bytes, placed at the running sum of the earlier chunks’ sizes. - Manifest
Entry - One file of a
BundleManifest. - Node
Selection - Where a pull’s entries find their holders: the pinned node, or every
active registered node for each entry to sample. Resolve it with
select_nodes. - NotA
Manifest - Bytes that are not a v1 bundle manifest:
BundleManifest::parse’s error, so a caller can tell a blob that is not a manifest from a failed fetch.
Enums§
- Bundle
End - Why a bundle pull ended.
- Foreign
Reason - Why no skip-cache record vouches for a
ForeignPath. - Funding
- What a bundle pull pays from.
Constants§
- STAGING_
DIR - The directory under the output root where a pull stages the blobs it
fetches:
<hex>.partialand its resume record while a blob is in flight, and<hex>once it is verified and before it lands at its paths.
Traits§
- Bundle
Observer - Where a bundle pull reports its progress. Every method has a default that does nothing. The pull calls them from the task that awaits it.
- File
Observer - Where one blob of a bundle pull reports its progress. Every method has a default that does nothing.
Functions§
- foreign_
paths - The entries of
manifestwhose path underout_dirholds something that a pull of the same entry may replace without the user’s say: a file, directory or link that no record in the skip-cache inout_dirvouches for. A record vouches for a path when the file there still has the recorded size and mtime, and the record names this entry (this manifest hash and manifest path) or holds this entry’s bytes. A caller that did not chooseout_dircan refuse the pull first. - parse_
hash - Parse a BLAKE3 hash as a bundle manifest or a user names it: 64 hex
characters, with an optional
0xorb3:prefix. - select_
nodes - Resolve where a pull’s entries find their holders, once for the run.