pub struct BackpressureMonitor { /* private fields */ }Expand description
Monitors and reports backpressure conditions.
Implementations§
Source§impl BackpressureMonitor
impl BackpressureMonitor
Sourcepub fn new(strategy: BackpressureStrategy, capacity: usize) -> Self
pub fn new(strategy: BackpressureStrategy, capacity: usize) -> Self
Creates a new backpressure monitor.
Sourcepub fn with_watermarks(self, high: f64, low: f64) -> Self
pub fn with_watermarks(self, high: f64, low: f64) -> Self
Creates a monitor with custom watermarks.
Sourcepub fn update_fill(&self, current: usize)
pub fn update_fill(&self, current: usize)
Updates the current fill level.
Sourcepub fn fill_ratio(&self) -> f64
pub fn fill_ratio(&self) -> f64
Returns the current fill ratio (0.0 to 1.0+).
Sourcepub fn should_apply_backpressure(&self) -> bool
pub fn should_apply_backpressure(&self) -> bool
Returns whether backpressure should be applied.
Sourcepub fn has_recovered(&self) -> bool
pub fn has_recovered(&self) -> bool
Returns whether the system has recovered from backpressure.
Sourcepub fn record_backpressure(&self)
pub fn record_backpressure(&self)
Records a backpressure event.
Sourcepub fn record_dropped(&self, count: u64)
pub fn record_dropped(&self, count: u64)
Records dropped items.
Sourcepub fn record_blocked_time(&self, duration: Duration)
pub fn record_blocked_time(&self, duration: Duration)
Records blocked time.
Sourcepub fn stats(&self) -> BackpressureStats
pub fn stats(&self) -> BackpressureStats
Returns backpressure statistics.
Sourcepub fn strategy(&self) -> BackpressureStrategy
pub fn strategy(&self) -> BackpressureStrategy
Returns the configured strategy.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for BackpressureMonitor
impl RefUnwindSafe for BackpressureMonitor
impl Send for BackpressureMonitor
impl Sync for BackpressureMonitor
impl Unpin for BackpressureMonitor
impl UnwindSafe for BackpressureMonitor
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