Skip to content

InMemoryLease

Defined in: src/coordination/leases/InMemoryLease.ts:53

Reference Lease implementation backed by the shared in-memory store. Useful for tests and single-process development. The store is a plain JS Map, so it is NOT appropriate for multi-process deployments — use KubernetesLease for that.

new InMemoryLease(settings): InMemoryLease

Defined in: src/coordination/leases/InMemoryLease.ts:59

LeaseSettings

InMemoryLease

acquire(): Promise<boolean>

Defined in: src/coordination/leases/InMemoryLease.ts:63

Try to acquire the lease. Resolves true on success, false on contention.

Promise<boolean>

Lease.acquire


checkAlive(): boolean

Defined in: src/coordination/leases/InMemoryLease.ts:85

True if this process currently owns the lease. Purely local — no IO.

boolean

Lease.checkAlive


onLost(handler): () => void

Defined in: src/coordination/leases/InMemoryLease.ts:87

Register a handler fired when ownership is lost unexpectedly.

(reason) => void

() => void

Lease.onLost


release(): Promise<void>

Defined in: src/coordination/leases/InMemoryLease.ts:78

Release the lease voluntarily. No-op if not held.

Promise<void>

Lease.release