Attempts to acquire a reader slot in the shared lock. Succeeds only if no non-expired writer lock is held and the current number of acquired reader slots has not reached the limit.
Promise resolving to true if the reader slot was successfully acquired, false if the slot limit has been reached
Attempts to acquire a writer lock for the specified key. Succeeds only if no non-expired writer lock exists and no non-expired reader slots are held.
Promise resolving to true if the writer lock was successfully acquired, false if already held by another owner
Forcibly releases both the writer lock and all reader slots regardless of ownership. Used for complete emergency cleanup of the shared lock.
Promise resolving to true if the shared lock existed and was fully released, false if the shared lock doesn't exist
Forcibly releases all reader slots for the specified shared lock regardless of ownership. Used for emergency cleanup or administrative operations. Bypasses ownership verification for situations where individual slot holders are unavailable.
Promise resolving to true if reader slots existed and were released, false if no reader slots are acquired
Forcibly releases a writer lock regardless of ownership. Used for emergency lock release or administrative cleanup. Bypasses ownership verification for situations where the owner is unavailable.
Promise resolving to true if the writer lock existed and was released, false if the lock is already expired
Retrieves the current state of a shared lock.
Promise resolving to the non-expired shared lock state if it exists; otherwise null for missing or expired shared locks
Refreshes (extends) the time-to-live of an existing reader slot. Only succeeds if all conditions are met: the slot exists, hasn't expired, and is expirable.
Promise resolving to true if refresh succeeded, false if the slot is unexpirable, expired, or doesn't exist
Refreshes (extends) the time-to-live of an existing writer lock. Only succeeds if all conditions are met: ownership matches, lock hasn't expired, and it's expirable.
Promise resolving to true if refresh succeeded, false if the lock is unexpirable, expired, or not owned by lockId
Releases a specific reader slot if it is currently acquired. Only the holder of the slot (identified by slotId) can release it.
Promise resolving to true if the reader slot was successfully released, false if the slot doesn't exist or is already released
Releases a writer lock if owned by the specified lockId. Ownership verification prevents accidental release of locks held by others.
Promise resolving to true if the writer lock was successfully released, false if not owned by lockId or doesn't exist
The
NoOpSharedLockAdapterwill do nothing and is used for easily mockingISharedLockFactoryfor testing.IMPORT_PATH:
"@daiso-tech/core/shared-lock/no-op-shared-lock-adapter"