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: u32Number of consecutive failures before a node becomes Unhealthy.
At ⌈threshold/2⌉ failures the node first enters Degraded.
Default: 3.
recovery_successes: u32Number of consecutive successes an Unhealthy /
Recovering node needs before returning to
Healthy. Default: 2.
probe_interval: DurationMinimum time after the last failure before an Unhealthy node
is eligible for a probe request. Default: 10 s.
Implementations§
Source§impl ConsecutiveFailurePolicy
impl ConsecutiveFailurePolicy
Sourcepub fn builder() -> ConsecutiveFailurePolicyBuilder
pub fn builder() -> ConsecutiveFailurePolicyBuilder
Create an instance of ConsecutiveFailurePolicy using the builder syntax
Trait Implementations§
Source§impl Default for ConsecutiveFailurePolicy
impl Default for ConsecutiveFailurePolicy
Source§impl HealthPolicy for ConsecutiveFailurePolicy
impl HealthPolicy for ConsecutiveFailurePolicy
Source§fn on_success(&self, health: &mut NodeHealth)
fn on_success(&self, health: &mut NodeHealth)
Called after a successful request to the node.
Source§fn on_failure(&self, health: &mut NodeHealth)
fn on_failure(&self, health: &mut NodeHealth)
Called after a failed request to the node.
Source§fn should_probe(&self, health: &NodeHealth) -> bool
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)
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§
impl Freeze for ConsecutiveFailurePolicy
impl RefUnwindSafe for ConsecutiveFailurePolicy
impl Send for ConsecutiveFailurePolicy
impl Sync for ConsecutiveFailurePolicy
impl Unpin for ConsecutiveFailurePolicy
impl UnsafeUnpin for ConsecutiveFailurePolicy
impl UnwindSafe for ConsecutiveFailurePolicy
Blanket Implementations§
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