Skip to content

CircuitBreakerStore

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

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.

optional destroy(): void

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

Optional cleanup - release timers, close connections, etc.

void


getState(key): Promise<CircuitBreakerSnapshot>

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

Read the current snapshot for a circuit key.

string

Promise<CircuitBreakerSnapshot>


recordFailure(key): Promise<CircuitBreakerSnapshot>

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

Record a failed request and return the updated snapshot.

string

Promise<CircuitBreakerSnapshot>


recordSuccess(key): Promise<CircuitBreakerSnapshot>

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

Record a successful request and return the updated snapshot.

string

Promise<CircuitBreakerSnapshot>


reset(key): Promise<void>

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

Fully reset a circuit, removing all state.

string

Promise<void>


transition(key, to): Promise<CircuitBreakerSnapshot>

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

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

string

CircuitState

Promise<CircuitBreakerSnapshot>