Skip to main content

Module disk_offload

Module disk_offload 

Source
Expand description

Disk payload store for the crate::cache::offload::OffloadRepository decorator.

DiskPayloadStore holds content-addressed payload blob files under a dedicated directory, addressed by the blob names the decorator computes. A background sweeper reclaims dead blobs by their name-encoded death epoch and stale .tmp leftovers by age, exiting when the context-owned shutdown token fires.

§Blob lifecycle

Blob names are {blake3-128hex(key)}.{death_epoch_secs}.{blake3-128hex( bytes || content_type-discriminant)}.blob. The death epoch is encoded in the name so the sweeper can reclaim dead blobs by file name alone, without consulting the index.

§Failure policy

  • Writes are tmp-then-rename so a partially written blob is never visible under its final name; write failures surface to the decorator, whose inline fallback applies.
  • A vanished blob reads as Ok(None); a blob that exists but cannot be read (e.g. PermissionDenied) surfaces as Err per ADR-0023 Contract C1.
  • unlink counts an already-absent blob as success; clear never fails — per-blob unlink failures WARN and the scan continues.

Structs§

DiskPayloadStore
PayloadStore that keeps offloaded payload blobs as files under dir, with a background death-epoch sweeper.