pingora_load_balancing::selection

Trait SelectionAlgorithm

Source
pub trait SelectionAlgorithm {
    // Required methods
    fn new() -> Self;
    fn next(&self, key: &[u8]) -> u64;
}
Expand description

SelectionAlgorithm is the interface to implement selection algorithms.

All std::hash::Hasher + Default can be used directly as a selection algorithm.

Required Methods§

Source

fn new() -> Self

Create a new implementation

Source

fn next(&self, key: &[u8]) -> u64

Return the next index of backend. The caller should perform modulo to get the valid index of the backend.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§