Skip to main content
Defined in: coordination/MemoryCoordinator.ts:151

Implements

Constructors

Constructor

Defined in: coordination/MemoryCoordinator.ts:159

Parameters

Returns

MemoryCoordinator

Properties

replicaId

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

Implementation of

Coordinator.replicaId

Methods

start()

Defined in: coordination/MemoryCoordinator.ts:164 Begin heartbeating/renewing (idempotent).

Returns

Promise<void>

Implementation of

Coordinator.start

stop()

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

Returns

Promise<void>

Implementation of

Coordinator.stop

crash()

Defined in: coordination/MemoryCoordinator.ts:187 Simulate this replica dying without cleaning up: it stops counting as alive, so its tickets are skipped and its turns and leaderships are handed over, and every signal it holds aborts with 'expired' (what its watchdog would do once the lease lapsed).

Returns

void

reserve()

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

Parameters

Returns

Promise<Ticket>

Implementation of

Coordinator.reserve

acquireTurn()

Defined in: coordination/MemoryCoordinator.ts:217 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>

Implementation of

Coordinator.acquireTurn

lead()

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

Parameters

Returns

Promise<Leadership>

Implementation of

Coordinator.lead

tryLead()

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

Parameters

Returns

Promise<Leadership | null>

Implementation of

Coordinator.tryLead

on()

Defined in: coordination/MemoryCoordinator.ts:275 Subscribe to coordinator events; returns an unsubscribe.

Type Parameters

Parameters

Returns

() => void

Implementation of

Coordinator.on