Class: InMemorySpendDayStore
Defined in: packages/agentos/src/safety/runtime/SpendReservations.ts:383
A store held in memory, for tests and for one process that admits one reservation at a time. It takes no lock, so two admissions awaited at once can both read the same total; a service that admits concurrently implements SpendDayStore on tables whose day row its transaction locks. It holds fenced and operation reservations, and each of its operation methods reads and writes its rows in one step on the event loop, before it awaits anything.
Implements
Constructors
Constructor
new InMemorySpendDayStore():
InMemorySpendDayStore
Returns
InMemorySpendDayStore
Properties
fencedReservations
readonlyfencedReservations:true
Defined in: packages/agentos/src/safety/runtime/SpendReservations.ts:385
It holds fenced reservations.
Implementation of
SpendDayStore.fencedReservations
operationReservations
readonlyoperationReservations:true
Defined in: packages/agentos/src/safety/runtime/SpendReservations.ts:387
It holds operation reservations.
Implementation of
SpendDayStore.operationReservations
Methods
addFencedReservation()
addFencedReservation(
reservation):Promise<string>
Defined in: packages/agentos/src/safety/runtime/SpendReservations.ts:402
Records a reservation made with requireFence and adds it to its day's open total.
Parameters
reservation
created
Date
day
string
expires
Date
kind
string
micro
number
Returns
Promise<string>
Implementation of
SpendDayStore.addFencedReservation
addOperationReservation()
addOperationReservation(
row):Promise<string|null>
Defined in: packages/agentos/src/safety/runtime/SpendReservations.ts:462
Records an operation's row and run 1, or answers null when the operation has one. The check and the record are one synchronous step, so of two admissions of one operation made at once, one records the row.
Parameters
row
created
Date
day
string
expires
Date
kind
string
leaseUntil
Date
micro
number
operation
string