Skip to main content

ConsecutiveFailurePolicy

Struct ConsecutiveFailurePolicy 

Source
pub struct ConsecutiveFailurePolicy {
    pub failure_threshold: u32,
    pub recovery_successes: u32,
    pub probe_interval: Duration,
}
Expand description

Marks a node unhealthy after N consecutive failures, recovers after M successes.

When failure_threshold is 1, nodes jump directly from Healthy to Unhealthy — the Degraded state is skipped because there is no room for an intermediate warning.

Fields§

§failure_threshold: u32

Number of consecutive failures before a node becomes Unhealthy. At ⌈threshold/2⌉ failures the node first enters Degraded. Default: 3.

§recovery_successes: u32

Number of consecutive successes an Unhealthy / Recovering node needs before returning to Healthy. Default: 2.

§probe_interval: Duration

Minimum time after the last failure before an Unhealthy node is eligible for a probe request. Default: 10 s.

Implementations§

Trait Implementations§

Source§

impl Default for ConsecutiveFailurePolicy

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl HealthPolicy for ConsecutiveFailurePolicy

Source§

fn on_success(&self, health: &mut NodeHealth)

Called after a successful request to the node.
Source§

fn on_failure(&self, health: &mut NodeHealth)

Called after a failed request to the node.
Source§

fn should_probe(&self, health: &NodeHealth) -> bool

Whether an Unhealthy node should be given a probe request to check if it has recovered.
Source§

fn on_outcome(&self, health: &mut NodeHealth, outcome: &Outcome)

Process a classified request outcome. The default implementation delegates to on_success / on_failure and ignores rate-limited outcomes (they don’t affect health state).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V