@microsoft.azure/async-io
Version:
Promisify'd asnyc wrappers (for Azure Open Source Projects)
26 lines (25 loc) • 913 B
TypeScript
import { Exception } from '@microsoft.azure/tasks';
export declare class UnableToReadLockException extends Exception {
exitCode: number;
constructor(path: string, exitCode?: number);
}
export interface UnlockOptions {
realpath?: boolean;
delay?: number;
}
export interface CheckOptions extends UnlockOptions {
stale?: number;
}
export interface LockOptions extends CheckOptions {
update?: number;
retries?: number;
}
export declare type release = () => Promise<void>;
export declare type _release = () => void;
export declare class Lock {
private static _exclusive;
static check: (path: string, options?: CheckOptions) => Promise<boolean>;
static exclusive(path: string, options?: LockOptions): Promise<release>;
static waitForExclusive(path: string, timeout?: number): Promise<release | null>;
static read(path: string, options?: LockOptions): Promise<release>;
}