Module tier

Module tier 

Source
Expand description

2026-09-25: The generic tiered cache: a bounded hot arena over a cold record store, written without CUDA or verbs calls.

  • SlotArena: the hot tier, num_slots fixed-size byte slots (VecSlotArena in host RAM, the cache peer’s MmapSlotArena).
  • SwapStore: the cold tier, fixed-size records (DirectSwapFile on disk, MemSwapStore in host RAM).
  • Residency: the page table over both, from a u64 key to one blob: an LRU of resident slots above an LRU of on-disk records, and read-pins. A put into a full arena spills the coldest unpinned resident to the store; with a disk cap, the coldest on-disk record is dropped and a later get of its key misses.

Owner: storage (tier). Invariants: none beyond the types.

Modules§

entropy
2026-09-25: OS entropy for per-process key salts; its caller is the SSM decode tier’s client salt (decode_client_salt in metrale-model-engine).
hash
2026-09-25: Hash primitives for cache keys that outlive the process: FNV-1a/64 and the mix64 fold.
pio
2026-09-25: Positional file reads and writes at an explicit offset: FileExt::read_at/write_at on unix, seek_read/seek_write on Windows. Bounds checks and record layout stay with the callers (backend/posix.rs, expert_pack_fs.rs, expert_tier.rs, ngram_cache_fault.rs).

Structs§

DirectSwapFile
2026-09-25: Fixed-stride swap file: record disk_slot at disk_slot * record_bytes, with record_bytes a non-zero 4 KiB multiple.
MemSwapStore
2026-09-25: SwapStore over a HashMap of heap records, with no bound of its own. Model-engine’s unified SSM store falls back to it when no swap file can be used.
Residency
2026-09-25: The page table from a u64 key to a SlotArena slot or a SwapStore record, evicting the least recently used resident to the store when the arena is full.
SwapStats
VecSlotArena
2026-09-25: SlotArena over one Vec<u8> of slot_bytes * num_slots bytes, allocated and zeroed in new. The hot tier of model-engine’s host-RAM unified SSM stores.

Traits§

SlotArena
2026-09-25: The hot tier: num_slots slots of slot_bytes each. Implemented by VecSlotArena (host RAM), the cache peer’s MmapSlotArena and model-engine’s TransportSlotArena.
SwapStore
2026-09-25: The cold tier: records of record_bytes each, addressed by a disk_slot index that Residency allocates and reuses. Implemented by DirectSwapFile (a file) and MemSwapStore (host RAM).