pub struct BackpressureMonitor { /* private fields */ }Expand description
Backpressure monitor.
Implementations§
Source§impl BackpressureMonitor
impl BackpressureMonitor
Sourcepub fn new(config: BackpressureConfig) -> Self
pub fn new(config: BackpressureConfig) -> Self
Create a new backpressure monitor.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create with default configuration.
Sourcepub fn config(&self) -> &BackpressureConfig
pub fn config(&self) -> &BackpressureConfig
Get the configuration.
Sourcepub fn state(&self) -> BackpressureState
pub fn state(&self) -> BackpressureState
Get current state.
Sourcepub fn try_acquire(&self) -> bool
pub fn try_acquire(&self) -> bool
Try to acquire a slot for a new operation.
Returns true if the operation should proceed, false if it should be rejected.
Sourcepub fn total_processed(&self) -> u64
pub fn total_processed(&self) -> u64
Get total processed operations.
Sourcepub fn total_rejected(&self) -> u64
pub fn total_rejected(&self) -> u64
Get total rejected operations.
Sourcepub fn rejection_rate(&self) -> f64
pub fn rejection_rate(&self) -> f64
Get rejection rate.
Sourcepub fn should_apply_backpressure(&self) -> bool
pub fn should_apply_backpressure(&self) -> bool
Check if we should apply backpressure based on cooldown.
Sourcepub fn reset_stats(&self)
pub fn reset_stats(&self)
Reset statistics.
Auto Trait Implementations§
impl !Freeze for BackpressureMonitor
impl RefUnwindSafe for BackpressureMonitor
impl Send for BackpressureMonitor
impl Sync for BackpressureMonitor
impl Unpin for BackpressureMonitor
impl UnsafeUnpin 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