ScratchPool

Struct ScratchPool 

Source
pub struct ScratchPool { /* private fields */ }

Implementations§

Source§

impl ScratchPool

Source

pub fn new(dims: ScratchDims) -> Result<Self>

Source

pub fn dims(&self) -> ScratchDims

Source

pub fn pool_dev_ptr(&self) -> u64

Source

pub fn slot_dev_ptr(&self, slot: u32) -> u64

Source

pub fn slot_k_ptr(&self, slot: u32, kv_head: u16) -> u64

K stripe device pointer for (slot, kv_head).

Source

pub fn slot_v_ptr(&self, slot: u32, kv_head: u16) -> u64

V stripe device pointer for (slot, kv_head).

Source

pub fn lookup(&self, key: ResidentKey) -> Option<u32>

Source

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).

Source

pub fn capacity(&self) -> u32

Source

pub fn free_count(&self) -> u32

Source

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.

Source

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).

Source

pub fn clear(&mut self)

Free all slots; use between decode steps that don’t share residency.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more