Skip to main content

Module offload

Module offload 

Source
Expand description

Payload-offload decorator for CacheRepository backends, with a pluggable PayloadStore.

OffloadRepository wraps any backend (the “index”) and moves entry payloads into a PayloadStore (local disk, redis, …), storing only the store-side blob 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 store-side reclaimers can reclaim dead payloads by name alone, without consulting the index.

§Failure policy

  • A payload put that fails falls back to storing the entry inline in the index (WARN + inner.set with the original entry): the decorator never converts a store failure into a cache-write Err.
  • A vanished or corrupt blob row degrades to a miss (Ok(None) + WARN).
  • A payload that exists but cannot be read (e.g. PermissionDenied) surfaces as Err per ADR-0023 Contract C1.

Structs§

OffloadRepository
CacheRepository decorator that offloads entry payloads to a PayloadStore.

Traits§

PayloadStore
Pluggable payload storage behind OffloadRepository.

Functions§

default_offload_clock
The default production clock: SystemTime::now.

Type Aliases§

OffloadClock
Injectable wall clock for death-epoch math and deterministic tests.