Attempts to acquire a slot in the semaphore. Succeeds only if the current number of acquired slots has not reached the limit.
Promise resolving to true if the slot was successfully acquired, false if the slot limit has been reached
Forcibly releases all slots for the specified semaphore 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 the semaphore existed and slots were released, false if the semaphore doesn't exist or has no acquired slots
Retrieves the current state of a semaphore.
Promise resolving to the non-expired semaphore state if it exists; otherwise null for missing or expired semaphores
Refreshes (extends) the time-to-live of an existing 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
Releases a specific slot if it is currently acquired. Only the holder of the slot (identified by slotId) can release it.
Promise resolving to true if the slot was successfully released, false if the slot doesn't exist or is already released
The
NoOpSemaphoreAdapterwill do nothing and is used for easily mockingISemaphoreFactoryfor testing.IMPORT_PATH:
"@daiso-tech/core/semaphore/no-op-semaphore-adapter"