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§
Sourcefn on_success(&self, health: &mut NodeHealth)
fn on_success(&self, health: &mut NodeHealth)
Called after a successful request to the node.
Sourcefn on_failure(&self, health: &mut NodeHealth)
fn on_failure(&self, health: &mut NodeHealth)
Called after a failed request to the node.
Sourcefn 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.
Provided Methods§
Sourcefn 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).