Skip to main content

MemoryTier

Struct MemoryTier 

Source
pub struct MemoryTier { /* private fields */ }
Expand description

The in-memory tier.

Implementations§

Source§

impl MemoryTier

Source

pub fn new(capacity: u64) -> Self

A tier holding at most capacity bytes (0 turns it off).

Source

pub fn lookup(&self, key: &QueryKey) -> Option<(Arc<Value>, State)>

The slot for key, marking it most recently used.

Source

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.

Source

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.

Source

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.

Source

pub fn remove_if(&self, key: &QueryKey, value: &Arc<Value>)

Drops key’s slot if it still holds value.

Source

pub fn remove(&self, key: &QueryKey)

Drops key’s slot.

Source

pub fn stats(&self) -> MemoryStats

The tier’s counters.

Trait Implementations§

Source§

impl Debug for MemoryTier

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.