Attempts to acquire a lock for the specified key. Succeeds only if the lock is currently expired or doesn't exist.
Unique identifier for the lock
Unique identifier for this acquirer (becomes the owner)
Time-to-live duration or null for indefinite locks
Readable execution context for the operation
Promise resolving to true if lock was successfully acquired, false if already held by another owner
Forcibly releases a lock regardless of ownership. Used for emergency lock release or administrative cleanup. Bypasses ownership verification for situations where the owner is unavailable.
Unique identifier for the lock
Readable execution context for the operation
Promise resolving to true if lock existed and was released, false if lock is already expired
Retrieves the current state of a lock.
Unique identifier for the lock
Readable execution context for the operation
Promise resolving to the non-expired lock state if it exists; otherwise null for missing or expired locks
Refreshes (extends) the time-to-live of an existing lock. Only succeeds if all conditions are met: ownership matches, lock hasn't expired, and it's expirable.
Unique identifier for the lock
Unique identifier of the lock owner
New time-to-live duration to set
Readable execution context for the operation
Promise resolving to true if refresh succeeded, false if lock is unexpirable, expired, or not owned by lockId
Releases a lock if owned by the specified lockId. Ownership verification prevents accidental release of locks held by others.
Unique identifier for the lock
Unique identifier of the lock owner
Readable execution context for the operation
Promise resolving to true if lock was successfully released, false if not owned by lockId or doesn't exist
Technology-agnostic adapter contract for managing distributed locks. Implementations handle lock acquisition, release, refresh, and state tracking independent of the underlying storage. Note: This contract is low-level and typically not used directly - prefer
ILockFactoryfor lock usage.IMPORT_PATH:
"@daiso-tech/core/lock/contracts"