/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * The rows a kind read by area reads, made its stored rows (#1393, `Schematic * Builder Spec.md` §10.4): each row's roles beside its bytes, through the * kind's `rowsOf` — or its details' — an East function over the rows' bytes, * which runs the kind's accessors over every row it is given. * * - **Each row made once.** What a maker made of a row is kept by the row's * key while the row reads again as it was — the same object, or one East * holds equal (`equalFor`), as a window into finer cells decodes it — so a * window over rows another window made, a zoom into finer cells, which * searches anew, or a pan back makes only the rows it adds, and the rows it * made before are the same stored rows, which the drawing keeps. Past * {@link MAX_MADE_ROWS} kept, those a read does not ask for go. * - **A budget a read.** A read makes rows a batch a call * ({@link MAKE_BATCH}), until {@link MAKE_BUDGET_MS} has passed since it * began — a batch at least — and leaves the rest to the next read: a window * of thousands of rows new to it is made over several tasks, a frame * drawing between, never in one long task. * * @packageDocumentation */ import { fromEastTypeValue } from "@elaraai/east"; /** A stored row: its roles beside its bytes, as a kind's `rowsOf` makes it. */ export interface StoredRow { readonly roles: unknown; readonly row: Uint8Array; } /** Stored rows, by key. */ export type StoredRows = ReadonlyMap; /** What makes a kind's stored rows: the kind, or its details — their row type and their `rowsOf`. */ export interface RowMaker { /** The row type, as an East type value. */ readonly rowType: Parameters[0]; /** Makes the stored rows of an Array of `{ key, row }`, given as its bytes. */ readonly rowsOf: (bytes: Uint8Array) => StoredRows; } /** The most rows a maker keeps made — a window's read — past which those a read does not ask for go. */ export declare const MAX_MADE_ROWS = 20000; /** * How many rows a maker's `rowsOf` makes in one call: each call's own cost spread over them, and a call a few ms at * most — some 10 ms while its functions run cold, under 2 ms once warm — so the budget, checked between calls, is * overrun by no more. */ export declare const MAKE_BATCH = 64; /** How long one read makes rows for, in ms, before the rest are left to the next read: a frame draws between. */ export declare const MAKE_BUDGET_MS = 12; /** How {@link RowMaking} keeps what it made. */ export interface RowMakingOptions { /** The most rows a maker keeps made; {@link MAX_MADE_ROWS} unless given. */ readonly most?: number; } /** * Rows made their stored rows, each once, a budget a read (see the module * docs): one for a reader's every maker — each kind read by area and its * details. */ export declare class RowMaking { private readonly most; private readonly made; private readonly encoders; private readonly equals; /** When the read under way stops making rows, by `performance.now()`. */ private deadline; /** Whether the read under way has left rows to make. */ private left; /** * @param options - The most rows a maker keeps made */ constructor(options?: RowMakingOptions); /** Begins a read: it makes rows for {@link MAKE_BUDGET_MS} — a batch at least — and leaves the rest to the next. */ begin(): void; /** Whether the last read left rows to make: its reader reads again a task later, a frame drawing between. */ get unmade(): boolean; /** * Rows made their stored rows, in key order, as `rowsOf` gives them (see * the module docs): a row made before, read again as it was, the same * stored row; the rest made a batch a call, until the read's budget is * spent — a batch at least — the rest left to the next read. * * @param maker - The kind, or its details * @param rows - The rows, by key: each as it was read * @returns Their stored rows, by key; `undefined` while rows are left to make * @throws {Error} When the maker's `rowsOf` makes no stored row of a row it was given, naming its key: asked of it at * every read after, the read would never end */ make(maker: RowMaker, rows: ReadonlyMap): StoredRows | undefined; /** A maker's encoder of the rows it is given, made once a maker. */ private encoderOf; /** A maker's equality of its rows, made once a maker. */ private equalOf; } //# sourceMappingURL=made-rows.d.ts.map