pub trait BreakerStore:
Send
+ Sync
+ 'static {
// Required methods
fn admit<'a>(
&'a self,
breaker: &'a CircuitBreaker,
key: &'a str,
) -> BreakerFuture<'a, Admission>;
fn record<'a>(
&'a self,
breaker: &'a CircuitBreaker,
key: &'a str,
failed: bool,
probe: Option<Probe>,
) -> BreakerFuture<'a, ()>;
}Expand description
Where circuit breakers are kept: in the deliverer’s memory unless the application gives it a store of its own, such as one in Redis that the deliverers of every process share, as Mastodon keeps its Stoplights.
Required Methods§
Sourcefn admit<'a>(
&'a self,
breaker: &'a CircuitBreaker,
key: &'a str,
) -> BreakerFuture<'a, Admission>
fn admit<'a>( &'a self, breaker: &'a CircuitBreaker, key: &'a str, ) -> BreakerFuture<'a, Admission>
Whether a delivery to key may be sent, as CircuitBreaker says.
Letting one through as a probe takes the probe, so that no other
delivery is let through until it is given back.
Sourcefn record<'a>(
&'a self,
breaker: &'a CircuitBreaker,
key: &'a str,
failed: bool,
probe: Option<Probe>,
) -> BreakerFuture<'a, ()>
fn record<'a>( &'a self, breaker: &'a CircuitBreaker, key: &'a str, failed: bool, probe: Option<Probe>, ) -> BreakerFuture<'a, ()>
Record how a delivery to key that was let through went: as a
probe, when probe is the one BreakerStore::admit took for it,
which closes the breaker or opens it again, and is given back after.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".