pub struct BackendList {
pub backends: Vec<Rc<RefCell<Backend>>>,
pub next_id: u32,
pub load_balancing: Box<dyn LoadBalancingAlgorithm>,
/* private fields */
}Fields§
§backends: Vec<Rc<RefCell<Backend>>>§next_id: u32§load_balancing: Box<dyn LoadBalancingAlgorithm>Implementations§
Source§impl BackendList
impl BackendList
pub fn new() -> BackendList
pub fn import_configuration_state(backend_vec: &[Backend]) -> BackendList
pub fn add_backend(&mut self, backend: Backend)
Sourcepub fn remove_backend(&mut self, backend_address: &SocketAddr) -> Vec<String>
pub fn remove_backend(&mut self, backend_address: &SocketAddr) -> Vec<String>
Remove every backend at backend_address and return the list of
backend_ids that were dropped. Two backends with the same address
but distinct ids (A/B test, weighted variant, dedup race) are both
removed here; the caller relies on the returned ids to tear down
matching per-backend state (metrics, health-check). Returning the
ids closes the identity drift between runtime-removal-by-address
and metrics-removal-by-id.
pub fn has_backend(&self, backend_address: &SocketAddr) -> bool
pub fn find_backend( &mut self, backend_address: &SocketAddr, ) -> Option<&mut Rc<RefCell<Backend>>>
pub fn find_sticky( &mut self, sticky_session: &str, ) -> Option<&mut Rc<RefCell<Backend>>>
pub fn available_backends(&mut self, backup: bool) -> Vec<Rc<RefCell<Backend>>>
pub fn next_available_backend(&mut self) -> Option<Rc<RefCell<Backend>>>
Sourcepub fn next_available_backend_with_key(
&mut self,
key: Option<u64>,
) -> Option<Rc<RefCell<Backend>>>
pub fn next_available_backend_with_key( &mut self, key: Option<u64>, ) -> Option<Rc<RefCell<Backend>>>
Pick the next available backend, optionally pinned by an affinity key.
key is only consulted by consistent-hashing policies (HRW/Maglev);
every other policy ignores it, so next_available_backend_with_key(None)
is byte-for-byte the legacy behavior. The UDP datapath calls this with
Some(flow_hash) to keep a client flow pinned to one backend.