pub struct BackpressureController {
pub high_watermark: usize,
pub low_watermark: usize,
pub current_depth: usize,
pub throttle_events: u64,
/* private fields */
}Expand description
Tracks backpressure between producers and consumers.
Fields§
§high_watermark: usizeMaximum queue depth before producer is throttled.
low_watermark: usizeQueue depth at which throttling is released.
current_depth: usizeCurrent queue depth.
throttle_events: u64Total times throttling was applied.
Implementations§
Source§impl BackpressureController
impl BackpressureController
Sourcepub fn new(high_watermark: usize, low_watermark: usize) -> Self
pub fn new(high_watermark: usize, low_watermark: usize) -> Self
Create a backpressure controller.
Sourcepub fn is_throttled(&self) -> bool
pub fn is_throttled(&self) -> bool
Whether the producer should be throttled.
Sourcepub fn fill_ratio(&self) -> f64
pub fn fill_ratio(&self) -> f64
Fill ratio (0.0 = empty, 1.0 = at high watermark).
Auto Trait Implementations§
impl Freeze for BackpressureController
impl RefUnwindSafe for BackpressureController
impl Send for BackpressureController
impl Sync for BackpressureController
impl Unpin for BackpressureController
impl UnsafeUnpin for BackpressureController
impl UnwindSafe for BackpressureController
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