pub struct CircuitBreaker { /* private fields */ }Expand description
Circuit breaker for fault isolation with state consistency validation and event publishing
Implementations§
Source§impl CircuitBreaker
impl CircuitBreaker
Sourcepub fn new(name: String, Config: CircuitBreakerConfig) -> Self
pub fn new(name: String, Config: CircuitBreakerConfig) -> Self
Create a new circuit breaker with event publishing
Sourcepub fn GetEventTransmitter(&self) -> Sender<CircuitEvent>
pub fn GetEventTransmitter(&self) -> Sender<CircuitEvent>
Get the circuit breaker event transmitter for subscription
Sourcepub async fn GetState(&self) -> CircuitState
pub async fn GetState(&self) -> CircuitState
Get current state with panic recovery
Sourcepub async fn ValidateState(&self) -> Result<(), String>
pub async fn ValidateState(&self) -> Result<(), String>
Validate state consistency across all counters
Sourcepub async fn RecordSuccess(&self)
pub async fn RecordSuccess(&self)
Record a successful call with panic recovery
Sourcepub async fn RecordFailure(&self)
pub async fn RecordFailure(&self)
Record a failed call with panic recovery
Sourcepub async fn AttemptRecovery(&self) -> bool
pub async fn AttemptRecovery(&self) -> bool
Attempt to transition to half-open if timeout has elapsed with panic recovery
Sourcepub async fn GetStatistics(&self) -> CircuitStatistics
pub async fn GetStatistics(&self) -> CircuitStatistics
Get circuit breaker statistics for metrics
Sourcepub fn ValidateConfig(config: &CircuitBreakerConfig) -> Result<(), String>
pub fn ValidateConfig(config: &CircuitBreakerConfig) -> Result<(), String>
Validate circuit breaker configuration
Trait Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].