pub struct ExpertStore<S: ExpertSource> { /* private fields */ }Expand description
The bounded cache. See the module docs for the design contract.
Implementations§
Source§impl<S: ExpertSource> ExpertStore<S>
impl<S: ExpertSource> ExpertStore<S>
pub fn new(source: S, budget_bytes: usize) -> Self
pub fn budget_bytes(&self) -> usize
pub fn stats(&self) -> ExpertStoreStats
Sourcepub fn prefetch(&self, keys: &[ExpertKey])
pub fn prefetch(&self, keys: &[ExpertKey])
Best-effort warm of keys into the cache (ds4-style SSD
streaming prefetch): acquires each key and drops the lease so
the entry stays resident under the budget until eviction.
Concurrent acquires on the same key may duplicate I/O; never
returns wrong bytes. Failures on individual keys are skipped.
Sourcepub fn acquire(&self, key: ExpertKey) -> Result<ExpertLease>
pub fn acquire(&self, key: ExpertKey) -> Result<ExpertLease>
Returns a pinned lease on key’s bytes, reading them from the
source on a miss. Never blocks waiting for other leases to be
released: if the entry cannot fit in the budget right now, the
bytes are returned uncached (see module docs).
Auto Trait Implementations§
impl<S> !Freeze for ExpertStore<S>
impl<S> RefUnwindSafe for ExpertStore<S>where
S: RefUnwindSafe,
impl<S> Send for ExpertStore<S>
impl<S> Sync for ExpertStore<S>
impl<S> Unpin for ExpertStore<S>where
S: Unpin,
impl<S> UnsafeUnpin for ExpertStore<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for ExpertStore<S>where
S: UnwindSafe,
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> 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