Skip to content

refactor: one cache store, with the pull-side store contract in bao-range - #2907

Closed
alpergundogdu wants to merge 1 commit into
gateway-cache-past-gatesfrom
pull-traits-in-bao-range
Closed

alpergundogdu wants to merge 1 commit into
gateway-cache-past-gatesfrom
pull-traits-in-bao-range

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Stacked on #2906, which is stacked on #2905; it rebases to main as they merge. One store over CacheEngine replaces two copies: the node's NodeAdmitStore and the gateway's CacheStore.

They were written twice because neither crate could own them. Their trait lived in decdn-client, and decdn-cache and decdn-client must not depend on each other (#578). The contract now lives beside RangedStore in decdn-bao-range, which both already depend on, so decdn-cache implements it once.

What changes

  • decdn-bao-range::ingest holds the pull-side store contract: IngestStore, StreamStore, BaoRangeReader, StashedFault, IngestEnd, IngestFuture, SourceFuture and HashMismatch. ProvenSize moves to size_proof. ProvenSize::verify is its only constructor, so a size still comes only from a proof that verified. decdn-bao-range gains anyhow, iroh-io and tokio. None of them is the blob store, and the client SDK already links all three.

  • decdn-client re-exports every moved name at its old path, so callers compile unchanged. Its test-util feature turns on decdn-bao-range/test-util, where ProvenSize::assume_for_tests and the in-memory StashedFault for Bytes now live. The public_api snapshot changes only in paths.

  • decdn_cache::CacheStore is the one store. It admits through admit_bao_stream_until (progress, early stop, a wake-up for the reader), with two optional parts:

    • with_session: captures proof nodes for a serving leg, which the node uses;
    • on_admitted: the node's decdn_bytes_received_total count.
  • The node builds CacheStore where it built NodeAdmitStore. One behavior changes: a lowered end now stops a leg instead of failing as a local fault. The node's pull never lowers one.

  • The gateway keeps only its CacheStores opener, which implements StreamStores from the client.

  • Tests: the store's tests live in decdn-cache:

    • a drained leg, with its progress reports and the reader wake-up;
    • a stop at a group boundary;
    • an interior range, and the bytes-admitted count;
    • a fault parked after the last byte, which wins over a clean admit;
    • corrupt bytes, which give HashMismatch;
    • proof-node capture.

    The node keeps its two fault-verdict tests, now in node_origin/store_fault_tests.rs. The CLI keeps the Streamer round-trip test.

  • decdn get and the SDK keep ClientRangedStore. Moving the client onto the cache is still blocked on client: re-evaluate running decdn-client on the iroh-blobs store (0.104.1) #2881's open items.

Tests

  • cargo nextest run over decdn-bao-range, decdn-client, decdn-cache, decdn-node, decdn-cli, decdn-common and sponsord-core.
  • The anvil-e2e gateway journeys, plus node_origin_pull and client_loopback.
  • cargo clippy --workspace --all-targets --all-features with warnings denied, -p decdn-cache --no-default-features, cargo doc, check_crate_edges.py, cargo fmt --check.
  • public_api snapshot regenerated.

🤖 Generated with Claude Code

…ange

IngestStore, StreamStore, BaoRangeReader, StashedFault, IngestEnd,
IngestFuture, SourceFuture, HashMismatch and ProvenSize move from
decdn-client to decdn-bao-range, beside RangedStore. decdn-client
re-exports each at its old path. decdn_cache::CacheStore implements
the contract once and replaces the node's NodeAdmitStore and the
gateway's own store; the gateway keeps only its StreamStores opener.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alpergundogdu

Copy link
Copy Markdown
Contributor Author

Combined into #2908, which carries this PR's commits together with the rest of the stack so they land as one.

@alpergundogdu
alpergundogdu deleted the pull-traits-in-bao-range branch November 18, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant