/** * Simple lock class. * * Use in a try/finally block, calling `release()` in the `finally` block to guarantee the lock is released in any circumstance. */ export declare class Lock { private waiters; private mLocked; get locked(): boolean; /** * Acquires the lock; returns a promise that resolves when the lock is acquired. * If the lock is already acquired, the Promise is put into a FIFO waiting list, and resolved when all the * previously acquired locks are released. */ acquire(): Promise; /** * Released the lock. * * @throws ApplicationError if the called when the lock was */ release(): void; } /** * Manages a number of locks indexed by a string `key`. * Locks are deleted once they are released, thus the memory occupation is always proportional to the * number of currently locked locks. */ export declare class LockManager { private locks; /** * Acquires the lock indexed by `key`. * * @param key */ acquire(key: string): Promise; /** * Releases the lock indexed by `key`. * * @param key */ release(key: string): void; /** * Acquires the lock indexed by `key` and runs `func`. * Resolves to the value to which `func` resolves to, or rejects with the same error. * Releases the lock once `func` is resolved or rejected. * * @param key * @param func */ withLock(key: string, func: () => Promise): Promise; } //# sourceMappingURL=lock.d.ts.map