pub struct Breaker { /* private fields */ }Expand description
The circuit breaker around a digester that can fail.
Counted, not timed: a wall clock inside a decision would break replay, and “three failures in a row” is a fact the caller can reproduce. Opening the breaker is not an error — it means the pipeline stops asking and hands back the source, which is the answer that was always correct and merely more expensive to read.
Implementations§
Source§impl Breaker
impl Breaker
pub fn new(limit: u32) -> Breaker
pub fn verdict(&self) -> BreakerVerdict
Sourcepub fn succeeded(&mut self)
pub fn succeeded(&mut self)
One digest came back. The count resets, because the failures this breaker cares about are consecutive ones: an intermittent provider is a different condition from a broken one.
pub fn failed(&mut self)
pub fn consecutive_failures(&self) -> u32
Trait Implementations§
impl Eq for Breaker
impl StructuralPartialEq for Breaker
Auto Trait Implementations§
impl Freeze for Breaker
impl RefUnwindSafe for Breaker
impl Send for Breaker
impl Sync for Breaker
impl Unpin for Breaker
impl UnsafeUnpin for Breaker
impl UnwindSafe for Breaker
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