Skip to main content

Module circuit_breaker

Module circuit_breaker 

Source
Expand description

A small, domain-agnostic circuit breaker: closed/open/probing state driven by consecutive-failure counting and a fixed cooldown. Deliberately free of any cache-specific naming so it stays reusable (and so imetric!’s literal-name requirement doesn’t leak into it) — state transitions are returned to the caller, which owns the metrics and logs.

See tasks/1360_cache_client_circuit_breaker_plan.md (“The breaker”) for the full design rationale.

Structs§

CircuitBreaker
Gates access to a flaky resource: trips after failure_threshold consecutive unresponsive reports, stays open for a fixed cooldown, then admits exactly one probe request to test recovery.
CircuitBreakerConfig
Tunables for a CircuitBreaker.

Enums§

Admission
What a caller may do with the guarded resource right now.
Transition
A state change worth reporting, returned so the caller emits its own metrics/logs and the breaker stays domain-agnostic.