Interface: PlanLockFactory
Defined in: src/batteries/orchestration/locks.ts:140
Creates and restores PlanLock instances for a deployment.
A BYO seam: a consumer can satisfy it with Verrou directly (memory / Redis / Postgres drivers) or with anything else; the battery adds no dependency. Supplying a factory makes concurrent execution UNLIKELY rather than impossible — it does not fence, and a partitioned holder can still double-invoke a node (see the module docs).
Methods
createLock()
createLock(key: string, ttl?: string | number): PlanLock;Defined in: src/batteries/orchestration/locks.ts:145
Create a new lease for key, with an optional TTL (a number of milliseconds or a duration string). The lease is not acquired until acquire/acquireImmediately/run is called.
Parameters
| Parameter | Type |
|---|---|
key | string |
ttl? | string | number |
Returns
restoreLock()
restoreLock(serialized: string): PlanLock;Defined in: src/batteries/orchestration/locks.ts:154
Rehydrate a lease from a string produced by PlanLock.serialize.
Exists so a lease can be handed from the process that started a run to the one resuming it, letting the resuming process continue holding the same lease rather than racing to re-acquire it. The restored lock must behave as the original for the remainder of its TTL.
Parameters
| Parameter | Type |
|---|---|
serialized | string |