pingora_load_balancing::selection

Trait BackendSelection

Source
pub trait BackendSelection {
    type Iter;

    // Required methods
    fn build(backends: &BTreeSet<Backend>) -> Self;
    fn iter(self: &Arc<Self>, key: &[u8]) -> Self::Iter
       where Self::Iter: BackendIter;
}
Expand description

BackendSelection is the interface to implement backend selection mechanisms.

Required Associated Types§

Source

type Iter

The BackendIter returned from iter() below.

Required Methods§

Source

fn build(backends: &BTreeSet<Backend>) -> Self

The function to create a BackendSelection implementation.

Source

fn iter(self: &Arc<Self>, key: &[u8]) -> Self::Iter
where Self::Iter: BackendIter,

Select backends for a given key.

An BackendIter should be returned. The first item in the iter is the first choice backend. The user should continue to iterate over it if the first backend cannot be used due to its health or other reasons.

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§