pub struct ScratchPool { /* private fields */ }Implementations§
Source§impl ScratchPool
impl ScratchPool
pub fn new(dims: ScratchDims) -> Result<Self>
pub fn dims(&self) -> ScratchDims
pub fn pool_dev_ptr(&self) -> u64
pub fn slot_dev_ptr(&self, slot: u32) -> u64
Sourcepub fn slot_k_ptr(&self, slot: u32, kv_head: u16) -> u64
pub fn slot_k_ptr(&self, slot: u32, kv_head: u16) -> u64
K stripe device pointer for (slot, kv_head).
Sourcepub fn slot_v_ptr(&self, slot: u32, kv_head: u16) -> u64
pub fn slot_v_ptr(&self, slot: u32, kv_head: u16) -> u64
V stripe device pointer for (slot, kv_head).
pub fn lookup(&self, key: ResidentKey) -> Option<u32>
Sourcepub fn invalidate(&mut self, key: ResidentKey)
pub fn invalidate(&mut self, key: ResidentKey)
Drop the resident slot for key (if any). Returns the slot to the
free list so the next assign(key, _) triggers a fresh disk read.
Used by the offload path to discard the cached copy of a block after its on-disk image has been overwritten — without this, streaming attention would keep serving the stale resident copy and never see the freshly-offloaded K/V (e.g., decode steps re-writing the active block every step).
pub fn capacity(&self) -> u32
pub fn free_count(&self) -> u32
Sourcepub fn assign(
&mut self,
key: ResidentKey,
evict_candidates: &[u32],
) -> Result<u32>
pub fn assign( &mut self, key: ResidentKey, evict_candidates: &[u32], ) -> Result<u32>
Reserve a slot for key. If the pool is full, picks an evictable slot
from evict_candidates (callers pass them in score-ascending order;
the lowest-scoring one is kicked first). Returns the slot index. The
caller is responsible for issuing the disk read into slot_dev_ptr.
Sourcepub fn residents(&self) -> Vec<(u32, ResidentKey)>
pub fn residents(&self) -> Vec<(u32, ResidentKey)>
Return all currently-resident slot indices in arbitrary order (for the eviction policy to score against the predictor).