pub struct FlowController { /* private fields */ }Expand description
Flow controller for managing stream throughput.
Implementations§
Source§impl FlowController
impl FlowController
Sourcepub fn new(config: FlowControlConfig) -> Self
pub fn new(config: FlowControlConfig) -> Self
Create a new flow controller.
Sourcepub async fn acquire(&self, count: usize) -> Result<()>
pub async fn acquire(&self, count: usize) -> Result<()>
Acquire permission to process elements.
Sourcepub async fn try_acquire(&self, count: usize) -> bool
pub async fn try_acquire(&self, count: usize) -> bool
Try to acquire without blocking.
Sourcepub async fn record_latency(&self, latency: Duration)
pub async fn record_latency(&self, latency: Duration)
Record processing latency.
Sourcepub async fn adjust_rate_adaptive(&self)
pub async fn adjust_rate_adaptive(&self)
Adjust rate based on observed latency.
Sourcepub async fn metrics(&self) -> FlowControlMetrics
pub async fn metrics(&self) -> FlowControlMetrics
Get current metrics.
Sourcepub async fn reset_metrics(&self)
pub async fn reset_metrics(&self)
Reset metrics.
Sourcepub async fn current_rate(&self) -> f64
pub async fn current_rate(&self) -> f64
Get current rate.
Auto Trait Implementations§
impl !Freeze for FlowController
impl !RefUnwindSafe for FlowController
impl Send for FlowController
impl Sync for FlowController
impl Unpin for FlowController
impl UnsafeUnpin for FlowController
impl !UnwindSafe for FlowController
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