/** * Distributed Semaphore * * Provides concurrency control using the StorageAdapter interface. * Each concurrent execution acquires a "ticket" stored in the backend. * Active tickets tracked via atomic counter + individual ticket keys with TTL. */ import type { StorageAdapter } from '@frontmcp/utils'; import type { SemaphoreTicket } from './types'; export declare class DistributedSemaphore { private readonly storage; private readonly ticketTtlSeconds; constructor(storage: StorageAdapter, ticketTtlSeconds?: number); /** * Attempt to acquire a concurrency slot. * * @returns A SemaphoreTicket if acquired, or null if rejected * @throws QueueTimeoutError if queued and timeout expires */ acquire(key: string, maxConcurrent: number, queueTimeoutMs: number, entityName: string): Promise; private tryAcquire; private release; private waitForSlot; getActiveCount(key: string): Promise; forceReset(key: string): Promise; }