Skip to main content

Class: InMemorySlotStore

Defined in: packages/orchestration/src/concurrency/slots.ts:39

Slots in this process's memory (a single long-lived process, tests).

Implements​

Constructors​

Constructor​

new InMemorySlotStore(now?): InMemorySlotStore

Defined in: packages/orchestration/src/concurrency/slots.ts:42

Parameters​

now?​

() => number

Returns​

InMemorySlotStore

Methods​

acquire()​

acquire(scope, holder, limit, leaseMs): Promise<boolean>

Defined in: packages/orchestration/src/concurrency/slots.ts:53

Take a slot in scope for holder if fewer than limit live leases hold it (a lease past its expiry does not count). Idempotent for a holder that already holds one. Resolves whether the holder now has a slot.

Parameters​

scope​

string

holder​

string

limit​

number

leaseMs​

number

Returns​

Promise<boolean>

Implementation of​

SlotStore.acquire


count()​

count(scope): Promise<number>

Defined in: packages/orchestration/src/concurrency/slots.ts:74

Live leases in the scope.

Parameters​

scope​

string

Returns​

Promise<number>

Implementation of​

SlotStore.count


release()​

release(scope, holder): Promise<void>

Defined in: packages/orchestration/src/concurrency/slots.ts:69

Give the slot back. A no-op when the holder holds none.

Parameters​

scope​

string

holder​

string

Returns​

Promise<void>

Implementation of​

SlotStore.release


renew()​

renew(scope, holder, leaseMs): Promise<boolean>

Defined in: packages/orchestration/src/concurrency/slots.ts:61

Extend the holder's lease. Resolves false when it no longer holds one (it expired and was taken).

Parameters​

scope​

string

holder​

string

leaseMs​

number

Returns​

Promise<boolean>

Implementation of​

SlotStore.renew