import { BTreeSet } from '../../../shared/src/btree-set.ts'; import type { Condition, Ordering } from '../../../zero-protocol/src/ast.ts'; import type { Row } from '../../../zero-protocol/src/data.ts'; import type { PrimaryKey } from '../../../zero-protocol/src/primary-key.ts'; import type { SchemaValue } from '../../../zero-schema/src/table-schema.ts'; import { type NoSubqueryCondition } from '../builder/filter.ts'; import { type Constraint } from './constraint.ts'; import { type Comparator, type Node } from './data.ts'; import { type Input, type Output, type Start } from './operator.ts'; import type { Source, SourceChange, SourceChangeSet, SourceInput } from './source.ts'; import type { Stream } from './stream.ts'; import type { DebugDelegate } from '../builder/debug-delegate.ts'; export type Overlay = { outputIndex: number; change: SourceChange; }; export type Overlays = { add: Row | undefined; remove: Row | undefined; }; export type Connection = { input: Input; output: Output | undefined; sort: Ordering; splitEditKeys: Set | undefined; compareRows: Comparator; filters: { condition: NoSubqueryCondition; predicate: (row: Row) => boolean; } | undefined; readonly debug?: DebugDelegate | undefined; }; /** * A `MemorySource` is a source that provides data to the pipeline from an * in-memory data source. * * This data is kept in sorted order as downstream pipelines will always expect * the data they receive from `pull` to be in sorted order. */ export declare class MemorySource implements Source { #private; constructor(tableName: string, columns: Record, primaryKey: PrimaryKey, primaryIndexData?: BTreeSet | undefined); getSchemaInfo(): { tableName: string; columns: Record; primaryKey: readonly [string, ...string[]]; }; fork(): MemorySource; get data(): BTreeSet; connect(sort: Ordering, filters?: Condition | undefined, splitEditKeys?: Set | undefined): SourceInput; getIndexKeys(): string[]; push(change: SourceChange | SourceChangeSet): void; genPush(change: SourceChange | SourceChangeSet): Generator; } export declare function genPushAndWriteWithSplitEdit(connections: readonly Connection[], change: SourceChange, exists: (row: Row) => boolean, setOverlay: (o: Overlay | undefined) => Overlay | undefined, writeChange: (c: SourceChange) => void): Generator; export declare function generateWithStart(nodes: Iterable, start: Start | undefined, compare: (r1: Row, r2: Row) => number): Stream; /** * Takes an iterator and overlay. * Splices the overlay into the iterator at the correct position. * * @param startAt - if there is a lower bound to the stream. If the lower bound of the stream * is above the overlay, the overlay will be skipped. * @param rows - the stream into which the overlay should be spliced * @param constraint - constraint that was applied to the rowIterator and should * also be applied to the overlay. * @param overlay - the overlay values to splice in * @param compare - the comparator to use to find the position for the overlay */ export declare function generateWithOverlay(startAt: Row | undefined, rows: Iterable, constraint: Constraint | undefined, overlay: Overlay | undefined, connectionIndex: number, compare: Comparator, filterPredicate?: (row: Row) => boolean | undefined): Generator<{ row: Readonly>; relationships: {}; }, void, unknown>; export { overlaysForStartAt as overlaysForStartAtForTest }; declare function overlaysForStartAt({ add, remove }: Overlays, startAt: Row, compare: Comparator): Overlays; export { overlaysForConstraint as overlaysForConstraintForTest }; declare function overlaysForConstraint({ add, remove }: Overlays, constraint: Constraint): Overlays; export declare function generateWithOverlayInner(rowIterator: Iterable, overlays: Overlays, compare: (r1: Row, r2: Row) => number): Generator<{ row: Readonly>; relationships: {}; }, void, unknown>; export declare function stringify(change: SourceChange): string; //# sourceMappingURL=memory-source.d.ts.map