struct EvictionStats {
interval: Duration,
warn_threshold: u64,
state: Mutex<IntervalState>,
}Expand description
Eviction counts per cache and cause, reported once per interval (GNO-793: per-entry lines flooded the log).
Fields§
§interval: Duration§warn_threshold: u64§state: Mutex<IntervalState>Implementations§
Source§impl EvictionStats
impl EvictionStats
fn new(cfg: &SurbStoreConfig) -> Self
fn record(&self, cache: EvictedCache, cause: RemovalCause)
Sourcefn record_many(&self, cache: EvictedCache, cause: RemovalCause, n: u64)
fn record_many(&self, cache: EvictedCache, cause: RemovalCause, n: u64)
Counts n evictions at once, for a caller that learns of many together (one push dropping several
SURBs) and should not take the lock once per entry.
Sourcefn record_many_at(
&self,
cache: EvictedCache,
cause: RemovalCause,
n: u64,
now: Instant,
) -> Option<EvictionReport>
fn record_many_at( &self, cache: EvictedCache, cause: RemovalCause, n: u64, now: Instant, ) -> Option<EvictionReport>
Closes the interval if now is past it, then counts n evictions; returns the closed interval’s counts.
A count of zero is not an eviction: it returns at once, without taking the lock or closing the interval. That keeps the common case of a push that evicts nothing off the lock.
Sourcefn close_interval_if_elapsed(
&self,
state: &mut IntervalState,
now: Instant,
) -> Option<EvictionReport>
fn close_interval_if_elapsed( &self, state: &mut IntervalState, now: Instant, ) -> Option<EvictionReport>
No runtime here, so the first eviction past the interval closes it: a quiet store reports late, not never.
Auto Trait Implementations§
impl !Freeze for EvictionStats
impl !RefUnwindSafe for EvictionStats
impl Send for EvictionStats
impl Sync for EvictionStats
impl Unpin for EvictionStats
impl UnsafeUnpin for EvictionStats
impl UnwindSafe for EvictionStats
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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