Repository navigation
feat(client)!: keep each download in an iroh-blobs store - #2958
Merged
Merged
Conversation
A download keeps its verified bytes, their outboard and the present ranges in an iroh-blobs file store beside its destination, `<dest>.decdn`. A resumed download reads them back from the store; the `.partial` data file and its `.partial.ranges` record are gone. Once the blob is complete the store exports it to the destination (moving the data file where the file system allows) and the directory is removed. - `ClientRangedStore` wraps one blob in an iroh-blobs `Store`. Its ingest decodes and verifies as before, then writes each batch of verified items (64 KiB ramping to 4 MiB) as one import before marking it present, so `present` stays an in-memory read and a reader never asks for a byte the store does not hold. - The store runs with no GC and is removed whole. A partial entry whose size the store never validated leaves out its last chunk group at open, and `finalize` does the same for an entry that holds every range but reads partial: fetching that group records the blob complete (iroh-blobs 0.105 recovers a completed-but-unsynced blob that way). - The downloader hashes the exported file. One whose bytes changed on disk after they verified is removed and fetched again from an empty store, sharing the pass's sources so its vouchers continue. - A bundle entry keeps its own store at `.decdn-partial/<hex>.decdn`; the dedup assembly reads the store's ranges through it. - `ScratchStores` opens one store in its scratch directory on first use. - Tests: unit tests run on an in-memory store (`ClientRangedStore:: in_memory`), which runs on the test's runtime, so paused-clock tests see its work; resume and export tests run on a file store. - `Downloader::refetched_targets` goes: no finalize hash refetches from scratch anymore. - `decdn-client` now links iroh-blobs (file store only, no aws-lc or JSON-RPC server), and so do the CLI and the sponsord daemon. The crate-edge table and CLAUDE.md say so. #2881 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The whole-file hash after an export (and of a destination that already exists) reads the file 16 MiB at a time and hashes each read with `blake3::Hasher::update_rayon`. It read 8 KiB at a time on one thread. No memory map: a file another process truncates under a map would crash the process. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Code coverage overviewLanguages: Rust, Solidity Rust / code-coverage/cargo-llvm-cov
View coverage of the 10 most impacted files.
Solidity / code-coverage/forge
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
… store iroh-blobs exports only to an absolute path, and a download's destination can be relative to the working directory (a bundle pulled to its default destination), so `finalize` resolves it first. Adds an export test for blobs small enough that the file store keeps them in its database. The crate-edge script's tests follow the rule it now enforces: the SDK and the crates built on it may link the blob store, the onramp may not. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…blobs # Conflicts: # crates/client/src/bundle/engine/tests.rs
…blobs # Conflicts: # crates/client/src/downloader.rs # crates/client/src/ranged_store.rs # crates/client/src/ranged_store/tests.rs
A bundle pull keeps every entry's verified bytes in one iroh-blobs store, `<out>/.decdn-partial/store`, instead of one store per entry. The store opens on first use and closes in `BundlePuller::finish`: it is removed once no partial blob in it belongs to an entry the run did not settle, and kept otherwise so the next run resumes from it. An export leaves the store's entry pointing at the exported file. When that file is gone and the blob must be fetched again, the entry is a lost export: `StaleStoreEntry` fails the entry, and the store is removed at the run's end so the next run fetches it fresh. The manifest fetch keeps its own store beside its staging file, which goes with the export. `BundlePuller::partial_downloads` lists what the store holds only part of, which the CLI's leftover-partials warning reads. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Gas snapshotNo gas changes vs base. |
The bundle store goes when every pull of the puller settled every entry, and stays for the next run otherwise. Drop the per-hash settled set, the store's partial-blob listing and BundlePuller::partial_downloads; the CLI's leftover warning counts staging files only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Steps 3 and 4 of moving the client store onto iroh-blobs (#2881). Builds on #2945 (donors splice outside the store) and #2946 (iroh-blobs 0.105).
What changes
<dest>.decdn. The store holds the verified bytes, their outboard and the present ranges, and a resumed download reads them back from it. The.partialdata file, the.partial.rangesrecord andranged_store.rs's own file I/O are gone.<out>/.decdn-partial/store. The puller opens it on first use and closes it inBundlePuller::finish: removed when every pull settled every entry (none failed, none cut short), kept for the next run otherwise. The manifest fetch keeps its own short-lived store beside its staging file, so--overwrite, which fetches the manifest every run, never leaves a record in the shared store.ExportMode::TryReference: a rename on the same file system). A single download then removes its store directory.StaleStoreEntry) and fails the entry; a bundle then removes its store at the end of the run, so the next run fetches the blob fresh. This needs a failed run plus a finished file deleted before the rerun, or an exported file that fails its hash.import_baoand only then marks it present.presentstays an in-memory read, so the streamer never asks the store for a byte it does not hold.finalizedoes the same for an entry that holds every range but reads partial. Fetching that one group records the blob complete.SourceSetso lanes continue their voucher sequence.ScratchStoresopens one store in its scratch directory on first use.Downloader::refetched_targets. Public API snapshot updated.decdn-clientlinks iroh-blobs (file store only; no aws-lc, AWS SDK or JSON-RPC server), and so do the CLI and the sponsord daemon.check_crate_edges.pyand CLAUDE.md say so.sponsord-onrampstill links none.Behaviour to note
decdn getprocesses pulling the same bundle into the same directory at once cannot share a store. That already collided on the staging files.FsStorebuilds its own multi-thread runtime with tokio's default worker count, andOptionshas no setting for it. Needs a device check on mobile.decdn-cache's ingest sits behindCacheEngineand the crate edges forbidclient → cache, so the client's decode-then-import loop (about 100 lines) duplicates the cache's in shape.Tests
ClientRangedStore::in_memory(iroh-blobsMemStoreon the test's runtime), so paused-clock tests keep working.tests/ranged_store_client.rs), conformance on both backends.cargo nextest run -p decdn-client -p decdn-cli -p decdn-bao-range --all-features: 2549 passed.anvil-e2e): everycli_bundle_pull_*journey andcli_fetch_resumepass.--all-features), fmt,cargo docwith warnings denied, public API snapshot: clean.🤖 Generated with Claude Code