Skip to main content

CircuitBreakerBuilder

Struct CircuitBreakerBuilder 

Source
pub struct CircuitBreakerBuilder { /* private fields */ }
Expand description

Builder for CircuitBreakerInterceptor.

§Example

use rtci_interceptor::{CircuitBreakerBuilder, Registry, Slot};

let (breaker, handle) = CircuitBreakerBuilder::new().build();
let chain = Registry::new().with(Slot::CircuitBreaker, breaker).build();
assert!(handle.ceased().is_empty());

Implementations§

Source§

impl CircuitBreakerBuilder

Source

pub fn new() -> Self

A builder with the RFC’s recommended values.

Source

pub fn with_rtcp_interval(self, interval: Duration) -> Self

Td, this endpoint’s deterministic RTCP reporting interval, computed with Tmin = 5 s (section 4.1). The RTCP timeout breaker trips after three of them. Values above 5 s are held to 5 s: the RFC says not to configure a longer one.

Source

pub fn with_t_rr_interval(self, interval: Duration) -> Self

The AVPF T_rr_interval in use, which replaces Tdr in CB_INTERVAL when it is larger (section 4.3). Held to 4 s (sections 4.1 and 4.3).

Source

pub fn with_non_reporting_threshold(self, k: u32) -> Self

k, the number of reports without progress that gives assurance the forward path failed (section 4.2). 5 is recommended.

Source

pub fn with_frame_group_size(self, frames: u32) -> Self

G, the number of frames the codec needs before it can change rate (section 3). 1 for a codec that can adapt on every frame.

Source

pub fn with_full_tcp_equation(self, full: bool) -> Self

Use the full TCP throughput equation instead of the simplified one (section 4.3: MAY; it is more sensitive to loss and trips earlier).

Source

pub fn with_packet_size(self, packet_size: PacketSize) -> Self

How s, the packet size of the TCP throughput equation, is taken (section 4.3). PacketSize::SendingWindow by default; PacketSize::LastFrames is section 3’s “last 4 * G frames”.

Source

pub fn with_rate_reduction(self, reduce: bool) -> Self

When the congestion breaker trips, first ask for a tenth of the rate (CircuitBreakerState::Reduced) instead of ceasing at once (section 4.3: MAY). If it trips again after the next CB_INTERVAL reports the flow ceases.

Source

pub fn with_grouped_flows(self, group: bool) -> Self

Treat every flow of the connection as one group: a breaker tripping for one flow applies to all (section 8: MAY). By default each SSRC is judged on its own.

Source

pub fn with_media_usability(self, usability: MediaUsability) -> Self

The bound past which the media is unusable (section 4.4). Without one the media usability breaker does not run: the RFC defines no bound.

Source

pub fn build(self) -> (CircuitBreakerInterceptor, CircuitBreakerHandle)

Build the interceptor and the handle the application watches it through.

Source

pub fn build_with_handle( self, handle: &CircuitBreakerHandle, ) -> CircuitBreakerInterceptor

Build the interceptor handle watches (made beforehand, for example to give it to the congestion controller of the same transport). One interceptor per handle.

Trait Implementations§

Source§

impl Default for CircuitBreakerBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.