#[non_exhaustive]pub struct BalancePolicy {
pub ejection: Option<Ejection>,
pub max_ejected_percent: u8,
pub hedge: Option<Hedge>,
/* private fields */
}Expand description
How a balanced client chooses and ejects endpoints.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.ejection: Option<Ejection>When an endpoint is taken out of rotation; None: never. Default:
Ejection::default. A client on an HttpPool
uses the pool’s instead (HttpPoolBuilder::with_ejection).
max_ejected_percent: u8The largest share of the set, in percent, kept out of rotation at
once (rounded down); past it the endpoints whose ejection ends soonest
are used. Default 50; 100 lets every endpoint be ejected, and calls
then fail with ClientError::CircuitOpen.
hedge: Option<Hedge>Hedging; None (the default): off.
Implementations§
Source§impl BalancePolicy
impl BalancePolicy
Sourcepub fn new() -> BalancePolicy
pub fn new() -> BalancePolicy
Ejection on with its defaults, at most half the set ejected, no hedging.
Sourcepub const fn with_ejection(self, ejection: Ejection) -> BalancePolicy
pub const fn with_ejection(self, ejection: Ejection) -> BalancePolicy
Ejects as ejection says.
Sourcepub const fn without_ejection(self) -> BalancePolicy
pub const fn without_ejection(self) -> BalancePolicy
Never ejects.
Sourcepub fn with_max_ejected_percent(self, percent: u8) -> BalancePolicy
pub fn with_max_ejected_percent(self, percent: u8) -> BalancePolicy
The largest share of the set kept out at once, in percent (at most 100).
Sourcepub const fn with_hedge(self, hedge: Hedge) -> BalancePolicy
pub const fn with_hedge(self, hedge: Hedge) -> BalancePolicy
Hedges idempotent calls as hedge says.
Trait Implementations§
Source§impl Clone for BalancePolicy
impl Clone for BalancePolicy
Source§fn clone(&self) -> BalancePolicy
fn clone(&self) -> BalancePolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for BalancePolicy
Source§impl Debug for BalancePolicy
impl Debug for BalancePolicy
Source§impl Default for BalancePolicy
impl Default for BalancePolicy
Source§fn default() -> BalancePolicy
fn default() -> BalancePolicy
Returns the “default value” for a type. Read more
Source§impl PartialEq for BalancePolicy
impl PartialEq for BalancePolicy
impl StructuralPartialEq for BalancePolicy
Auto Trait Implementations§
impl Forget for BalancePolicy
impl Freeze for BalancePolicy
impl Move for BalancePolicy
impl RefUnwindSafe for BalancePolicy
impl Send for BalancePolicy
impl Sync for BalancePolicy
impl Unpin for BalancePolicy
impl UnsafeUnpin for BalancePolicy
impl UnwindSafe for BalancePolicy
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].