import type { LowSync } from 'lowdb'; import type { Flow, OpState, FlowState } from '@nosana/sdk'; import type { NodeDb, ResourceHistory, VolumeResource } from '../db/index.js'; export declare class NodeRepository { private db; constructor(db: LowSync); private lastPersistError?; private lastPersistReportAt; /** * Write the database to disk, reporting rather than throwing when it cannot. * * lowdb writes synchronously, so a disk fault throws into container handlers, * where it escapes uncaught, and into the awaited flow paths, where it fails * the operation. The in-memory update is already applied, so only durability * depends on this. */ private persist; getFlow(id: string): Flow; getFlows(): { [key: string]: Flow; }; setflow(id: string, flow: Flow): void; deleteflow(id: string): void; addOpstate(id: string, opstate: OpState): void; getFlowState(id: string): FlowState; updateflowState(id: string, updatedFields: Partial): void; updateflowStateSecret(id: string, updatedFields: { [key: string]: any; }): void; getFlowSecret(id: string, key: string): any | undefined; updateflowStateError(id: string, { status, error, }: { status?: string; error: Error | unknown; }): void; /** Undefined once the flow is gone: container handlers outlive it. */ private opStateFor; /** The diagnostics, filled in for an op state stored without them. */ private diagnosticsFor; getOpState(id: string, index: number): OpState | undefined; updateOpState(id: string, opIndex: number, updatedFields: Partial): void; updateOpStateExitCode(id: string, opIndex: number, exitCode: number): void; updateOpStateLogs(id: string, opIndex: number, log: any): void; setOpStateDiagnosticsReason(id: string, opIndex: number, reason: Partial): void; setOpStateDiagnosticsState(id: string, opIndex: number, state: OpState['diagnostics']['state']): void; updateOpStateError(id: string, opIndex: number, error: { event: string; message: string; code?: number; }): void; updateNodeInfo(updatedFields: Partial): void; getNodeInfo(): NodeDb['info']; getImagesResources(): { [key: string]: ResourceHistory; }; getImageResource(image: string): ResourceHistory; createImageResource(image: string, fields: ResourceHistory): void; updateImageResource(image: string, updatedFields: Partial | ResourceHistory): void; deleteImageResource(image: string): void; getVolumesResources(): { [key: string]: VolumeResource; }; getVolumeResource(volume: string): VolumeResource; createVolumeResource(volume: string, fields: VolumeResource): void; updateVolumeResource(volume: string, updatedFields: Partial | VolumeResource): void; deleteVolumeResource(volume: string): void; displayLog(log: string): string; getFlowOperationName(id: string, index: number): string; }