import { type OxigraphMemoryLimits } from '../oxigraph-memory-limits.js'; import type { ChildProcess, spawn, StdioOptions } from 'node:child_process'; import type { CgroupOomSnapshot } from './oxigraph-memory.js'; export { normalizeOxigraphMemoryLimits, type OxigraphMemoryLimits } from '../oxigraph-memory-limits.js'; export type ListenOwnerResolver = (child: ChildProcess, port: number, host: string, ownership?: 'child-only' | 'process-tree') => Promise; /** * One Oxigraph launch: its child process, and everything that depends on how * it was launched. Termination, listener ownership and OOM attribution are * captured per launch, so they cannot be applied with another launch's * semantics. */ export interface OxigraphLaunchHandle { readonly child: ChildProcess; /** Whether the child still runs: not exited, and not a failed spawn. */ alive(): boolean; /** * Signal the child and whatever it launched: its whole process group where * the launch leads one. Does nothing once the child has exited, so a * process-group id is never signalled after it could have been reused. */ terminate(signal: NodeJS.Signals): void; /** The PID that owns the listen socket, checked as far as this launch allows. */ resolveListenerPid(port: number, host: string, resolver: ListenOwnerResolver): Promise; /** Note one line of stderr: the scoped watchdog reports an OOM kill there. */ observeStderr(text: string): void; /** Take the listener's cgroup OOM counter once, as evidence for `classifyOomExit`. */ captureOomSnapshot(listenerPid: number, read: (pid: number) => CgroupOomSnapshot | null): void; /** Whether the child's exit was an OOM kill. */ classifyOomExit(exit: { code: number | null; signal: NodeJS.Signals | null; readOomKill: (dir: string) => number | null; }): boolean; } /** * How this host launches Oxigraph. There are three launches, told apart only * by what they do: on Windows the binary itself (listener ownership by the * child only); elsewhere the parent watchdog leading its own process group, * either unscoped or inside a systemd scope when memory limits are set. */ export interface OxigraphLaunchStrategy { /** Spawn Oxigraph through `spawnProcess` and return that launch's handle. */ launch(spawnProcess: typeof spawn, binaryPath: string, binaryArgs: string[], stdio: StdioOptions): OxigraphLaunchHandle; logSummary(): string | null; } export declare function createOxigraphLaunchStrategy(opts: { memoryLimits?: OxigraphMemoryLimits; platform: NodeJS.Platform; parentPid: number; uid: number; nodeExecutable?: string; watchdogPath?: string; }): OxigraphLaunchStrategy; //# sourceMappingURL=oxigraph-launch-strategy.d.ts.map