rulvar API reference / @rulvar/plan / PlanWriteLock
Class: PlanWriteLock
Defined in: packages/plan/src/write-lock.ts:15
PlanWriteLock (M7-T01): the in-process FIFO mutex serializing live appends to the sequential scope "plan".
Owning contract: https://docs.rulvar.com/guide/adaptive-orchestration (DEF-8, XF-07). The lock serializes ONLY plan-scope appends (acquire, read the fold head, evaluate, append, release); it MUST NOT substitute for resolution arbitration, which is owned by the ResolutionArbiter (DEF-4). In queue mode the lease fencing epoch applies on top. Wall clock influences only WHICH order gets recorded live; replay reads the recorded order and never takes the lock.
Constructors
Constructor
new PlanWriteLock(): PlanWriteLock;Returns
PlanWriteLock
Accessors
isHeld
Get Signature
get isHeld(): boolean;Defined in: packages/plan/src/write-lock.ts:20
True while a critical section is running (diagnostics only).
Returns
boolean
Methods
runExclusive()
runExclusive<T>(fn): Promise<T>;Defined in: packages/plan/src/write-lock.ts:29
Runs fn exclusively, in strict acquisition (FIFO) order. The lock releases on settlement either way; a rejection propagates to THIS caller and never poisons later acquisitions.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
fn | () => T | Promise<T> |
Returns
Promise<T>