Zum Inhalt springen
Deutsch

InMemoryLease

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

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

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:63

LeaseSettings

InMemoryLease

acquire(): Promise<boolean>

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

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

Promise<boolean>

Lease.acquire


acquireWithToken(): Promise<{ token: string; } | null>

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

Fencing-token variant: returns a monotonic version string scoped to this lease name. The token is <lease-name>@v<version> — suitable for use as an opaque identifier and ordered by parsing the trailing <version> integer.

Promise<{ token: string; } | null>

Lease.acquireWithToken


checkAlive(): boolean

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

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:102

Register a handler fired when ownership is lost unexpectedly.

(reason) => void

() => void

Lease.onLost


release(): Promise<void>

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

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

Promise<void>

Lease.release