Skip to main content

Algorithm

Trait Algorithm 

Source
pub trait Algorithm {
    // Required methods
    fn max_concurrency(&self) -> usize;
    fn update(
        &mut self,
        rtt: Duration,
        num_inflight: usize,
        is_error: bool,
        is_canceled: bool,
    );
}
Expand description

An algorithm that dynamically adjusts the maximum number of allowed concurrent requests based on the observed traffic.

Required Methods§

Source

fn max_concurrency(&self) -> usize

Returns the maximum number of concurrent requests the algorithm currently allows.

§Panics

Implementations must not panic. This method is called while holding a shared mutex; a panic would poison it and abort on the next request.

Source

fn update( &mut self, rtt: Duration, num_inflight: usize, is_error: bool, is_canceled: bool, )

Observes the outcome of a request and updates the algorithm’s state accordingly.

§Panics

Implementations must not panic. This method is called while holding a shared mutex; a panic would poison it and abort on the next request.

Implementors§