import type { SecurityEvents } from "../incident/SecurityEvents.js"; import type { ChainHead, HashChain } from "./HashChain.js"; /** The file operations the journal needs; the real filesystem unless a test injects one. */ export interface ChainJournalFs { mkdir(path: string): void; read(path: string): string | null; write(path: string, text: string): void; rename(from: string, to: string): void; } export interface ChainJournalOptions { /** How many links between persisted heads; the head is also persisted when the journal stops. */ readonly checkpointLines: number; readonly fs?: ChainJournalFs; } /** * Persists each chain's head under the journal directory, so a chain * continues across a restart within the life of the volume instead of * starting again from genesis. The head is written every N links and once * more when the journal stops; a process that dies between two checkpoints * resumes from the older head, and the verifier reports the overlap as a * sequence gap at the point of the crash rather than hiding it. The log * pipeline that keeps the lines is the durable store; this keeps the * sequence honest across restarts. */ export declare class ChainJournal { private readonly options; private readonly fs; private readonly directory; constructor(directory: string, options: ChainJournalOptions); /** The persisted head of a stream, or null when there is none or it is not one. */ restore(stream: string): ChainHead | null; /** Persists the chain's head every N links; the returned stop persists it once more. */ follow(chain: HashChain, events: SecurityEvents): () => void; /** The event first, so the security chain's own checkpoint line is inside the head it persists. */ checkpoint(chain: HashChain, events: SecurityEvents): void; private path; } //# sourceMappingURL=ChainJournal.d.ts.map