Skip to main content

Module bundle_cache

Module bundle_cache 

Source
Expand description

The local bundle-manifest cache decdn bundle pull --hash keeps under an output directory. It stores each fetched bundle manifest blob verbatim, keyed by its BLAKE3 content address, so a repeat pull of the same bundle into the same directory reads the manifest from disk instead of paying to fetch the blob again over cdn/client/v1.

The cache is content-addressed and self-verifying: a load re-hashes the bytes and returns them only when the digest still equals the requested hash, so a corrupt or tampered file is never trusted. A load tells two cases apart: a missing file is a plain miss, and any other failure (a read error, or bytes that fail the hash check) is an error that names the path, for the caller to act on. A real pull is fail-open: it prints that error as a warning and fetches the manifest fresh, so a bad cache file only costs one manifest fetch. A write failure prints a warning that names the path and never fails the pull. A real pull under --overwrite skips the read to force a fresh fetch. The cache also lets bundle pull --hash --dry-run list a bundle’s entries with no network; the dry run reads it even under --overwrite, because verified bytes equal what a fresh fetch returns, and it fails on a cache file it cannot use, because the cache is its whole answer.

Only the --hash path uses it: an -i local manifest is already on disk for free, with nothing to cache or re-pay.