Skip to content

CircuitBreakerStore

Defined in: src/policies/resilience/circuit-breaker.ts:40

Pluggable storage backend for circuit breaker state.

Implement this interface to store circuit state in Durable Objects, KV, or any shared datastore for multi-instance deployments.

getState(key): Promise<CircuitBreakerSnapshot>

Defined in: src/policies/resilience/circuit-breaker.ts:42

Read the current snapshot for a circuit key.

string

Promise<CircuitBreakerSnapshot>


recordFailure(key): Promise<CircuitBreakerSnapshot>

Defined in: src/policies/resilience/circuit-breaker.ts:46

Record a failed request and return the updated snapshot.

string

Promise<CircuitBreakerSnapshot>


recordSuccess(key): Promise<CircuitBreakerSnapshot>

Defined in: src/policies/resilience/circuit-breaker.ts:44

Record a successful request and return the updated snapshot.

string

Promise<CircuitBreakerSnapshot>


reset(key): Promise<void>

Defined in: src/policies/resilience/circuit-breaker.ts:50

Fully reset a circuit, removing all state.

string

Promise<void>


transition(key, to): Promise<CircuitBreakerSnapshot>

Defined in: src/policies/resilience/circuit-breaker.ts:48

Transition the circuit to a new state and return the updated snapshot.

string

CircuitState

Promise<CircuitBreakerSnapshot>