UNPKG

zephyr-agent

Version:
21 lines • 1.03 kB
import { type LockOptions } from '@bybrave/proper-lockfile2'; /** * What to do when the lock cannot be acquired. * * - `throw` (default) surfaces the acquisition error. * - `proceed` runs the action unlocked. Only correct when losing coordination duplicates * work instead of corrupting state. */ export type StorageLockUnavailableBehavior = 'throw' | 'proceed'; export interface StorageLockOptions { /** Crash-recovery threshold after which an unrefreshed lock is considered abandoned. */ staleMs?: number; /** Acquisition retry budget. */ retries?: LockOptions['retries']; whenUnavailable?: StorageLockUnavailableBehavior; } /** Resolve the stable lock anchor for a named storage lock. */ export declare function getStorageLockPath(name: string): string; /** Run an operation under a crash-recoverable inter-process storage lock. */ export declare function withStorageLock<T>(name: string, action: () => Promise<T>, options?: StorageLockOptions): Promise<T>; //# sourceMappingURL=storage-lock.d.ts.map