Interface: CallGroupHooks<P>
Defined in: packages/orchestration/src/calls/types.ts:141
Host hooks. tx is the store's handle on the transaction the group's row
lock is held in (PostgresCallGroupStore: the connection running it).
Write the wake through it and the wake commits with the stamp, or neither does.
Type Parameters
P
P = unknown
Methods
coordinatorState()
coordinatorState(
group,tx):Promise<CoordinatorState>
Defined in: packages/orchestration/src/calls/types.ts:176
Asked only when a wake was not taken. gone (deleted, done, stopped)
closes the group; paused or active (its queue is full) is offered the
return again later, behind every other group.
Parameters
group
tx
unknown
Returns
Promise<CoordinatorState>
dispatch()
dispatch(
call,group):Promise<CallDispatch>
Defined in: packages/orchestration/src/calls/types.ts:146
Dispatch one call. Must be idempotent per call.id — a retry (another
instance, the sweep) is the same work and must name the same ticket.
Parameters
call
Call<P>
group
Returns
Promise<CallDispatch>
isHeld()?
optionalisHeld(call):Promise<"open"|"none"|"closed">
Defined in: packages/orchestration/src/calls/types.ts:160
A dispatched call with no chain yet may be held (for credit, say): open
while it waits, closed once the hold resolved. Read before the chain is
read again, so a ticket the hold's release created is never missed.
Default none.
Parameters
call
Call<P>
Returns
Promise<"open" | "none" | "closed">
isParked()?
optionalisParked(link,call):boolean|Promise<boolean>
Defined in: packages/orchestration/src/calls/types.ts:153
Whether a link is parked at its spend ceiling. Default: link.parked.
Parameters
link
call
Call<P>
Returns
boolean | Promise<boolean>
onError()?
optionalonError(context,error):void
Defined in: packages/orchestration/src/calls/types.ts:178
A dispatch, settlement or return that threw. The call or group stays where it was and the sweep retries it.
Parameters
context
callId?
string
groupId
string
phase
"dispatch" | "settle" | "return"
error
unknown
Returns
void
readChain()?
optionalreadChain(call):Promise<CallChainLink[]>
Defined in: packages/orchestration/src/calls/types.ts:151
The call's chain, oldest first. Default: the root ticket read from the
tickets store passed to createCallGroups (a call is one ticket).
Parameters
call
Call<P>
Returns
Promise<CallChainLink[]>
rootOf()?
optionalrootOf(ticketId):Promise<string|null>
Defined in: packages/orchestration/src/calls/types.ts:165
The root ticket of a ticket a call's chain may contain, for
settleForTicket. Default: the ticket is its own root.
Parameters
ticketId
string
Returns
Promise<string | null>
wake()
wake(
signal,tx):Promise<boolean>
Defined in: packages/orchestration/src/calls/types.ts:170
Wake the coordinator. Return true when it has the signal — including when
an identical one (same ref) is already waiting for it.
Parameters
signal
tx
unknown
Returns
Promise<boolean>