Skip to main content
Defined in: coordination/types.ts:164 Cross-replica coordination backend. One instance per replica (per Bot); the bot calls start when it starts and stop when it stops.

Properties

replicaId

Defined in: coordination/types.ts:166 This replica’s id; unique among the replicas sharing the backend.

Methods

start()

Defined in: coordination/types.ts:168 Begin heartbeating/renewing (idempotent).

Returns

Promise<void>

stop()

Defined in: coordination/types.ts:170 Release every turn and leadership this replica holds and stop renewing (idempotent).

Returns

Promise<void>

reserve()

Defined in: coordination/types.ts:172 Reserve a place in key’s cross-replica FIFO. The bot calls it in ingress order.

Parameters

Returns

Promise<Ticket>

acquireTurn()

Defined in: coordination/types.ts:179 Wait until it is ticket’s turn (tickets of replicas that died are skipped), then hold the key. Rejects with LeaseLostError ('superseded') when the ticket was skipped because this replica was presumed dead, and with CoordinationUnavailableError on timeout or backend failure.

Parameters

Returns

Promise<ChatTurn>

lead()

Defined in: coordination/types.ts:181 Campaign for name until elected (or opts.signal aborts, rejecting).

Parameters

Returns

Promise<Leadership>

tryLead()

Defined in: coordination/types.ts:183 One election attempt: the leadership, or null when another replica leads.

Parameters

Returns

Promise<Leadership | null>

on()

Defined in: coordination/types.ts:185 Subscribe to coordinator events; returns an unsubscribe.

Type Parameters

Parameters

Returns

() => void