pub struct InMemoryCircuitBreakerBackend { /* private fields */ }Expand description
In-process circuit breaker backend backed by a Mutex<HashMap>.
Each service name gets its own independent failure counter and open-at
timestamp. Multiple CircuitBreaker instances that share the same
backend (via CircuitBreaker::with_backend) will correctly track
failures per service rather than sharing a single counter.
Implementations§
Trait Implementations§
Source§impl CircuitBreakerBackend for InMemoryCircuitBreakerBackend
impl CircuitBreakerBackend for InMemoryCircuitBreakerBackend
Source§fn increment_failures(&self, service: &str) -> u32
fn increment_failures(&self, service: &str) -> u32
Increment the consecutive failure count for
service and return the new count.Source§fn reset_failures(&self, service: &str)
fn reset_failures(&self, service: &str)
Reset the consecutive failure count for
service to zero.Source§fn get_failures(&self, service: &str) -> u32
fn get_failures(&self, service: &str) -> u32
Return the current consecutive failure count for
service.Source§fn set_open_at(&self, service: &str, at: Instant)
fn set_open_at(&self, service: &str, at: Instant)
Record the instant at which the circuit was opened for
service.Source§fn clear_open_at(&self, service: &str)
fn clear_open_at(&self, service: &str)
Clear the open-at timestamp, effectively moving the circuit to Closed or HalfOpen.
Auto Trait Implementations§
impl Freeze for InMemoryCircuitBreakerBackend
impl RefUnwindSafe for InMemoryCircuitBreakerBackend
impl Send for InMemoryCircuitBreakerBackend
impl Sync for InMemoryCircuitBreakerBackend
impl Unpin for InMemoryCircuitBreakerBackend
impl UnsafeUnpin for InMemoryCircuitBreakerBackend
impl UnwindSafe for InMemoryCircuitBreakerBackend
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