/** * Exclusive file lock for preventing multiple processes from * accessing the same database simultaneously. * * Uses atomic file creation with O_EXCL flag to ensure only one * process can acquire the lock at a time. */ export declare class FileLock { private locked; private readonly filePath; private readonly timeoutMs; constructor(filePath: string, timeoutMs?: number); /** * Acquire an exclusive lock on the file. * Creates the lock file if it doesn't exist. * Retries for up to timeoutMs before throwing DatabaseLockedError. */ acquire(): Promise; /** * Release the lock by deleting the lock file. */ release(): Promise; /** * Check if this instance currently holds the lock. */ isLocked(): boolean; /** * Check if an existing lock file is stale (owning process is dead). * Returns true if the lock appears stale and should be recovered. */ private isLockStale; } /** * Error thrown when attempting to open a database that is * already locked by another process. */ export declare class DatabaseLockedError extends Error { constructor(message: string); } /** * Error thrown when attempting to write to a database opened in read-only mode. */ export declare class ReadOnlyError extends Error { constructor(message?: string); } /** * Error thrown when the lock file cannot be created due to permission issues. * This typically happens in read-only filesystems or restricted environments * like production containers. */ export declare class LockPermissionError extends Error { readonly lockPath: string; readonly originalError?: Error | undefined; constructor(lockPath: string, originalError?: Error | undefined); } //# sourceMappingURL=file-lock.d.ts.map