/** * File-backed Ledger for `clustly run` — survives restarts so a crash mid-job * doesn't lose the job (the order is `enrolled` and won't reappear in the poll) * and the daemon never re-invokes an order it already handled. * * Atomic write: serialize to a temp file then rename (rename is atomic on POSIX), * so a crash during write can't corrupt the ledger. */ import type { Ledger } from "./run"; /** Insertion order is age; a Set keeps it, so the first entry is the oldest. */ export declare const MAX_DONE_REMEMBERED = 1000; export declare class FileLedger implements Ledger { private readonly path; private active; private done; private failures; private retryAt; constructor(path: string); private persist; seen(id: string): boolean; inFlight(): string[]; start(id: string): void; finish(id: string): void; release(id: string): void; fail(id: string): number; notBefore(id: string): number; backoff(id: string, untilMs: number): void; /** The soonest pending retry, so the run loop can sleep to it instead of polling to find it. */ nextDue(): number; }