Repository navigation
Description
Problem
The cache engine exposes ingest as several source-flavored entrypoints — populate, populate_local, pull_through_range, open_tee_sink, open_local_outboard_pull — plus separate read paths (get, export_bao_range_stream). Each ingest path re-implements the same store bookkeeping, and they disagree on one thing that matters: what happens to bytes already fetched when an ingest aborts.
On abort/retry the engine drops the iroh-blobs TempTag, so a partially fetched blob's bytes become GC-eligible and are reclaimed — worst case (1 + max_retries) × blob_bytes of "orphaned" bytes until the next sweep (#518). Those bytes were verified and, on a peer pull, paid for; discarding them makes a resume re-fetch and re-pay from a lower offset than necessary.
None of this is a store limitation. iroh-blobs already models partials as first-class: verified spans import as partial blobs, the store tracks exactly which chunk ranges are present, serves them via export_ranges (ADR 038), and reports a partial's on-disk size honestly. The duplication and the orphaning are policy artifacts of wiring ingest up per-source.
Intent
One source-agnostic, range-aware cache API that every producer writes through and every reader reads through:
- admit(hash, range) — positioned, not append: a range lands at its true byte offset (sparse on disk — the last 1 GB of a 100 GB blob costs ~1 GB, not a 99 GB zero-fill). Present-ranges are a set, so disjoint interior spans are first-class.
- read(hash, range) — completeness-aware: serve what is present, report what is missing, rather than assuming whole-blob presence.
- hold — an explicit lease (
TempTag) that protects a reader's / warmer's bytes from reclaim while it streams. - evict — one logical + lease-protected + deferred-reclaim path, reused for both takedown and capacity eviction. A blob evicted mid-serve keeps serving to in-flight readers; only new requests see it gone.
No orphan class. Aborted ingests are retained as resumable partials, attributed to (hash, range) and reclaimed only via eviction on the same accounting — never dropped to GC. Disk usage becomes the sum of present ranges, complete and partial alike.
Why it matters
This is the foundation that lets any fetch source share one ingest path and lets a node hold blobs far larger than RAM without re-implementing store logic per source. It is a store-layer refactor: behavior-preserving, migratable entrypoint-by-entrypoint to keep the tree green.
Out of scope
- No source-seam changes, no payment/wire changes — that is the follow-up (unify miss sources behind
BlobSource; removemax_blob_size_mb), which depends on this. - No admission-policy change and no
max_blob_size_mbremoval here. - No change to what a partial advertises (a partial warming copy stays unadvertised).
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
alpergundogdu commentedon Aug 5, 2026
Foundation for #1608 (unify miss sources behind
BlobSource; removemax_blob_size_mb), which writes every source through this API.alpergundogdu commentedon Aug 5, 2026
Context: this is the node
RangedStorebackend in the unified range-minimized fetch design (#1621). Its P1 query oracle —present_ranges/missing_ranges— shipped in #1609. The remaining work here (retained partials + unifiedadmit) is what makes the node's held partials durable (not GC-reclaimed) and gap-serveable, so the gap-driven pull driver (A, #1621) can actually skip them. The trait itself lands inbao-range; this issue is its node-side impl over iroh-blobs.docs+test(cache): fix pull_through_range tag doc + poll GC test (#1607 …
feat(cache): retain range-admitted partials across GC (#1607) (#1641)
alpergundogdu commentedon Aug 13, 2026
Complete. The node-side range-aware cache API is on main:
NodeRangedStore: RangedStorewith positionedadmit(range)—crates/cache/src/ranged_store.rs:58.crates/cache/tests/pull_through.rs), so aborted ingests are resumable partials, not orphaned GC bytes.evict(engine.rs:1556) reused for takedown and capacity.Every miss source (BackendSource, PeerSource) writes through this
admitpath. Closing as done.