Skip to main content

Crate nexo_resilience

Crate nexo_resilience 

Source
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§

CircuitBreaker
State machine guarding one external dependency.
CircuitBreakerConfig
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§

CircuitError
Outcome of a CircuitBreaker::call invocation. Either the breaker rejected the call without invoking the closure (CircuitError::Open) or the closure ran and returned its own typed error (CircuitError::Inner).