Repository navigation
refactor(client): let the Streamer fill a store the caller opens - #2887
Merged
Merged
Conversation
StreamStore is an IngestStore that also wakes the reader on each checkpoint; StreamStores opens one per stream. Streamer::with_stores takes the opener, and the reader and drive carry the store type. Every new type parameter defaults to the scratch-directory ClientRangedStore, so Streamer::new and its callers are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟡 Changes recommended
The change still has an unresolved documentation inconsistency in crates/client/src/streamer.rs around whether multiple streams may share the same store instance, leaving the StreamStores contract unclear for implementers and callers.
1 open issue
What changed in this PR
Refactors decdn-client’s streaming path so Streamer fills a caller-opened store (instead of always creating a scratch-backed store), enabling downstream components like the gateway cache to stream directly into a cache-backed store.
Changes:
- Introduces doc-hidden
StreamStore/StreamStoresabstractions and a defaultScratchStoresopener that preserves prior behavior. - Makes
Streamer,StreamDrive,LiveReader, andVerifiedReadergeneric over the store type while keeping existing callers source-compatible via defaults. - Adds a test for
with_storesand regenerates thepublic_apisnapshot to reflect the new generic parameters and exports.
| File | Description |
|---|---|
| crates/client/tests/snapshots/public_api__public_api.snap | Regenerates the public API snapshot to reflect the new store-generic streamer types and re-exports. |
| crates/client/src/streamer/tests.rs | Adds a regression test ensuring Streamer::with_stores streams into a caller-provided store and only opens it once. |
| crates/client/src/streamer.rs | Introduces store/opener traits and threads a caller-opened fill store through the streaming pipeline with a scratch-backed default implementation. |
| crates/client/src/lib.rs | Updates the crate root exports to expose the new store-related types alongside the streamer API. |
Review effort: Balanced
Code coverage overviewLanguages: Rust Rust / code-coverage/cargo-llvm-cov
View coverage of the 3 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
alpergundogdu
added a commit
that referenced
this pull request
Nov 12, 2026
Resolve the Streamer store refactor (#2887) against the proven-size acquire: the stream store opens at the proven size with no cap clamp, and the streamer tests keep the caller-supplied store test. Seed e2e origins with their .sizeproof sibling. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

Third step of moving the
decdn gatewaycache ontodecdn-cache(#2881). The gateway will stream into a cache-backed store instead of a scratch.partial. To allow that, theStreamernow fills whatever store the caller opens.What changes
StreamStore(doc-hidden): anIngestStorethat also exposespresent_grew(), the wakeup the reader waits on between checkpoints.ClientRangedStoreimplements it.StreamStores(doc-hidden): opens the fill store for one stream from(hash, total_bytes). It is also implemented for&T, so one opener can serve many streams.ScratchStores: the default opener. It does exactly whatStreamerdid before: aClientRangedStorenamed by the hash in the scratch directory, opened off the runtime.Streamer<'a, P, F, O = ScratchStores<'a>>gainswith_stores(provider, funder, stores).VerifiedReader<S>,LiveReader<S>andStreamDrive<'a, S>gain a store parameter. Every new parameter defaults to the current type, soStreamer::newand every existing caller compile unchanged.crates/clineeds no edits.public_apisnapshot is regenerated. The new generic parameters show up there, and existing source keeps compiling.Tests
a_stream_fills_the_store_its_stores_open: it streams a 1.5 MB blob throughwith_storeswith a different store type that wrapsClientRangedStore. It checks that the output is byte-identical and that the opener ran once.cargo nextest run -p decdn-client -p decdn-cli: pass.INSTA_UPDATE=always cargo nextest run -p decdn-client --features public-api-test: snapshot regenerated, and it passes.cargo clippy --workspace --all-targets --all-featureswith warnings denied,cargo doc --workspace --no-deps --document-private-items,check_crate_edges.py,cargo fmt --check: pass.🤖 Generated with Claude Code