pub trait LoadBalancingAlgorithm: Debug {
// Required method
fn next_available_backend(
&mut self,
key: Option<u64>,
backends: &mut Vec<Rc<RefCell<Backend>>>,
) -> Option<Rc<RefCell<Backend>>>;
// Provided method
fn rebuild(&mut self, _backends: &[Rc<RefCell<Backend>>]) { ... }
}Required Methods§
Sourcefn next_available_backend(
&mut self,
key: Option<u64>,
backends: &mut Vec<Rc<RefCell<Backend>>>,
) -> Option<Rc<RefCell<Backend>>>
fn next_available_backend( &mut self, key: Option<u64>, backends: &mut Vec<Rc<RefCell<Backend>>>, ) -> Option<Rc<RefCell<Backend>>>
Select the next backend.
key carries an optional affinity hash (e.g. a UDP flow key). The
stateless/round-robin policies ignore it; the consistent-hashing
policies (Rendezvous, Maglev) use it to pin a key to a backend.
Passing None preserves the historical, key-agnostic behavior.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".