/** * Semaphore: Concurrency Limiter * * Limits concurrent operations to prevent resource exhaustion. * * @module utils/semaphore */ import { VeryfrontError } from "../errors/types.js"; /** * Thrown when a semaphore acquire exceeds its configured timeout. * * Extends {@link VeryfrontError} so it carries registry slug/status/category * and RFC-9457 fields, while remaining `instanceof SemaphoreTimeoutError` for * existing catch sites. */ export declare class SemaphoreTimeoutError extends VeryfrontError { constructor(name: string, timeoutMs: number); } export declare class Semaphore { private permits; private readonly maxPermits; private readonly waiting; private readonly acquireTimeoutMs; private readonly semaphoreName; constructor(maxPermits: number, options?: { acquireTimeoutMs?: number; name?: string; }); /** Acquire permit, execute operation, release automatically */ acquire(operation: () => Promise): Promise; private waitForPermit; private release; get active(): number; get waitingCount(): number; } export declare function getSemaphore(name: string, maxPermits: number, options?: { acquireTimeoutMs?: number; }): Semaphore; //# sourceMappingURL=semaphore.d.ts.map