pub struct CascadeEntry {
pub kind: WorkerKind,
pub breaker: CircuitBreaker,
pub success_count: Arc<AtomicU64>,
pub failure_count: Arc<AtomicU64>,
pub total_latency_ms: Arc<AtomicU64>,
pub call_count: Arc<AtomicU64>,
}Expand description
A single slot in the provider cascade: one WorkerKind plus its own
CircuitBreaker and per-call telemetry counters.
All clones of a CascadeEntry share the same underlying CircuitBreaker
state and atomic counters.
Fields§
§kind: WorkerKindThe provider kind this entry represents.
breaker: CircuitBreakerDedicated circuit breaker for this provider.
success_count: Arc<AtomicU64>Total successful calls to this provider (lock-free).
failure_count: Arc<AtomicU64>Total failed calls to this provider (lock-free).
total_latency_ms: Arc<AtomicU64>Cumulative latency in milliseconds across all calls (lock-free).
call_count: Arc<AtomicU64>Number of calls that contributed to total_latency_ms (lock-free).
Implementations§
Source§impl CascadeEntry
impl CascadeEntry
Sourcepub fn new(kind: WorkerKind, cb_config: CircuitBreakerConfig) -> Self
pub fn new(kind: WorkerKind, cb_config: CircuitBreakerConfig) -> Self
Create a new CascadeEntry for kind with the given circuit breaker config.
§Panics
This function does not panic.
Sourcepub fn avg_latency_ms(&self) -> u64
pub fn avg_latency_ms(&self) -> u64
Returns the average latency in milliseconds over all recorded calls,
or 0 if no calls have been made.
§Panics
This function does not panic.
Sourcepub fn success_rate(&self) -> f64
pub fn success_rate(&self) -> f64
Returns the success rate as a fraction in [0.0, 1.0].
Returns 1.0 when no calls have been made (optimistic default).
§Panics
This function does not panic.
Trait Implementations§
Source§impl Clone for CascadeEntry
impl Clone for CascadeEntry
Source§fn clone(&self) -> CascadeEntry
fn clone(&self) -> CascadeEntry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for CascadeEntry
impl !UnwindSafe for CascadeEntry
impl Freeze for CascadeEntry
impl Send for CascadeEntry
impl Sync for CascadeEntry
impl Unpin for CascadeEntry
impl UnsafeUnpin for CascadeEntry
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request