pub struct PagedKvCache { /* private fields */ }Expand description
One sequence’s view into a shared PagedKvStore: a block table
(which physical blocks this sequence’s positions live in, in order)
plus how many positions have been written so far. Unlike KvCache,
this holds no K/V data itself – every read and write goes through
the shared store.
Implementations§
Source§impl PagedKvCache
impl PagedKvCache
pub fn new() -> Self
pub fn seq_len(&self) -> usize
pub fn block_table(&self) -> &[usize]
Sourcepub fn push(
&mut self,
store: &mut PagedKvStore,
k_step: &[f32],
v_step: &[f32],
) -> Result<(), PagedStoreExhausted>
pub fn push( &mut self, store: &mut PagedKvStore, k_step: &[f32], v_step: &[f32], ) -> Result<(), PagedStoreExhausted>
Appends one position’s key/value vectors, acquiring a new block
from store first if the current tail block is full (or none
held yet). Mirrors KvCache::push’s signature/semantics exactly,
just against shared storage instead of a private buffer.
Sourcepub fn release(&mut self, store: &mut PagedKvStore)
pub fn release(&mut self, store: &mut PagedKvStore)
Releases every block this sequence holds back to store. Must be
called explicitly (there’s no Drop here, since dropping needs a
&mut PagedKvStore this type doesn’t own a reference to) –
mirrors KvCache::release_to_pool, just not automatic.
Trait Implementations§
Source§impl Clone for PagedKvCache
impl Clone for PagedKvCache
Source§fn clone(&self) -> PagedKvCache
fn clone(&self) -> PagedKvCache
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PagedKvCache
impl Debug for PagedKvCache
Source§impl Default for PagedKvCache
impl Default for PagedKvCache
Source§fn default() -> PagedKvCache
fn default() -> PagedKvCache
Auto Trait Implementations§
impl Freeze for PagedKvCache
impl RefUnwindSafe for PagedKvCache
impl Send for PagedKvCache
impl Sync for PagedKvCache
impl Unpin for PagedKvCache
impl UnsafeUnpin for PagedKvCache
impl UnwindSafe for PagedKvCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more