/**
 * {@link FileSink}: persists closed segments as newline-delimited JSON.
 *
 * It drains a {@link SignalChannel} and, for every `close` signal, appends the
 * carried {@link TraceRecord} as a single JSON line to a file. The result is an
 * NDJSON log — one self-contained record per line — that downstream tools can
 * stream-parse without loading the whole file.
 *
 * Writes go through `node:fs/promises` `appendFile`, which creates the file if
 * absent and atomically appends otherwise. Records are buffered in memory and
 * flushed in a single append either when the in-memory batch reaches
 * `flushEvery` lines or when {@link flush}/{@link close} is called — so a busy
 * trace is not one syscall per segment. Only `open`/`update` are ignored;
 * everything persisted is a terminal record.
 */
import type { SignalChannel } from "../channel/signal";
import type { Sink } from "./base";
/** Tuning for a {@link FileSink}. */
export interface FileSinkOptions {
    /**
     * How many records to accumulate before an automatic append. Defaults to 1
     * (append each record as it closes). Larger values trade latency for fewer
     * syscalls; any remainder is flushed on {@link flush}/{@link close}.
     */
    readonly flushEvery?: number;
}
/**
 * A {@link Sink} that appends each closed segment to a path as NDJSON.
 *
 * Owns an in-memory pending batch (hence a meaningful {@link flush}) but no live
 * OS handle — each write opens, appends, and closes via `fs/promises`. {@link drain}
 * flushes whatever remains when the channel ends, and {@link close} is a final
 * flush.
 */
export declare class FileSink implements Sink {
    private readonly path;
    private readonly flushEvery;
    /** Serialized records awaiting their append, oldest first. */
    private pending;
    constructor(path: string, options?: FileSinkOptions);
    /** Drain `channel`, buffering each closed record and flushing on threshold/end. */
    drain(channel: SignalChannel): Promise<void>;
    /** Append all pending records to the file as NDJSON lines, then clear them. */
    flush(): Promise<void>;
    /** Flush any remaining records. Idempotent; the sink holds no OS handle. */
    close(): Promise<void>;
}
