pub struct ChannelState {
pub health: ChannelHealth,
pub failed_at: Option<Instant>,
pub consecutive_failures: u32,
}Expand description
Runtime health state for a channel, tracked in-memory.
Fields§
§health: ChannelHealthCurrent health.
failed_at: Option<Instant>When the channel last failed (used for cooldown calculation).
consecutive_failures: u32Number of consecutive failures seen. Resets to 0 on success.
Implementations§
Source§impl ChannelState
impl ChannelState
Sourcepub fn record_failure(&mut self)
pub fn record_failure(&mut self)
Records a failure. After 3 consecutive failures the channel is marked Unhealthy with a cooldown.
Sourcepub fn record_success(&mut self)
pub fn record_success(&mut self)
Records a success: resets the failure counter and marks the channel Healthy.
Sourcepub fn mark_unhealthy(&mut self)
pub fn mark_unhealthy(&mut self)
Marks the channel as unhealthy immediately (used for 5xx errors).
Sourcepub fn is_tryable(&self, base_cooldown: Duration) -> bool
pub fn is_tryable(&self, base_cooldown: Duration) -> bool
Returns true when the channel can be tried.
Trait Implementations§
Source§impl Clone for ChannelState
impl Clone for ChannelState
Source§fn clone(&self) -> ChannelState
fn clone(&self) -> ChannelState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ChannelState
impl Debug for ChannelState
Auto Trait Implementations§
impl Freeze for ChannelState
impl RefUnwindSafe for ChannelState
impl Send for ChannelState
impl Sync for ChannelState
impl Unpin for ChannelState
impl UnsafeUnpin for ChannelState
impl UnwindSafe for ChannelState
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