import { unlink } from 'node:fs/promises'; import type { BackupLockHolder } from '../../application/ports/outbound/IWorldBackupPort.js'; /** The lock file content: who holds it. `op` names the operation. */ export type FileLockHolder = Omit & { op: string; }; export type FileLock = { ok: true; release: () => Promise; } | { ok: false; holder?: FileLockHolder; }; export type BackupLock = { ok: true; release: () => Promise; } | { ok: false; holder?: BackupLockHolder; }; /** Unlink of the lock file in release(); tests replace it to interleave a takeover. */ export declare const lockFsOps: { unlink: typeof unlink; }; export declare function acquireBackupLock(root: string, op: BackupLockHolder['op'], options?: { waitMs?: number; pollMs?: number; }): Promise; /** * Take `lockPath` (its directory must exist), waiting up to `waitMs` for the * holder; `{ ok: false, holder }` when it is still held. */ export declare function acquireFileLock(lockPath: string, op: string, options?: { waitMs?: number; pollMs?: number; }): Promise; //# sourceMappingURL=lock.d.ts.map