import type { StoreEvent } from './store-types.js'; export declare const GENESIS_HASH: string; export declare const EVENT_TYPES: readonly ['published', 'refused', 'decided', 'read']; export declare const sha256: (text: string | Buffer) => string; export interface LogCorruption { code: 'LOG_CORRUPT'; /** The sequence number that was expected where the bad line is. */ seq: number; offset: number; message: string; } export interface LogPosition { /** Byte offset just after the last good line. */ offset: number; /** Sequence of the last good line (0 for an empty log). */ seq: number; /** Hash of the last good line; GENESIS_HASH for an empty log. */ head_hash: string; } export interface ParsedLog extends LogPosition { events: StoreEvent[]; /** Bytes of a torn final line that follow `offset` (0 when the log ends cleanly). */ torn_bytes: number; corruption?: LogCorruption; } /** Parse the log bytes after `from` (the whole log when omitted). Pure. */ export declare function parseLog(buf: Buffer, from?: LogPosition): ParsedLog; /** The hash and sequence of the line that ends just before `offset`, or undefined when `offset` is not a line end. */ export declare function lineBefore(buf: Buffer, offset: number): { seq: number; hash: string; } | undefined; type Body = { type: StoreEvent['type']; } & Record; export declare class EventLog { readonly path: string; private pos; constructor(path: string, pos: LogPosition); get position(): LogPosition; /** Cut a torn tail off the file (crash recovery), durably. */ static truncate(path: string, offset: number): void; static read(path: string): Buffer; /** True when the file is exactly as long as this log last left it (nobody else appended or cut it). */ intact(): boolean; /** Append one event: sequence and chain are assigned here. Throws on an I/O error (nothing was acknowledged). */ append(body: Body, at: string): StoreEvent; } export {}; //# sourceMappingURL=events.d.ts.map