pub struct BackpressureManager { /* private fields */ }Expand description
Manages backpressure for a stream.
Implementations§
Source§impl BackpressureManager
impl BackpressureManager
Sourcepub fn new(config: BackpressureConfig, buffer_capacity: usize) -> Self
pub fn new(config: BackpressureConfig, buffer_capacity: usize) -> Self
Create a new backpressure manager.
Sourcepub async fn should_apply_backpressure(&self) -> bool
pub async fn should_apply_backpressure(&self) -> bool
Check if backpressure should be applied.
Sourcepub async fn can_release_backpressure(&self) -> bool
pub async fn can_release_backpressure(&self) -> bool
Check if backpressure can be released.
Sourcepub async fn handle_element_arrival(&self) -> Result<bool>
pub async fn handle_element_arrival(&self) -> Result<bool>
Handle a new element arrival.
Sourcepub async fn handle_element_processed(&self, latency: Duration)
pub async fn handle_element_processed(&self, latency: Duration)
Handle element processing completion.
Sourcepub async fn metrics(&self) -> LoadMetrics
pub async fn metrics(&self) -> LoadMetrics
Get current metrics.
Sourcepub fn set_capacity(&self, capacity: usize)
pub fn set_capacity(&self, capacity: usize)
Set buffer capacity.
Sourcepub async fn reset_metrics(&self)
pub async fn reset_metrics(&self)
Reset metrics.
Sourcepub async fn adjust_capacity_adaptive(&self)
pub async fn adjust_capacity_adaptive(&self)
Adaptive capacity adjustment based on load.
Auto Trait Implementations§
impl !Freeze for BackpressureManager
impl !RefUnwindSafe for BackpressureManager
impl Send for BackpressureManager
impl Sync for BackpressureManager
impl Unpin for BackpressureManager
impl UnsafeUnpin for BackpressureManager
impl !UnwindSafe for BackpressureManager
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