pub struct ReliabilityConfig {
pub retry: Option<RetryConfig>,
pub circuit_breaker: Option<CircuitBreakerConfig>,
pub backpressure: Option<BackpressureConfig>,
}Expand description
Reliability stack configuration: which layers to apply around backend ops.
The Default enables all layers with production defaults. Disable a
layer by setting its field to None:
use cachekit::reliability::ReliabilityConfig;
let retry_only = ReliabilityConfig {
circuit_breaker: None,
backpressure: None,
..ReliabilityConfig::default()
};
assert!(retry_only.retry.is_some());Fields§
§retry: Option<RetryConfig>Retry policy, or None to propagate every error on first failure.
circuit_breaker: Option<CircuitBreakerConfig>Circuit breaker, or None to never fail fast.
backpressure: Option<BackpressureConfig>Concurrency limiter, or None for unbounded backend concurrency.
Implementations§
Source§impl ReliabilityConfig
impl ReliabilityConfig
Sourcepub fn disabled() -> Self
pub fn disabled() -> Self
A config with every layer off — the documented preset opt-out.
Prefer this over spelling out a struct literal with all-None
fields: a literal breaks downstream code every time the stack gains
a layer (it has, twice).
use cachekit::reliability::ReliabilityConfig;
assert!(ReliabilityConfig::disabled().is_disabled());
assert!(!ReliabilityConfig::default().is_disabled());Sourcepub fn is_disabled(&self) -> bool
pub fn is_disabled(&self) -> bool
true when no layer is enabled — the builder skips the (no-op)
ReliableBackend decorator entirely. Lives here, next to the fields,
so adding a layer cannot silently miss the builder gate again.
Trait Implementations§
Source§impl Clone for ReliabilityConfig
impl Clone for ReliabilityConfig
Source§fn clone(&self) -> ReliabilityConfig
fn clone(&self) -> ReliabilityConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more