import { type BigIntStats } from "node:fs"; import { type FileHandle } from "node:fs/promises"; import type { ProcessIncarnation, SameProcessIncarnation } from "./process-incarnation.js"; declare const OWNER_PUBLICATION_IN_PROGRESS: unique symbol; interface Identity { readonly dev: bigint; readonly ino: bigint; } interface BaseOwner { readonly schema: string; readonly pid: number; readonly token: string; readonly createdAt: string; readonly incarnation: ProcessIncarnation; } interface Owner { readonly pid: number; readonly incarnation?: ProcessIncarnation; readonly content: string; readonly identity: Identity; } interface PublicationPin { readonly handle: FileHandle; readonly details: BigIntStats; readonly content: Buffer; closed: boolean; } type Observed = { readonly kind: "ownerless"; readonly identity: Identity; readonly mtimeMs: number; readonly [OWNER_PUBLICATION_IN_PROGRESS]?: PublicationPin; } | { readonly kind: "owned"; readonly identity: Identity; readonly owner: Owner; }; interface ArtifactInput { readonly path: string; readonly pid: number; readonly now: number; readonly token: string; } export interface OwnerPrivateLockOptions { readonly path: string; readonly label: string; readonly schemaTag: string; readonly ownerlessGraceMs: number; readonly waitTimeoutMs?: number; readonly pollIntervalMs?: number; readonly maxAcquireAttempts?: number; readonly pid?: number; readonly now?: () => number; readonly randomToken?: () => string; readonly processIncarnation?: ProcessIncarnation; readonly isSameProcessIncarnation?: SameProcessIncarnation; readonly isLegacyProcessAlive?: (pid: number) => boolean | Promise; /** Platform and directory-sync seams for filesystems which cannot fsync directories. */ readonly platform?: NodeJS.Platform; readonly syncDirectoryHandle?: (handle: FileHandle) => Promise; readonly ownerFields?: (base: BaseOwner) => Readonly>; readonly validateOwnerFields?: (record: Readonly>) => boolean; readonly parseLegacyOwner?: (record: Readonly>) => { readonly pid: number; readonly incarnation?: ProcessIncarnation; } | undefined; /** Transitional compatibility for an accepted legacy record written before owner-only mode was enforced. */ readonly allowCurrentUserLegacyOwnerMode?: boolean; readonly invalidOwner?: "ownerless" | "error"; readonly livenessError?: (error: unknown, owner: Owner) => "assume-live" | Error; readonly beforeIteration?: () => void; readonly afterDirectoryCreated?: (path: string) => void | Promise; readonly afterInspected?: (observed: Observed) => void | Promise; readonly beforeStaleRename?: (path: string) => void | Promise; readonly isSatisfied?: () => boolean | Promise; readonly sleep?: (milliseconds: number) => Promise; readonly stalePath?: (input: ArtifactInput) => string; readonly releasedPath?: (input: ArtifactInput) => string; readonly abandonedPath?: (input: ArtifactInput) => string; readonly staleRace?: "retry" | "return" | "error"; readonly timeoutError?: (observed: Observed) => Error | undefined; readonly unsafeError?: (cause: string, details?: Readonly>) => Error; } export interface OwnerPrivateLock { readonly path: string; readonly ownerPid: number; release(options?: { readonly beforeRename?: (path: string) => void | Promise; }): Promise; } export declare function validateOwnerPrivateLockInputs(label: string, pid: number, ownerlessGraceMs: number): void; /** Shared private-directory lock with atomic ownership, liveness, quarantine, and exact release. */ export declare function acquireOwnerPrivateLock(options: OwnerPrivateLockOptions): Promise; export {}; //# sourceMappingURL=owner-private-lock.d.ts.map