pub enum LoadBalance {
RoundRobin(LoadBalanceRoundRobin),
Random(LoadBalanceRandom),
LeastConnections(LoadBalanceLeastConn),
Weighted(LoadBalanceWeighted),
}Expand description
Load balancer enum (adapted from rpxy).
Variants§
RoundRobin(LoadBalanceRoundRobin)
Each backend in turn.
Random(LoadBalanceRandom)
Uniformly at random.
LeastConnections(LoadBalanceLeastConn)
Whichever backend currently has the fewest connections.
Weighted(LoadBalanceWeighted)
In proportion to each backend’s weight.
Implementations§
Source§impl LoadBalance
impl LoadBalance
Sourcepub fn from_strategy(
strategy: &LoadBalanceStrategy,
backends: &[Backend],
) -> Self
pub fn from_strategy( strategy: &LoadBalanceStrategy, backends: &[Backend], ) -> Self
Build the balancer a strategy names, sized to backends.
Sticky falls back to round-robin: cookie affinity is behind the
sticky-cookie feature and there is nothing to be sticky on without it.
Auto Trait Implementations§
impl !RefUnwindSafe for LoadBalance
impl !UnwindSafe for LoadBalance
impl Freeze for LoadBalance
impl Send for LoadBalance
impl Sync for LoadBalance
impl Unpin for LoadBalance
impl UnsafeUnpin for LoadBalance
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more