pub struct PrefixCache {
pub entries: Vec<CacheEntry>,
pub changed: bool,
}Fields§
§entries: Vec<CacheEntry>§changed: boolAn entry came in or was used since the cache last settled, so an export may have come to be covered.
Implementations§
Source§impl PrefixCache
impl PrefixCache
pub fn insert( &mut self, seq: Seq, tokens: Vec<u32>, prompt: u64, bytes: u64, now: u64, )
pub fn get(&self, seq: Seq) -> Option<&CacheEntry>
Sourcepub fn remove(&mut self, seq: Seq) -> Option<CacheEntry>
pub fn remove(&mut self, seq: Seq) -> Option<CacheEntry>
Take the entry out of the cache.
Sourcepub fn exported_tokens(&self) -> u64
pub fn exported_tokens(&self) -> u64
Tokens of state held out of the pool.
Sourcepub fn exported_bytes(&self) -> u64
pub fn exported_bytes(&self) -> u64
Host bytes the exports hold.
pub fn best_prefix( &self, span: &[u32], page: u64, exact_only: bool, ) -> Option<(usize, u64)>
pub fn candidates( &self, span: &[u32], page: u64, exact_only: bool, ) -> Vec<(u64, Seq)>
Sourcepub fn unpinned_bytes(&self) -> u64
pub fn unpinned_bytes(&self) -> u64
Pool bytes an eviction could free: the entries in the pool no lease pins.
Sourcepub fn resident_bytes(&self) -> u64
pub fn resident_bytes(&self) -> u64
Pool bytes the cache accounts for.
pub fn plan_evict( &self, target: u64, cap: u64, shared_too: bool, ) -> (u64, Vec<usize>)
pub fn plan_evict_until( &self, cap: u64, enough: impl FnMut(&[usize]) -> bool, ) -> (Vec<usize>, bool)
pub fn bytes_of(&self, indices: &[usize]) -> u64
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PrefixCache
impl RefUnwindSafe for PrefixCache
impl Send for PrefixCache
impl Sync for PrefixCache
impl Unpin for PrefixCache
impl UnsafeUnpin for PrefixCache
impl UnwindSafe for PrefixCache
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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