import type { FileHandle } from 'node:fs/promises'; /** * One JSON-record-per-file client with lockfile CAS. * * The disk twin of `S3RecordClient`: a record is one file at * `{root}/{prefix}{name}.json`, written atomically (tmp then rename(2)) * so readers never see a torn record. The conditional write serializes * on a `{record}.lock` created with O_CREAT|O_EXCL, so compare and * write hit the same stored version. Record names are percent-encoded * into filenames, so any id is safe. Mirrors the Python * DiskRecordClient byte-for-byte on disk. */ export declare class DiskRecordClient { private readonly dir; constructor(root: string, prefix: string); recordPath(name: string): string; get(name: string): Promise<[Record | null, string]>; put(name: string, fields: Record): Promise; /** * Write one record iff its stored generation matches. * * Take the record's lockfile, re-read under the lock, check the * generation, then tmp-write + rename. Losing the lock race or the * generation check resolves false; the caller adopts and retries. */ casPut(name: string, fields: Record, expectedGeneration: number): Promise; listNames(): Promise; loadAll(): Promise>>; delete(names: Iterable): Promise; clear(): Promise; close(): Promise; /** * Block until this record's lockfile is held; handle to release. * * For callers doing a read-modify-write that is not generation-CAS * (e.g. the single-file namespace plane); spins past contention and * reclaims stale locks, throwing only if a live writer holds the * lock for the whole retry budget (~10s). */ lock(name: string): Promise; unlock(name: string, fh: FileHandle): Promise; private acquireLock; private reclaimStaleLock; private releaseLock; private writeRecord; } //# sourceMappingURL=disk.d.ts.map