import { type WorkflowRunStore, type WorkflowRunSummary } from "../../core/workflow-run-store.js"; import type { WorkflowRun, WorkflowRunStatus } from "../../orchestration/workflow.js"; export interface FileWorkflowRunStoreOptions { /** When false, a ledger append is NOT fsync'd (the observability store is non-engine-critical). Default true. */ fsync?: boolean; /** Compact the ledger into a snapshot once it exceeds this many events (then truncate). Default 1000. */ compactEvery?: number; } export declare class FileWorkflowRunStore implements WorkflowRunStore { private readonly dir; private readonly tmpDir; private readonly ledgerPath; private readonly snapshotPath; private readonly fsyncEnabled; private readonly compactEvery; /** Authoritative in-memory state (replayed at boot). The CAS reads/writes THIS; disk is the durable log. */ private readonly runs; /** Per-id async mutex chain (identical shape to `FileCheckpointStore.locks`). */ private readonly locks; /** Number of events appended to the live ledger since the last compaction (drives auto-compaction). */ private ledgerEvents; private log; constructor(root: string, opts?: FileWorkflowRunStoreOptions); /** Rebuild the authoritative map: snapshot first (the compacted base), then the live ledger's events. */ private replay; /** Fold one ledger event into the authoritative map (last-writer-wins by event order). */ private applyEvent; /** * Serialize an op behind any in-flight op on the same id (the in-process per-id async mutex — the SAME * `Map` chain shape as `FileCheckpointStore.withLock`). A prior op's rejection never blocks * the chain (awaited `.catch`-guarded). The chain entry is GC'd once it is the settled tail. */ private withLock; /** Commit one ledger event (append + fsync) THEN flip the in-memory map (crash-safe ordering). */ private commit; put(id: string, run: WorkflowRun): Promise; get(id: string): Promise; update(id: string, scope: string, run: WorkflowRun, expect?: { rev: number; }): Promise; listByScope(scope: string, opts?: { status?: WorkflowRunStatus; limit?: number; }): Promise; reap(scope: string, now: number, opts?: { maxAgeMs?: number; keep?: number; }): Promise; /** Rewrite the snapshot from the current authoritative map (atomic) and truncate the live ledger. */ private compact; /** Force a compaction now (test/inspection). */ compactNow(): void; /** Test/inspection helper: number of stored runs. */ get size(): number; /** Release the append handle (best-effort). The boot LOCK is released by the backend factory. */ close(): void; } //# sourceMappingURL=workflow-run-store.d.ts.map