pub struct CircuitBreaker { /* private fields */ }
Expand description
Circuit breaker implementation for protecting against cascading failures
Implementations§
Source§impl CircuitBreaker
impl CircuitBreaker
Sourcepub fn new(config: CircuitBreakerConfig) -> Self
pub fn new(config: CircuitBreakerConfig) -> Self
Create a new circuit breaker with the given configuration
Sourcepub async fn call<F, T>(&self, operation: F) -> Neo3Result<T>where
F: Future<Output = Neo3Result<T>>,
pub async fn call<F, T>(&self, operation: F) -> Neo3Result<T>where
F: Future<Output = Neo3Result<T>>,
Execute a request through the circuit breaker
Sourcepub async fn get_state(&self) -> CircuitState
pub async fn get_state(&self) -> CircuitState
Get current circuit breaker state
Sourcepub async fn get_stats(&self) -> CircuitBreakerStats
pub async fn get_stats(&self) -> CircuitBreakerStats
Get circuit breaker statistics
Sourcepub async fn force_open(&self)
pub async fn force_open(&self)
Force the circuit breaker to open state
Sourcepub async fn get_failure_rate(&self) -> f64
pub async fn get_failure_rate(&self) -> f64
Get failure rate (failures / total requests)
Auto Trait Implementations§
impl !Freeze for CircuitBreaker
impl !RefUnwindSafe for CircuitBreaker
impl Send for CircuitBreaker
impl Sync for CircuitBreaker
impl Unpin for CircuitBreaker
impl !UnwindSafe for CircuitBreaker
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more