Interface KeyState

One key's standing in a pool. fingerprint and label identify the key without holding it.

interface KeyState {
    fingerprint: string;
    label: string;
    status: "failed" | "ok" | "resting";
    kind?: KeyFailureKind;
    until?: number;
    failures: number;
    lastOkAt?: number;
    lastFailAt?: number;
    nextRecheckAt?: number;
    updatedAt: number;
    version: 1;
}

Properties

fingerprint: string

A short non-reversible digest of the key, the row's identity in a store.

label: string

k<index> plus the key's last four characters, for log lines.

status: "failed" | "ok" | "resting"

ok: hand out freely. resting: a quota rest until until. failed: out until a probe passes or a recheck re-admits it.

The kind of the last failure, set while resting or failed.

until?: number

When a quota rest ends (epoch ms).

failures: number

Consecutive auth or billing failures since the last success; sets the recheck delay.

lastOkAt?: number

The start time of the last request that succeeded with this key.

lastFailAt?: number

The start time of the last request that failed with this key.

nextRecheckAt?: number

When the next probe of a failed key may run (epoch ms).

updatedAt: number

When this state was last changed (epoch ms); a store keeps the newest.

version: 1

The record's shape version; a store ignores other versions.