Expand description
Disk-payload offload decorator for CacheRepository backends.
DiskOffloadRepository wraps any backend (the “index”) and moves entry
payloads to content-addressed blob files under a dedicated directory,
storing only a relative file name in the index row. Index rows stay
small; the payload is re-injected on get/peek_stale.
§Blob lifecycle
Blob names are {blake3-128hex(key)}.{death_epoch_secs}.{blake3-128hex( bytes || content_type-discriminant)}.blob. The death epoch —
expires_at + stale_retention + sweep_interval — is encoded in the name
so the background sweeper can reclaim dead blobs by file name alone,
without consulting the index.
§Failure policy
- A blob write that fails falls back to storing the entry inline in the
index (WARN +
inner.setwith the original entry): the decorator never converts its own file-write failure into a cache-writeErr. - A vanished or corrupt blob row degrades to a miss (
Ok(None)+ WARN). - A blob that exists but cannot be read (e.g.
PermissionDenied) surfaces asErrper ADR-0023 Contract C1.
Structs§
- Disk
Offload Repository CacheRepositorydecorator that offloads entry payloads to disk.
Functions§
- default_
offload_ clock - The default production clock:
SystemTime::now.
Type Aliases§
- Offload
Clock - Injectable wall clock for death-epoch math and deterministic tests.