pub struct CircuitBreakerState {
pub consecutive_failures: usize,
pub last_trip_time: Option<Instant>,
}Expand description
Tracks circuit breaker state per-step across workflow runs.
Fields§
§consecutive_failures: usizeNumber of consecutive failures.
last_trip_time: Option<Instant>When the circuit was last tripped (entered open state).
Implementations§
Source§impl CircuitBreakerState
impl CircuitBreakerState
Sourcepub fn is_open(&self, max_failures: usize, cooldown_secs: u64) -> bool
pub fn is_open(&self, max_failures: usize, cooldown_secs: u64) -> bool
Check if the circuit is currently open (blocking execution).
Sourcepub fn record_failure(&mut self)
pub fn record_failure(&mut self)
Record a failure.
Sourcepub fn record_success(&mut self)
pub fn record_success(&mut self)
Record a success, resetting the counter.
Trait Implementations§
Source§impl Clone for CircuitBreakerState
impl Clone for CircuitBreakerState
Source§fn clone(&self) -> CircuitBreakerState
fn clone(&self) -> CircuitBreakerState
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 CircuitBreakerState
impl Debug for CircuitBreakerState
Source§impl Default for CircuitBreakerState
impl Default for CircuitBreakerState
Source§fn default() -> CircuitBreakerState
fn default() -> CircuitBreakerState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CircuitBreakerState
impl RefUnwindSafe for CircuitBreakerState
impl Send for CircuitBreakerState
impl Sync for CircuitBreakerState
impl Unpin for CircuitBreakerState
impl UnsafeUnpin for CircuitBreakerState
impl UnwindSafe for CircuitBreakerState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more