Rulvar API reference / @rulvar/store-postgres / PostgresAdmissionScheduler
Class: PostgresAdmissionScheduler
Defined in: packages/store-postgres/src/admission.ts:48
Implements
Constructors
Constructor
new PostgresAdmissionScheduler(options): PostgresAdmissionScheduler;Defined in: packages/store-postgres/src/admission.ts:58
Parameters
| Parameter | Type |
|---|---|
options | PostgresAdmissionSchedulerOptions |
Returns
PostgresAdmissionScheduler
Methods
cancel()
cancel(
unitId,
generation,
opId): Promise<void>;Defined in: packages/store-postgres/src/admission.ts:216
Cancels a queued ticket (nothing to refund); granted ones release.
Parameters
| Parameter | Type |
|---|---|
unitId | string |
generation | string |
opId | string |
Returns
Promise<void>
Implementation of
checkpointCover()
checkpointCover(
unitId,
generation,
cover,
opId): Promise<void>;Defined in: packages/store-postgres/src/admission.ts:198
Durably checkpoints a consumption cover BEFORE the covered batch (the intent-before-effect doctrine applied to capacity): monotone high-water, idempotent by opId, and lease-carried: a fenced store rejects an expired lease's cover write, which is what makes the conservative expiry refund provable rather than optimistic.
Parameters
| Parameter | Type |
|---|---|
unitId | string |
generation | string |
cover | AdmissionReservation |
opId | string |
Returns
Promise<void>
Implementation of
AdmissionScheduler.checkpointCover
close()
close(): Promise<void>;Defined in: packages/store-postgres/src/admission.ts:111
Returns
Promise<void>
enqueue()
enqueue(request, opId): Promise<AdmissionTicketDecision>;Defined in: packages/store-postgres/src/admission.ts:186
Conditional create by (unitId, generation) plus immediate grant when every matched level admits; opId makes retries idempotent.
Parameters
| Parameter | Type |
|---|---|
request | AdmissionRequest |
opId | string |
Returns
Promise<AdmissionTicketDecision>
Implementation of
pump()
pump(opId): Promise<AdmissionTicket[]>;Defined in: packages/store-postgres/src/admission.ts:229
Advances the scheduler: expires stale leases (conservative settlement), then grants queued tickets in SFQ order while every matched level admits. Returns the newly granted tickets.
Parameters
| Parameter | Type |
|---|---|
opId | string |
Returns
Promise<AdmissionTicket[]>
Implementation of
rebind()
rebind(
unitId,
generation,
target,
opId): Promise<AdmissionTicketDecision>;Defined in: packages/store-postgres/src/admission.ts:220
The failover transfer (RFC section 4.2, item 4): atomically acquires the TARGET hierarchy's capacity and level-2 slot and releases the source hierarchy in the same transition, BEFORE the target dispatches. A failed transfer leaves the source binding unchanged and the target undispatchable: no window exists in which work runs on a provider account whose slot it never held.
Parameters
| Parameter | Type |
|---|---|
unitId | string |
generation | string |
target | { scope: AdmissionScopeDimensions; } |
target.scope | AdmissionScopeDimensions |
opId | string |
Returns
Promise<AdmissionTicketDecision>
Implementation of
recover()
recover(
unitId,
generation,
opId): Promise<AdmissionRecovery>;Defined in: packages/store-postgres/src/admission.ts:190
The resumed unit's recovery: granted renews the lease, a queued ticket reports its surviving position, and unknown means re-enqueue (the conservative direction).
Parameters
| Parameter | Type |
|---|---|
unitId | string |
generation | string |
opId | string |
Returns
Promise<AdmissionRecovery>
Implementation of
release()
release(
unitId,
generation,
actuals,
opId): Promise<void>;Defined in: packages/store-postgres/src/admission.ts:207
Release with actuals: the unused remainder refunds to each level, over-consumption beyond the reservation lands as bucket debt (it never denies retroactively), and a late settlement after expiry is accepted idempotently as debt rather than discarded.
Parameters
| Parameter | Type |
|---|---|
unitId | string |
generation | string |
actuals | AdmissionReservation |
opId | string |
Returns
Promise<void>
Implementation of
renew()
renew(
unitId,
generation,
opId): Promise<void>;Defined in: packages/store-postgres/src/admission.ts:194
Renews a granted ticket's lease; unknown tickets are no-ops.
Parameters
| Parameter | Type |
|---|---|
unitId | string |
generation | string |
opId | string |
Returns
Promise<void>