Skip to main content

HealthPolicy

Trait HealthPolicy 

Source
pub trait HealthPolicy: Send + Sync {
    // Required methods
    fn on_success(&self, health: &mut NodeHealth);
    fn on_failure(&self, health: &mut NodeHealth);
    fn should_probe(&self, health: &NodeHealth) -> bool;

    // Provided method
    fn on_outcome(&self, health: &mut NodeHealth, outcome: &Outcome) { ... }
}
Expand description

Determines how health status transitions based on success/failure signals.

Required Methods§

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.

Provided Methods§

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).

Implementors§