pub struct AimdController { /* private fields */ }Expand description
An atomic additive-increase, multiplicative-decrease concurrency controller.
Implementations§
Source§impl AimdController
impl AimdController
Sourcepub fn new(
min_concurrency: usize,
max_concurrency: usize,
initial_concurrency: usize,
increase_after_successes: usize,
decrease_factor: f32,
) -> Self
pub fn new( min_concurrency: usize, max_concurrency: usize, initial_concurrency: usize, increase_after_successes: usize, decrease_factor: f32, ) -> Self
Creates a controller with normalized bounds and tuning values.
Sourcepub fn desired_concurrency(&self) -> usize
pub fn desired_concurrency(&self) -> usize
Returns the currently desired concurrency.
Sourcepub fn record_success(&self)
pub fn record_success(&self)
Records a successful attempt, additively increasing after a sustained streak.
Sourcepub fn record_setback(&self)
pub fn record_setback(&self)
Records a setback, clearing the streak and multiplicatively decreasing concurrency.
Auto Trait Implementations§
impl !Freeze for AimdController
impl RefUnwindSafe for AimdController
impl Send for AimdController
impl Sync for AimdController
impl Unpin for AimdController
impl UnsafeUnpin for AimdController
impl UnwindSafe for AimdController
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