pub struct Breakers { /* private fields */ }Expand description
Per-provider circuit breakers, shared by every clone of a
crate::ModelRegistry (so by every run of a process).
Implementations§
Source§impl Breakers
impl Breakers
Sourcepub fn allows(&self, provider: &str, now: Instant) -> bool
pub fn allows(&self, provider: &str, now: Instant) -> bool
Whether provider may be called at now: its breaker is closed, or
its cooldown ended (the next call is the trial).
Sourcepub fn record_success(&self, provider: &str)
pub fn record_success(&self, provider: &str)
A call to provider succeeded: its breaker closes.
Sourcepub fn record_failure(&self, provider: &str, now: Instant) -> bool
pub fn record_failure(&self, provider: &str, now: Instant) -> bool
A call to provider failed for an outage. Returns whether its breaker
is open now.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Breakers
impl Forget for Breakers
impl Move for Breakers
impl RefUnwindSafe for Breakers
impl Send for Breakers
impl Sync for Breakers
impl Unpin for Breakers
impl UnsafeUnpin for Breakerswhere
Align4<u32>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<(String, BreakerState)>: UnsafeUnpin,
impl UnwindSafe for Breakers
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