Skip to main content

Module service

Module service 

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

ApplicationService
Named group of providers with per-provider breakers.
CircuitBreaker
Failure counter that opens after threshold failures.

Enums§

BreakerState
Circuit state: accepting calls, rejecting calls, or testing recovery.

Traits§

ServiceProvider
A backend that an ApplicationService can select.