Expand description
Selectable service providers guarded by per-provider circuit breakers.
Implement ServiceProvider for each backend, register them on
ApplicationService, and pick one with available.
Each provider gets a CircuitBreaker that opens after repeated failures.
Key types: ServiceProvider for backends, ApplicationService for
selection, CircuitBreaker and BreakerState for failure tracking.
Use this module when several equivalent backends exist and calls should go to a currently usable one.
ⓘ
struct Primary;
impl ServiceProvider for Primary {
fn name(&self) -> &str { "primary" }
}
let mut service = ApplicationService::new("billing");
service.register_provider(Primary);
let active = service.available();Structs§
- Application
Service - Named group of providers with per-provider breakers.
- Circuit
Breaker - Failure counter that opens after
thresholdfailures.
Enums§
- Breaker
State - Circuit state: accepting calls, rejecting calls, or testing recovery.
Traits§
- Service
Provider - A backend that an
ApplicationServicecan select.