pub struct KvBlockTable {
pub seq_len: u32,
/* private fields */
}Expand description
Per-sequence map of logical-token-position → physical page.
Token t lives at pages[t / tokens_per_page] slot
t % tokens_per_page.
Fields§
§seq_len: u32Number of tokens this sequence currently has cached.
Implementations§
Source§impl KvBlockTable
impl KvBlockTable
pub fn new() -> Self
Sourcepub fn push_page(&mut self, page: KvPageId)
pub fn push_page(&mut self, page: KvPageId)
Append a new page from the pool. Used when seq_len mod tokens_per_page == 0 (boundary).
Sourcepub fn page_for_token(&self, t: u32, tokens_per_page: u16) -> Option<KvPageId>
pub fn page_for_token(&self, t: u32, tokens_per_page: u16) -> Option<KvPageId>
Look up which page holds token t. Returns None if t
is past the cached region.
pub fn page_count(&self) -> usize
Sourcepub fn release(&mut self, pool: &mut KvPagePool)
pub fn release(&mut self, pool: &mut KvPagePool)
Free every page back to the pool. Called when a sequence finishes / is evicted.
Trait Implementations§
Source§impl Clone for KvBlockTable
impl Clone for KvBlockTable
Source§fn clone(&self) -> KvBlockTable
fn clone(&self) -> KvBlockTable
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KvBlockTable
impl Debug for KvBlockTable
Source§impl Default for KvBlockTable
impl Default for KvBlockTable
Source§fn default() -> KvBlockTable
fn default() -> KvBlockTable
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for KvBlockTable
impl RefUnwindSafe for KvBlockTable
impl Send for KvBlockTable
impl Sync for KvBlockTable
impl Unpin for KvBlockTable
impl UnsafeUnpin for KvBlockTable
impl UnwindSafe for KvBlockTable
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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