Retrieves semaphore configuration by key. Returns the limit (max concurrent slots) or null if semaphore doesn't exist.
Readable execution context for the operation
The semaphore identifier (e.g., "api-rate-limit", "db-connection-pool")
Semaphore config with limit, or null if not found
Retrieves all active slots (acquired requests) for a semaphore. Returns empty array if semaphore has no slots or doesn't exist. Includes expired slots (not auto-cleaned until explicitly removed).
Readable execution context for the operation
The semaphore identifier
Array of slot data with ids and expirations
Creates new semaphore or updates existing semaphore limit. Idempotent: calling multiple times with same limit is safe.
Readable execution context for the operation
The semaphore identifier
Maximum number of concurrent slots
Void (always succeeds)
Creates new slot or updates existing slot expiration. Called when a request acquires a slot (with expiration time). Idempotent: updating same slot's expiration is safe.
Readable execution context for the operation
The semaphore identifier
Unique slot identifier (generated by consumer)
When slot expires and becomes available again, or null for no expiration
Void (always succeeds)
Transaction context for atomic semaphore operations. Provides methods to read and modify semaphore state within a database transaction.
All transaction methods must be executed together atomically. The database guarantees isolation (race-condition free) for all operations.
IMPORT_PATH:
"@daiso-tech/core/semaphore/contracts"