Atomic file lease and storage synchronization service.
Remarks
Architecture & Concurrency Guarantees
Atomic .lease Protocol: A lease is written to a temporary file and published with
link, which fails when the lease exists. A lease is therefore never observable empty.
Ownership Tokens: Every lease file contains { token: UUID, pid: number, createdAt: number }.
Token checks ensure a process releases or reclaims only the lease it genuinely owns.
Renewal: The holder renews the lease's modification time every LEASE_RENEW_MS.
Stale Reclamation: A lease is stale when its owner PID is dead, when it was not renewed
for LEASE_MAX_AGE_MS (a reused PID cannot keep a dead owner's lease alive), or when it is
unreadable and older than UNREADABLE_LEASE_GRACE_MS. Reclamation renames the lease aside,
confirms it is the one judged stale and otherwise restores it.
In-Process Queue Serialization: Serializes async operations targeting the same canonical
resource path within the Node runtime using promise chaining, preventing unnecessary OS filesystem thrashing.
Atomic file lease and storage synchronization service.
Remarks
Architecture & Concurrency Guarantees
.leaseProtocol: A lease is written to a temporary file and published withlink, which fails when the lease exists. A lease is therefore never observable empty.{ token: UUID, pid: number, createdAt: number }. Token checks ensure a process releases or reclaims only the lease it genuinely owns.LEASE_RENEW_MS.LEASE_MAX_AGE_MS(a reused PID cannot keep a dead owner's lease alive), or when it is unreadable and older thanUNREADABLE_LEASE_GRACE_MS. Reclamation renames the lease aside, confirms it is the one judged stale and otherwise restores it.