Skip to main content

PlannerStats

Struct PlannerStats 

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

The store’s planner-statistics cache.

Implementations§

Source§

impl PlannerStats

Source

pub fn new( resources: &StorageResources, parent: Option<&ByteBudget>, clock: Clock, ) -> Result<Self, StorageError>

Build from the store’s resources. parent is the logical cache budget; without one the cache gets its own budget.

§Errors

Returns StorageError::InvalidConfiguration if the budget cannot be created.

Source

pub fn get(&self, key: &PlannerStatsKey, ci: u64) -> Option<PlannerStatsEntry>

The cached entry for key, unless missing or older than max_age_commits relative to ci. A hit refreshes the idle clock.

Source

pub fn insert(&self, key: PlannerStatsKey, entry: PlannerStatsEntry) -> bool

Cache entry for key, evicting least-recently-used entries if the budget needs room. Returns whether it is resident.

Source

pub fn evict_idle(&self) -> usize

Drop every entry unused for longer than the idle TTL. Returns how many were dropped.

Source

pub fn stats(&self) -> CacheStats

Occupancy and counters (zero when caching is disabled).

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.