IdentifyCoordinator
Defined in: packages/sharding/src/identify.ts:69
Hands out IDENTIFY slots for a whole deployment. Every cluster asks the
parent, so the limit holds across processes: one IDENTIFY per rate-limit key
per interval, and no more IDENTIFYs than session_start_limit.remaining.
It only does arithmetic on timestamps and holds one timer, so it can be
tested with a fake clock.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new IdentifyCoordinator(
options?):IdentifyCoordinator
Defined in: packages/sharding/src/identify.ts:87
Parameters
Section titled “Parameters”options?
Section titled “options?”IdentifyCoordinatorOptions = {}
Returns
Section titled “Returns”IdentifyCoordinator
Properties
Section titled “Properties”maxConcurrency
Section titled “maxConcurrency”
readonlymaxConcurrency:number
Defined in: packages/sharding/src/identify.ts:70
Accessors
Section titled “Accessors”holding
Section titled “holding”Get Signature
Section titled “Get Signature”get holding():
number
Defined in: packages/sharding/src/identify.ts:136
Slots granted and not yet released.
Returns
Section titled “Returns”number
remaining
Section titled “remaining”Get Signature
Section titled “Get Signature”get remaining():
number|undefined
Defined in: packages/sharding/src/identify.ts:124
Slots left in the session budget, or undefined when it is unknown.
Returns
Section titled “Returns”number | undefined
waiting
Section titled “waiting”Get Signature
Section titled “Get Signature”get waiting():
number
Defined in: packages/sharding/src/identify.ts:129
Requests waiting for a slot.
Returns
Section titled “Returns”number
Methods
Section titled “Methods”acquire()
Section titled “acquire()”acquire(
owner,shardId):Promise<void>
Defined in: packages/sharding/src/identify.ts:147
Waits for the shard’s turn. Resolves when the shard may IDENTIFY now;
call release once it has. Rejects if owner is dropped or the
coordinator closes first.
Parameters
Section titled “Parameters”number
shardId
Section titled “shardId”number
Returns
Section titled “Returns”Promise<void>
close()
Section titled “close()”close():
void
Defined in: packages/sharding/src/identify.ts:210
Rejects every waiter and stops the timer.
Returns
Section titled “Returns”void
drop()
Section titled “drop()”drop(
owner,reason?):void
Defined in: packages/sharding/src/identify.ts:190
A cluster is gone: forget its waiting requests and free the slots it held.
Parameters
Section titled “Parameters”number
reason?
Section titled “reason?”string = "The cluster went away."
Returns
Section titled “Returns”void
pump()
Section titled “pump()”pump():
void
Defined in: packages/sharding/src/identify.ts:225
Grants every slot that is due and arms one timer for the next. Called internally and by tests after moving the clock.
Returns
Section titled “Returns”void
release()
Section titled “release()”release(
owner,shardId):void
Defined in: packages/sharding/src/identify.ts:161
The shard has sent its IDENTIFY: its key rests for one interval. Ignored unless owner holds the slot.
Parameters
Section titled “Parameters”number
shardId
Section titled “shardId”number
Returns
Section titled “Returns”void