Expand description
Shared fault-tolerance primitives.
CircuitBreaker guards calls to flaky external dependencies (LLM APIs,
browser CDP, message broker). Three states — Closed, Open, HalfOpen —
with exponential backoff and automatic probing.
§Example
use nexo_resilience::{CircuitBreaker, CircuitBreakerConfig};
let cb = CircuitBreaker::new("github-api", CircuitBreakerConfig::default());
assert!(cb.allow());
cb.on_success();Structs§
- Circuit
Breaker - State machine guarding one external dependency.
- Circuit
Breaker Config - Tunables for
CircuitBreaker. Defaults match production posture for typical external API guards (5 failures → open, 2 successes → close, 10s initial backoff capped at 2 min).
Enums§
- Circuit
Error - Outcome of a
CircuitBreaker::callinvocation. Either the breaker rejected the call without invoking the closure (CircuitError::Open) or the closure ran and returned its own typed error (CircuitError::Inner).