PostgresCircuitBreakerStore
Defined in: src/adapters/postgres.ts:208
Circuit breaker state store backed by PostgreSQL.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new PostgresCircuitBreakerStore(
client,table):PostgresCircuitBreakerStore
Defined in: src/adapters/postgres.ts:209
Parameters
Section titled “Parameters”client
Section titled “client”string
Returns
Section titled “Returns”PostgresCircuitBreakerStore
Methods
Section titled “Methods”getState()
Section titled “getState()”getState(
key):Promise<CircuitBreakerSnapshot>
Defined in: src/adapters/postgres.ts:214
Read the current snapshot for a circuit key.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<CircuitBreakerSnapshot>
Implementation of
Section titled “Implementation of”recordFailure()
Section titled “recordFailure()”recordFailure(
key):Promise<CircuitBreakerSnapshot>
Defined in: src/adapters/postgres.ts:237
Record a failed request and return the updated snapshot.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<CircuitBreakerSnapshot>
Implementation of
Section titled “Implementation of”CircuitBreakerStore.recordFailure
recordSuccess()
Section titled “recordSuccess()”recordSuccess(
key):Promise<CircuitBreakerSnapshot>
Defined in: src/adapters/postgres.ts:224
Record a successful request and return the updated snapshot.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<CircuitBreakerSnapshot>
Implementation of
Section titled “Implementation of”CircuitBreakerStore.recordSuccess
reset()
Section titled “reset()”reset(
key):Promise<void>
Defined in: src/adapters/postgres.ts:281
Fully reset a circuit, removing all state.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”transition()
Section titled “transition()”transition(
key,to):Promise<CircuitBreakerSnapshot>
Defined in: src/adapters/postgres.ts:251
Transition the circuit to a new state and return the updated snapshot.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<CircuitBreakerSnapshot>