pub struct MemoryTier { /* private fields */ }Expand description
The in-memory tier.
Implementations§
Source§impl MemoryTier
impl MemoryTier
Sourcepub fn lookup(&self, key: &QueryKey) -> Option<(Arc<Value>, State)>
pub fn lookup(&self, key: &QueryKey) -> Option<(Arc<Value>, State)>
The slot for key, marking it most recently used.
Sourcepub fn insert_on_disk(
&self,
key: &QueryKey,
value: Arc<Value>,
stamp: FileStamp,
)
pub fn insert_on_disk( &self, key: &QueryKey, value: Arc<Value>, stamp: FileStamp, )
Holds value, read from or written to the entry file with stamp,
replacing any slot for key.
Sourcepub fn insert_pending(&self, key: &QueryKey, value: Arc<Value>) -> bool
pub fn insert_pending(&self, key: &QueryKey, value: Arc<Value>) -> bool
Holds value as pending, unless key already has a slot or the
value is too large. Returns whether it was inserted.
Sourcepub fn settle(
&self,
key: &QueryKey,
value: &Arc<Value>,
stamp: Option<FileStamp>,
)
pub fn settle( &self, key: &QueryKey, value: &Arc<Value>, stamp: Option<FileStamp>, )
Records the end of value’s disk write: with Some(stamp) the slot
becomes on-disk with that stamp; with None (the write failed, or
another entry was already there) it is dropped. Only a pending slot
still holding this very value is affected.
Sourcepub fn remove_if(&self, key: &QueryKey, value: &Arc<Value>)
pub fn remove_if(&self, key: &QueryKey, value: &Arc<Value>)
Drops key’s slot if it still holds value.
Sourcepub fn stats(&self) -> MemoryStats
pub fn stats(&self) -> MemoryStats
The tier’s counters.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for MemoryTier
impl Forget for MemoryTier
impl Move for MemoryTier
impl RefUnwindSafe for MemoryTier
impl Send for MemoryTier
impl Sync for MemoryTier
impl Unpin for MemoryTier
impl UnsafeUnpin for MemoryTier
impl UnwindSafe for MemoryTier
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