import { ByteSlice } from '../../io/spool.ts';
/**
 * Buffered (offset, payload) writes as the fewest pwrites that leave a file
 * as the writes did, in arrival order.
 *
 * The kernel adapters buffer each write on its handle and owe the mount the
 * lot at flush. A write that starts inside the last run, or right at its
 * end, folds into it, so a sequential stream is one run. Any other starts a
 * run of its own; the runs apply in order, so a later run still overwrites
 * what it overlaps of an earlier one.
 *
 * Args:
 *   writes: the buffered writes, in arrival order.
 */
export declare function writeRuns(writes: readonly [number, Uint8Array][]): [number, Uint8Array][];
/**
 * A read window with a handle's buffered writes laid over it.
 *
 * The kernel adapters keep a handle's writes until flush; a read through that
 * handle sees them, as a read after write(2) does. They apply in arrival
 * order, so a later write wins where it overlaps, and a gap a write grew the
 * file across reads as zeros. Mirrors Python's `overlaid`.
 *
 * Args:
 *   stored: the stored bytes from `offset`, short where the stored file ends.
 *   offset: where the window starts.
 *   size: the window's length.
 *   writes: the buffered writes, in arrival order.
 */
export declare function overlaid(stored: Uint8Array, offset: number, size: number, writes: readonly [number, Uint8Array][]): Uint8Array;
/**
 * Buffered writes in the groups `writeRuns` folds into one run each,
 * unfolded, for a buffer some of whose writes wait in a spool. Mirrors
 * Python's `run_groups`.
 *
 * Args:
 *   writes: the buffered writes, in arrival order.
 */
export declare function runGroups(writes: readonly [number, Uint8Array | ByteSlice][]): [number, Uint8Array | ByteSlice][][];
/**
 * Buffered writes as `overlaid` lays them over a read window: a write
 * waiting in a spool is read for the part of the window it covers, and past
 * that keeps only where it ends, so the read still reaches as far as the
 * file does. Each spool stays open until the window is read, so a handle
 * that lands and goes meanwhile still shows what it held to a read that took
 * its writes. Mirrors Python's `window_writes`.
 *
 * Args:
 *   writes: the buffered writes, in arrival order.
 *   offset: where the window starts.
 *   size: the window's length.
 */
export declare function windowWrites(writes: readonly [number, Uint8Array | ByteSlice][], offset: number, size: number): Promise<[number, Uint8Array][]>;
/**
 * The bytes one group of buffered writes leaves, from where it starts to
 * where it reaches, a window at a time. Each window lays only the writes
 * that reach it, so a flush costs the writes plus the windows, however many
 * small edits a large file has. Mirrors Python's `run_stream`.
 *
 * Args:
 *   group: one of `runGroups`.
 */
export declare function runStream(group: readonly [number, Uint8Array | ByteSlice][]): AsyncGenerator<Uint8Array>;
//# sourceMappingURL=file_handle.d.ts.map