1 | /** @module lock */
|
2 | import { ILock } from './ILock';
|
3 | /**
|
4 | * Dummy lock implementation that doesn't do anything.
|
5 | *
|
6 | * It can be used in testing or in situations when lock is required
|
7 | * but shall be disabled.
|
8 | *
|
9 | * @see [[ILock]]
|
10 | */
|
11 | export declare class NullLock implements ILock {
|
12 | /**
|
13 | * Makes a single attempt to acquire a lock by its key.
|
14 | * It returns immediately a positive or negative result.
|
15 | *
|
16 | * @param correlationId (optional) transaction id to trace execution through call chain.
|
17 | * @param key a unique lock key to acquire.
|
18 | * @param ttl a lock timeout (time to live) in milliseconds.
|
19 | * @param callback callback function that receives a lock result or error.
|
20 | */
|
21 | tryAcquireLock(correlationId: string, key: string, ttl: number, callback: (err: any, result: boolean) => void): void;
|
22 | /**
|
23 | * Makes multiple attempts to acquire a lock by its key within give time interval.
|
24 | *
|
25 | * @param correlationId (optional) transaction id to trace execution through call chain.
|
26 | * @param key a unique lock key to acquire.
|
27 | * @param ttl a lock timeout (time to live) in milliseconds.
|
28 | * @param timeout a lock acquisition timeout.
|
29 | * @param callback callback function that receives error or null for success.
|
30 | */
|
31 | acquireLock(correlationId: string, key: string, ttl: number, timeout: number, callback: (err: any) => void): void;
|
32 | /**
|
33 | * Releases prevously acquired lock by its key.
|
34 | *
|
35 | * @param correlationId (optional) transaction id to trace execution through call chain.
|
36 | * @param key a unique lock key to release.
|
37 | * @param callback callback function that receives error or null for success.
|
38 | */
|
39 | releaseLock(correlationId: string, key: string, callback?: (err: any) => void): void;
|
40 | }
|