import { type BootIdReader, type ProcessInspector } from './process-probe.js'; export declare const OXIGRAPH_OWNER_RECORD = "dkg-oxigraph-owner.json"; export declare const OXIGRAPH_OWNER_RECORD_SCHEMA = "dkg-oxigraph-owner/v1"; export interface ProcessIdentity { pid: number; /** Token from the platform's process start-time probe. */ start: string; } export interface OxigraphOwnerRecordV1 { schema: typeof OXIGRAPH_OWNER_RECORD_SCHEMA; /** * The boot the identities below were taken in: a PID and start time name a * process only within one boot. */ boot: string; daemon: ProcessIdentity; /** The spawned child: the parent watchdog, or Oxigraph itself. */ launcher: ProcessIdentity; /** Added once the launch is verified ready. */ oxigraph?: ProcessIdentity; binaryPath: string; } /** * What the store directory says about its owner: no record, content that is * not a v1 record, a record that exists but could not be read, or a record. */ export type OxigraphOwnerRecordRead = { kind: 'absent'; } | { kind: 'invalid'; } | { kind: 'unreadable'; reason: string; } | { kind: 'v1'; record: OxigraphOwnerRecordV1; }; /** * Whether a recorded process instance still runs. A PID that now names * another process (another start time) is `gone`; a failed read is * `unknown`, never `gone`. */ export type IdentityState = { state: 'running'; } | { state: 'gone'; } | { state: 'unknown'; reason: string; }; export declare function readOxigraphOwnerRecord(location: string): Promise; /** Whether `identity` still names a running process (same PID and start time). */ export declare function checkIdentity(identity: ProcessIdentity, inspect: ProcessInspector): Promise; /** One recorded launch. Its identities were read once, at spawn. */ export interface OxigraphLaunchRecord { /** Extend this launch's record with `oxigraphPid`, its verified listener. */ markReady(oxigraphPid: number): Promise; } /** * Record a spawned launch as the owner of a store: this daemon, the launcher * and the binary, each identified once (PID and start time). `markReady` * rewrites the same record with the verified Oxigraph added. The previous * launch's record is removed first, so a launch that cannot be recorded * leaves no record rather than an earlier launch's identities in force. The * store directory is created first, since a fresh store's directory may not * exist until Oxigraph opens it. Best-effort: a failed write is logged and * resolves, because without a record the reclaim falls back to the PID 1 * rule. Resolves to null when there can be no record for this launch: on * Windows, or when the launch could not be identified (logged). */ export declare function recordOxigraphLaunch(input: { location: string; binaryPath: string; launcherPid: number; /** The host the launch runs on: no record on Windows, and its process probe elsewhere. */ platform: NodeJS.Platform; log: (message: string) => void; /** Defaults to the platform's process probe. */ inspect?: ProcessInspector; /** Defaults to the platform's boot identifier. */ bootId?: BootIdReader; }): Promise; //# sourceMappingURL=oxigraph-owner-record.d.ts.map