UNPKG

@apiratorjs/locking

Version:

A lightweight library providing both local and distributed locking primitives (mutexes and semaphores) for managing concurrency in Node.js.

20 lines 908 B
import { AcquireParams, DistributedSemaphoreConstructorProps, DistributedSemaphoreFactory, IDistributedSemaphore, IReleaser } from "./types"; export declare class DistributedSemaphore implements IDistributedSemaphore { static factory: DistributedSemaphoreFactory; private readonly _implementation; constructor(props: DistributedSemaphoreConstructorProps); get isDestroyed(): boolean; runExclusive<T>(fn: () => Promise<T> | T): Promise<T>; runExclusive<T>(params: AcquireParams, fn: () => Promise<T> | T): Promise<T>; destroy(): Promise<void>; get name(): string; get maxCount(): number; get implementation(): string; freeCount(): Promise<number>; acquire(params?: { timeoutMs?: number; }): Promise<IReleaser>; cancelAll(errMessage?: string): Promise<void>; isLocked(): Promise<boolean>; } //# sourceMappingURL=distributed-semaphore.d.ts.map