pub struct FoyerBackend { /* private fields */ }Implementations§
Source§impl FoyerBackend
impl FoyerBackend
pub async fn new( dir: &str, ram_bytes: usize, disk_bytes: usize, ) -> Result<FoyerBackend, Error>
pub async fn new_with_shards( dir: &str, ram_bytes: usize, disk_bytes: usize, shards: usize, tuning: WriteTuning, prefix_labels: Arc<[&'static str]>, ) -> Result<FoyerBackend, Error>
Sourcepub fn mark_shutting_down(&self)
pub fn mark_shutting_down(&self)
Marks this backend as shutting down, so RamEvictionListener::on_leave
skips emitting object_cache_ram_tier_eviction_count/_age_ms for the
entries close()’s full-tier flush is about to evict. Call
immediately before close() – the only place this is needed, since a
flush that never runs (the overall shutdown deadline elapses first)
emits nothing to suppress.
pub async fn close(&self) -> Result<(), Error>
Sourcepub fn ram_usage(&self) -> usize
pub fn ram_usage(&self) -> usize
Current RAM-tier byte usage. Exposed so integration tests (which
compile as a separate crate and cannot reach the private cache
field) can assert prefetch fills do not grow RAM-tier residency.
Sourcepub fn ram_entry_count(&self) -> usize
pub fn ram_entry_count(&self) -> usize
Current RAM-tier entry count. Backs the trait’s ram_entries()
method, which feeds the saturation gauge.
Trait Implementations§
Source§impl RangeCacheBackend for FoyerBackend
impl RangeCacheBackend for FoyerBackend
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
expected_len: u64,
) -> Pin<Box<dyn Future<Output = Option<Bytes>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
FoyerBackend: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
expected_len: u64,
) -> Pin<Box<dyn Future<Output = Option<Bytes>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
FoyerBackend: 'async_trait,
expected_len is the exact length the caller will accept for key.
A backend MUST NOT copy a value whose length differs into any faster
tier it maintains (the promotion gate) and MUST treat such a value as
a miss. Single-tier backends accept and ignore the parameter.fn put<'life0, 'async_trait>(
&'life0 self,
key: String,
value: Bytes,
hint: FillHint,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
FoyerBackend: 'async_trait,
Source§fn disk_stats(&self) -> Option<BackendDiskStats>
fn disk_stats(&self) -> Option<BackendDiskStats>
Disk write-path counters, for the saturation monitor’s per-second
gauges. Defaulted to
None so backends without a disk tier (e.g.
MemoryBackend) need no override.Source§fn ram_usage_bytes(&self) -> Option<usize>
fn ram_usage_bytes(&self) -> Option<usize>
Accounted RAM-tier byte usage, for the saturation monitor’s residency
gauge.
None for backends with no RAM tier accounting (e.g.
MemoryBackend). Divergence between this and process RSS is the
signature of a cached value pinning more than its accounted weight.Source§fn ram_entries(&self) -> Option<usize>
fn ram_entries(&self) -> Option<usize>
Accounted RAM-tier entry count, the entry-count sibling to
ram_usage_bytes. None for backends with no RAM tier accounting
(e.g. MemoryBackend).Auto Trait Implementations§
impl Freeze for FoyerBackend
impl !RefUnwindSafe for FoyerBackend
impl Send for FoyerBackend
impl Sync for FoyerBackend
impl Unpin for FoyerBackend
impl UnsafeUnpin for FoyerBackend
impl !UnwindSafe for FoyerBackend
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<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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].