pub enum HealthStatus {
Healthy,
Degraded,
Unhealthy,
Recovering,
}Expand description
Current health state of a node.
State transitions (with ConsecutiveFailurePolicy):
┌─────────┐ failures >= ⌈threshold/2⌉ ┌──────────┐ failures >= threshold ┌───────────┐
│ Healthy │ ──────────────────────────→ │ Degraded │ ──────────────────────→ │ Unhealthy │
└─────────┘ └──────────┘ └───────────┘
↑ │ │
│ 1 success │ 1 success │ 1 success
│ ↓ ↓
│ ┌─────────┐ ┌────────────┐
└───────────────────────────────────│ Healthy │←─── recovery_successes ──│ Recovering │
└─────────┘ └────────────┘Variants§
Healthy
Node is operating normally. All traffic is routed here.
Degraded
Node is responding but showing signs of stress (e.g., elevated latency). Still receives traffic, but signals the system should be watchful.
Unhealthy
Node has failed repeatedly and is temporarily removed from rotation.
No traffic is sent until HealthPolicy::should_probe allows a probe.
Recovering
Node was unhealthy but is being given probe requests to verify recovery.
Receives limited traffic until enough consecutive successes promote it
back to Healthy.
Implementations§
Source§impl HealthStatus
impl HealthStatus
Sourcepub fn is_available(self) -> bool
pub fn is_available(self) -> bool
Returns true for any status that should still receive traffic
(Healthy, Degraded, Recovering).
Sourcepub const fn bit_flag(self) -> u8
pub const fn bit_flag(self) -> u8
Returns a single-bit flag for this variant. Used by HealthFilter.
Trait Implementations§
Source§impl Clone for HealthStatus
impl Clone for HealthStatus
Source§fn clone(&self) -> HealthStatus
fn clone(&self) -> HealthStatus
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HealthStatus
impl Debug for HealthStatus
Source§impl Hash for HealthStatus
impl Hash for HealthStatus
Source§impl PartialEq for HealthStatus
impl PartialEq for HealthStatus
impl Copy for HealthStatus
impl Eq for HealthStatus
impl StructuralPartialEq for HealthStatus
Auto Trait Implementations§
impl Freeze for HealthStatus
impl RefUnwindSafe for HealthStatus
impl Send for HealthStatus
impl Sync for HealthStatus
impl Unpin for HealthStatus
impl UnsafeUnpin for HealthStatus
impl UnwindSafe for HealthStatus
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