import type { PostgresAccessor } from '../../accessor/postgres.ts';
import { type FileStat, PathSpec } from '../../types.ts';
import { type ReadWindow } from '../hierarchy/read.ts';
/**
 * Stream a keyed table's rows.jsonl a page of rows at a time, in key order,
 * the next page fetched only when the caller pulls it; any other file, a
 * window, and a relation with no row key (`fetchRowKey`) comes whole, as
 * `read` gives it. A table past `maxReadRows` rows or `maxReadBytes` bytes
 * throws EFBIG once that much is out, rather than refusing it whole: a stream
 * cannot know a table's size before it has paged through it, and a reader that
 * stops first (`head -c`, `grep -l`) never reaches it. Each page asks for one
 * row past what the row cap leaves and is sent only when it fits what the byte
 * cap leaves, so no page holds more than the caps allow; a page that does not
 * fit is asked again at half its rows, down to one row past the cap, so the
 * rows that fit still come out before the refusal. Mirrors Python's
 * `read_stream`.
 */
export declare function readStream(accessor: PostgresAccessor, path: PathSpec | string, entry?: FileStat | null, parent?: FileStat | null, options?: ReadWindow): AsyncIterable<Uint8Array>;
export declare function read(accessor: PostgresAccessor, path: PathSpec | string, entry?: FileStat | null, parent?: FileStat | null, options?: ReadWindow): Promise<Uint8Array>;
/**
 * Render a relation's rows.jsonl, or the window `options` picks. The whole file
 * when neither limit nor offset is given, under the size guard: past
 * `maxReadRows` rows or `maxReadBytes` bytes it throws EFBIG, which a command
 * reports as `<cmd>: <path>: File too large` before moving on to its next
 * operand, as for an Airtable table past its cap. `path` is the rows.jsonl the
 * refusal names. Mirrors `read_rows` in `mirage/core/postgres/read.py`.
 */
export declare function readRows(accessor: PostgresAccessor, schema: string, entity: string, path: string | PathSpec, options?: ReadWindow): Promise<Uint8Array>;
export declare const firstLines: (accessor: PostgresAccessor, path: PathSpec, n: number) => Promise<Uint8Array<ArrayBufferLike> | null>;
export declare const lastLines: (accessor: PostgresAccessor, path: PathSpec, n: number) => Promise<Uint8Array<ArrayBufferLike> | null>;
export declare const lineCount: (accessor: PostgresAccessor, path: PathSpec) => Promise<number | null>;
export declare const follow: (accessor: PostgresAccessor, path: PathSpec, n: number, interval: number) => Promise<AsyncIterableIterator<Uint8Array<ArrayBufferLike>> | null>;
/** One row as rows.jsonl spells it. Mirrors `row_line` in `core/postgres/read.py`. */
export declare function rowLine(row: Record<string, unknown>): string;
//# sourceMappingURL=read.d.ts.map