pub struct CircuitBreakerHandle { /* private fields */ }Expand description
The application’s view of the circuit breaker, and its way to restart a ceased flow.
Implementations§
Source§impl CircuitBreakerHandle
impl CircuitBreakerHandle
Sourcepub fn new() -> Self
pub fn new() -> Self
A handle with no interceptor yet: CircuitBreakerBuilder::build_with_handle builds
the one it watches.
Sourcepub fn state(&self, ssrc: u32) -> Option<CircuitBreakerState>
pub fn state(&self, ssrc: u32) -> Option<CircuitBreakerState>
What the breaker is doing with the flow sent on ssrc, if it is bound.
Sourcepub fn ceased(&self) -> Vec<(u32, CircuitBreakerReason)>
pub fn ceased(&self) -> Vec<(u32, CircuitBreakerReason)>
The flows that have ceased transmission, with the breaker that stopped each.
Sourcepub fn rate_limit(&self) -> Option<f64>
pub fn rate_limit(&self) -> Option<f64>
The lowest rate any flow has been asked to stay under after the congestion breaker tripped, in bits per second. A congestion controller takes it as an upper bound.
Sourcepub fn report_round_trip_time(&self, round_trip_time: Duration)
pub fn report_round_trip_time(&self, round_trip_time: Duration)
One round trip time measurement from congestion-control feedback, for the breaker to use when it cannot measure one itself.
Tr is the RFC 3550 round trip time: a report block’s LSR and DLSR against the instant the named sender report left. The breaker only knows that instant for sender reports that pass it on the way out; when the RTCP session sits wire-ward of it (as the standard set places it) none does, and without Tr the congestion breaker could never compare the flow with TCP. The congestion controller’s feedback gives the same quantity many times a second.
Give each measurement as it is made: this smooths them as section 3 says (“Tr = (0.8 * Tr) + (0.2 * Tr_new) where Tr_new is the latest RTT estimate”), once. A value that is already an average makes Tr trail the path by that average’s memory on top of its own.
Sourcepub fn restart(&self, ssrc: u32, now: Instant) -> bool
pub fn restart(&self, ssrc: u32, now: Instant) -> bool
Restart a ceased flow. Returns whether it restarted.
This is the application saying the congestion can be expected to have gone (section
4.5), for a flow the breaker has no information to restart on by itself
(CircuitBreakerBuilder::with_automatic_restart). It is refused until the hold has
passed (the interval that tripped the breaker, doubled for each trip that followed a
restart closely), so the reaction to a tripped breaker lasts at least the triggering
interval however often a restart is attempted.