import type { Row, SqlValue } from '@quereus/quereus'; import type { MergeEntry, MergeConfig } from './merge-types.js'; /** * Merges two sorted streams (overlay and underlying) into a single sorted stream. * * Overlay entries take precedence: * - Insert/Update entries replace any underlying row with the same PK * - Tombstone entries cause the underlying row to be skipped * * Both input streams MUST be sorted by the same key (PK for primary scans, * index key for secondary index scans). The output stream maintains this ordering. * * For secondary index scans: * - Both streams are ordered by (indexKey, PK) * - The merge compares by sort key for ordering * - When PKs match, overlay precedence is applied * * @param overlay Stream of overlay entries (inserts, updates, tombstones) * @param underlying Stream of committed rows from underlying storage * @param config Comparison and extraction functions * @returns Merged stream of rows */ export declare function mergeStreams(overlay: AsyncIterable, underlying: AsyncIterable, config: MergeConfig): AsyncGenerator; /** * Creates a merge entry for an insert or update. * @param row The row data * @param pk The primary key values * @param sortKey The sort key values (defaults to pk if not provided) */ export declare function createMergeEntry(row: Row, pk: SqlValue[], sortKey?: SqlValue[]): MergeEntry; /** * Creates a tombstone merge entry for a delete. * @param pk The primary key values * @param sortKey The sort key values (defaults to pk if not provided) */ export declare function createTombstone(pk: SqlValue[], sortKey?: SqlValue[]): MergeEntry; //# sourceMappingURL=merge-iterator.d.ts.map