pub enum BackpressureLevel {
Normal = 0,
Warn = 1,
Throttle = 2,
Critical = 3,
Emergency = 4,
Shutdown = 5,
}Expand description
Backpressure level based on memory/queue pressure.
Six-tier cascade for graceful degradation:
- Normal (< 70%): Accept all operations
- Warn (70-80%): Evict aggressively, emit warnings
- Throttle (80-90%): Rate limit writes (HTTP 429)
- Critical (90-95%): Reject writes, reads only (HTTP 503)
- Emergency (95-98%): Read-only mode, prepare shutdown
- Shutdown (> 98%): Graceful shutdown initiated
Variants§
Implementations§
Source§impl BackpressureLevel
impl BackpressureLevel
Sourcepub fn from_pressure(pressure: f64) -> Self
pub fn from_pressure(pressure: f64) -> Self
Calculate backpressure level from pressure ratio (0.0 → 1.0)
Sourcepub fn should_accept_writes(&self) -> bool
pub fn should_accept_writes(&self) -> bool
Check if writes should be accepted at this level
Sourcepub fn should_accept_reads(&self) -> bool
pub fn should_accept_reads(&self) -> bool
Check if reads should be accepted at this level
Sourcepub fn eviction_multiplier(&self) -> f64
pub fn eviction_multiplier(&self) -> f64
Get eviction multiplier (higher pressure = more aggressive)
Sourcepub fn http_status_code(&self) -> Option<u16>
pub fn http_status_code(&self) -> Option<u16>
Suggested HTTP status code for this level
Sourcepub fn retry_after_secs(&self) -> Option<u64>
pub fn retry_after_secs(&self) -> Option<u64>
Suggested Retry-After header value (seconds)
pub fn description(&self) -> &'static str
Trait Implementations§
Source§impl Clone for BackpressureLevel
impl Clone for BackpressureLevel
Source§fn clone(&self) -> BackpressureLevel
fn clone(&self) -> BackpressureLevel
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BackpressureLevel
impl Debug for BackpressureLevel
Source§impl Display for BackpressureLevel
impl Display for BackpressureLevel
Source§impl Ord for BackpressureLevel
impl Ord for BackpressureLevel
Source§fn cmp(&self, other: &BackpressureLevel) -> Ordering
fn cmp(&self, other: &BackpressureLevel) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for BackpressureLevel
impl PartialEq for BackpressureLevel
Source§impl PartialOrd for BackpressureLevel
impl PartialOrd for BackpressureLevel
impl Copy for BackpressureLevel
impl Eq for BackpressureLevel
impl StructuralPartialEq for BackpressureLevel
Auto Trait Implementations§
impl Freeze for BackpressureLevel
impl RefUnwindSafe for BackpressureLevel
impl Send for BackpressureLevel
impl Sync for BackpressureLevel
impl Unpin for BackpressureLevel
impl UnwindSafe for BackpressureLevel
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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