@quereus/store 3.3.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +436 -317
  2. package/dist/src/common/backing-host.d.ts +198 -0
  3. package/dist/src/common/backing-host.d.ts.map +1 -0
  4. package/dist/src/common/backing-host.js +452 -0
  5. package/dist/src/common/backing-host.js.map +1 -0
  6. package/dist/src/common/bytes.d.ts +16 -0
  7. package/dist/src/common/bytes.d.ts.map +1 -0
  8. package/dist/src/common/bytes.js +33 -0
  9. package/dist/src/common/bytes.js.map +1 -0
  10. package/dist/src/common/cached-kv-store.d.ts +3 -3
  11. package/dist/src/common/cached-kv-store.d.ts.map +1 -1
  12. package/dist/src/common/cached-kv-store.js +6 -4
  13. package/dist/src/common/cached-kv-store.js.map +1 -1
  14. package/dist/src/common/encoding.d.ts +9 -1
  15. package/dist/src/common/encoding.d.ts.map +1 -1
  16. package/dist/src/common/encoding.js +12 -2
  17. package/dist/src/common/encoding.js.map +1 -1
  18. package/dist/src/common/index.d.ts +8 -6
  19. package/dist/src/common/index.d.ts.map +1 -1
  20. package/dist/src/common/index.js +7 -3
  21. package/dist/src/common/index.js.map +1 -1
  22. package/dist/src/common/key-builder.d.ts +125 -4
  23. package/dist/src/common/key-builder.d.ts.map +1 -1
  24. package/dist/src/common/key-builder.js +186 -9
  25. package/dist/src/common/key-builder.js.map +1 -1
  26. package/dist/src/common/kv-store.d.ts +75 -4
  27. package/dist/src/common/kv-store.d.ts.map +1 -1
  28. package/dist/src/common/memory-store.d.ts +3 -3
  29. package/dist/src/common/memory-store.d.ts.map +1 -1
  30. package/dist/src/common/memory-store.js +4 -2
  31. package/dist/src/common/memory-store.js.map +1 -1
  32. package/dist/src/common/store-connection.d.ts +11 -4
  33. package/dist/src/common/store-connection.d.ts.map +1 -1
  34. package/dist/src/common/store-connection.js +12 -6
  35. package/dist/src/common/store-connection.js.map +1 -1
  36. package/dist/src/common/store-module.d.ts +580 -20
  37. package/dist/src/common/store-module.d.ts.map +1 -1
  38. package/dist/src/common/store-module.js +1590 -135
  39. package/dist/src/common/store-module.js.map +1 -1
  40. package/dist/src/common/store-table.d.ts +347 -14
  41. package/dist/src/common/store-table.d.ts.map +1 -1
  42. package/dist/src/common/store-table.js +751 -98
  43. package/dist/src/common/store-table.js.map +1 -1
  44. package/dist/src/common/transaction.d.ts +135 -27
  45. package/dist/src/common/transaction.d.ts.map +1 -1
  46. package/dist/src/common/transaction.js +216 -55
  47. package/dist/src/common/transaction.js.map +1 -1
  48. package/package.json +5 -5
@@ -9,13 +9,36 @@
9
9
  * - Index stores: {schema}.{table}_idx_{name} - one per secondary index
10
10
  * - Stats store: __stats__ - unified store for all table statistics, keyed by {schema}.{table}
11
11
  */
12
- import { VirtualTable, IndexConstraintOp, ConflictResolution, type Database, type TableSchema, type Row, type FilterInfo, type SqlValue, type VirtualTableConnection, type UpdateArgs, type UpdateResult } from '@quereus/quereus';
13
- import type { KVStore } from './kv-store.js';
12
+ import { VirtualTable, IndexConstraintOp, ConflictResolution, type Database, type ColumnSchema, type TableSchema, type Row, type FilterInfo, type SqlValue, type VirtualTableConnection, type UpdateArgs, type UpdateResult, type BackingRowChange } from '@quereus/quereus';
13
+ import type { IterateOptions, KVEntry, KVStore } from './kv-store.js';
14
14
  import type { StoreEventEmitter } from './events.js';
15
15
  import type { TransactionCoordinator } from './transaction.js';
16
16
  import { StoreConnection } from './store-connection.js';
17
17
  import { type TableStats } from './serialization.js';
18
- import type { EncodeOptions } from './encoding.js';
18
+ import { type EncodeOptions } from './encoding.js';
19
+ /**
20
+ * Resolve the per-column KEY collation for each primary-key column.
21
+ *
22
+ * The store encodes PRIMARY KEY uniqueness/ordering PHYSICALLY in the key bytes,
23
+ * so each text PK column's key must be encoded under that column's declared
24
+ * collation (BINARY / NOCASE / RTRIM — the registered encoders). Returns one
25
+ * entry per PK member, in `pkDef` order:
26
+ * - text member → its declared `collation` (normalized upper-case), or
27
+ * `fallback` (the table key collation K) when the column carries none.
28
+ * - non-text member → `undefined`: collation is meaningless for
29
+ * integer/real/blob keys (they encode type-natively), so the encoder ignores
30
+ * it and the data/index key bytes are identical regardless.
31
+ *
32
+ * A custom comparator-only collation with no registered byte encoder still maps
33
+ * to NOCASE bytes inside `encodeText` (its `?? NOCASE_ENCODER` fallback); that
34
+ * residual is the same one documented for store UNIQUE enforcement and is out of
35
+ * scope here. Shared by {@link StoreTable} (data-key + index-maintenance) and
36
+ * `StoreModule.buildIndexEntries` (index rebuild) so the PK suffix encoding can
37
+ * never drift between the two.
38
+ */
39
+ export declare function resolvePkKeyCollations(pkDef: ReadonlyArray<{
40
+ index: number;
41
+ }>, columns: ReadonlyArray<ColumnSchema>, fallback: string): (string | undefined)[];
19
42
  /**
20
43
  * Configuration for a store table.
21
44
  */
@@ -36,11 +59,30 @@ export interface StoreTableModule {
36
59
  getIndexStore(schemaName: string, tableName: string, indexName: string): Promise<KVStore>;
37
60
  /** Get the stats store for a table. */
38
61
  getStatsStore(schemaName: string, tableName: string): Promise<KVStore>;
39
- /** Get a coordinator for a table. */
40
- getCoordinator(tableKey: string, config: StoreTableConfig): Promise<TransactionCoordinator>;
62
+ /**
63
+ * Get the module's single shared transaction coordinator (one per storage
64
+ * module, shared by every table — the unit of cross-table atomicity).
65
+ * Synchronous: ops are addressed by explicit store handle, so obtaining a
66
+ * coordinator never requires opening storage.
67
+ */
68
+ getCoordinator(): TransactionCoordinator;
41
69
  /** Save table DDL to persistent storage. */
42
70
  saveTableDDL(tableSchema: TableSchema): Promise<void>;
43
71
  }
72
+ /**
73
+ * One externally-applied row op against a SOURCE table's committed storage,
74
+ * the input vocabulary of {@link StoreTable.applyExternalRowChanges}. An
75
+ * `upsert` carries the full table row in schema column order (its PK — and thus
76
+ * its data key — is derived from the row, so an upsert can never relocate a
77
+ * row); a `delete` carries the PK values in PK-definition order.
78
+ */
79
+ export type ExternalRowOp = {
80
+ op: 'upsert';
81
+ row: Row;
82
+ } | {
83
+ op: 'delete';
84
+ pk: SqlValue[];
85
+ };
44
86
  /**
45
87
  * Generic KVStore-backed virtual table.
46
88
  *
@@ -56,16 +98,32 @@ export declare class StoreTable extends VirtualTable {
56
98
  protected indexStores: Map<string, KVStore>;
57
99
  protected statsStore: KVStore | null;
58
100
  protected coordinator: TransactionCoordinator | null;
101
+ /**
102
+ * Disposer returned by the coordinator's `registerCallbacks`, captured on the
103
+ * first {@link attachCoordinator}. Run by {@link dispose} at hard eviction to
104
+ * deregister this instance's {stats apply/discard} pair from the module-wide
105
+ * coordinator; null until attached, and nulled again after dispose.
106
+ */
107
+ private coordinatorDisposer;
59
108
  protected connection: StoreConnection | null;
60
109
  protected eventEmitter?: StoreEventEmitter;
61
110
  protected encodeOptions: EncodeOptions;
62
111
  protected pkDirections: boolean[];
112
+ /**
113
+ * Per-PK-column KEY collation (see {@link resolvePkKeyCollations}). Drives the
114
+ * physical encoding of every data key and the PK suffix of every secondary-index
115
+ * key, so a text PK column declared BINARY/NOCASE/RTRIM is keyed under its own
116
+ * collation rather than one fixed table-level collation. Recomputed on every
117
+ * {@link updateSchema} (an ALTER COLUMN SET COLLATE on a PK member changes it).
118
+ */
119
+ protected pkKeyCollations: (string | undefined)[];
63
120
  protected ddlSaved: boolean;
64
121
  protected cachedStats: TableStats | null;
65
122
  protected pendingStatsDelta: number;
66
123
  protected mutationCount: number;
67
124
  protected statsFlushPending: boolean;
68
125
  private readonly predicateCache;
126
+ private readonly indexPredicateCache;
69
127
  constructor(db: Database, storeModule: StoreTableModule, tableSchema: TableSchema, config: StoreTableConfig, eventEmitter?: StoreEventEmitter, isConnected?: boolean);
70
128
  /** Get the table configuration. */
71
129
  getConfig(): StoreTableConfig;
@@ -73,6 +131,13 @@ export declare class StoreTable extends VirtualTable {
73
131
  getSchema(): TableSchema;
74
132
  /** Update the table schema after an ALTER TABLE operation. */
75
133
  updateSchema(newSchema: TableSchema): void;
134
+ /**
135
+ * Mark the table's DDL as already persisted to the catalog, so the lazy
136
+ * first-store-access save in {@link initializeStore} is skipped. Called by
137
+ * `StoreModule.createIndex` / `dropIndex` after they eagerly write the catalog
138
+ * bundle, so a subsequent INSERT does not redundantly re-persist identical DDL.
139
+ */
140
+ markDdlSaved(): void;
76
141
  /** Close and forget a cached index-store handle, if any. */
77
142
  releaseIndexStore(indexName: string): Promise<void>;
78
143
  /**
@@ -100,17 +165,37 @@ export declare class StoreTable extends VirtualTable {
100
165
  * Only the data store is rewritten — secondary indexes are rebuilt by the
101
166
  * caller (the keys embed the PK suffix, so they must be rebuilt whenever
102
167
  * the PK changes).
168
+ *
169
+ * The new key for each row is encoded under `newColumns`'s per-column PK
170
+ * collations, so this drives BOTH:
171
+ * - `ALTER PRIMARY KEY` — the PK *columns* change; `newColumns` defaults to the
172
+ * current column set (their collations are unchanged), and
173
+ * - `ALTER COLUMN … SET COLLATE` on a PK member — the PK columns stay the same
174
+ * but one column's collation changes; the caller passes the post-ALTER
175
+ * `updatedSchema.columns` so the new key bytes follow the new collation.
176
+ * The OLD key is taken verbatim from the stored entry (never re-encoded), so the
177
+ * old collation is implicit in the existing bytes and need not be supplied.
103
178
  */
104
179
  rekeyRows(newPkDef: ReadonlyArray<{
105
180
  index: number;
106
- desc: boolean;
107
- }>): Promise<void>;
181
+ desc?: boolean;
182
+ }>, newColumns?: ReadonlyArray<ColumnSchema>): Promise<void>;
108
183
  /**
109
184
  * Migrate all stored rows from the old column layout to a new one.
110
185
  * The remap array maps newColumnIndex -> oldColumnIndex | -1.
111
186
  * -1 means the column is new (fill with defaultValue).
187
+ *
188
+ * `backfill`, when supplied (ADD COLUMN with a non-foldable DEFAULT such as
189
+ * `new.<col>`), derives the new column's value from each existing row instead of the
190
+ * single `defaultValue`, and rejects a NULL it produces for a NOT NULL column. The
191
+ * batch is only written once every row migrates, so a throwing evaluator / NOT NULL
192
+ * violation leaves the store untouched for the caller's rollback.
112
193
  */
113
- migrateRows(remap: number[], defaultValue: SqlValue): Promise<void>;
194
+ migrateRows(remap: number[], defaultValue: SqlValue, backfill?: {
195
+ evaluator: (row: Row) => SqlValue | Promise<SqlValue>;
196
+ notNull: boolean;
197
+ columnName: string;
198
+ }): Promise<void>;
114
199
  /**
115
200
  * Ensure the data store is open and DDL is persisted.
116
201
  * Uses a promise-based singleton pattern to prevent race conditions
@@ -130,6 +215,29 @@ export declare class StoreTable extends VirtualTable {
130
215
  * Get or create the stats store.
131
216
  */
132
217
  protected ensureStatsStore(): Promise<KVStore>;
218
+ /**
219
+ * Resolve + cache the module's shared TransactionCoordinator and hook the
220
+ * stats lifecycle callbacks, WITHOUT creating or registering a connection.
221
+ * Synchronous (the coordinator is handle-addressed, never store-opening — see
222
+ * `StoreTableModule.getCoordinator`), so the backing host's resolution path can
223
+ * call it eagerly. Attaching matters for reads: `iterateEffective` /
224
+ * `readEffectiveRowByKey` consult `this.coordinator` for the pending merge, so a
225
+ * table whose only writer is the privileged backing host (which queues ops on the
226
+ * module coordinator, never through `update()`) must still hold the
227
+ * reference for its read paths to be reads-own-writes.
228
+ *
229
+ * The coordinator is module-wide, so its commit/rollback callback array holds
230
+ * one {stats apply/discard} pair per PARTICIPATING table; each table's
231
+ * `applyPendingStats` early-returns when its own `pendingStatsDelta` is 0, so a
232
+ * table that did no work contributes nothing. Registers only on first call per
233
+ * StoreTable instance (the `if (!this.coordinator)` guard); a fresh instance
234
+ * after drop+recreate re-registers against the shared coordinator. The OLD
235
+ * instance is not GC'd on its own — its callback closures capture `this` and
236
+ * stay pinned on the module-wide coordinator until {@link dispose} runs the
237
+ * captured disposer (called at the genuine eviction sites, see
238
+ * `StoreModule.tearDownTableStorage` / `renameTable`).
239
+ */
240
+ attachCoordinator(): TransactionCoordinator;
133
241
  /**
134
242
  * Ensure the coordinator is available and connection is registered.
135
243
  */
@@ -153,16 +261,93 @@ export declare class StoreTable extends VirtualTable {
153
261
  * objects before PK extraction, serialization, and index-key construction.
154
262
  */
155
263
  protected coerceRow(row: Row): Row;
156
- /** Query the table with optional filters. */
264
+ /**
265
+ * Query the table with optional filters.
266
+ *
267
+ * All three access arms read the EFFECTIVE row state: the committed store
268
+ * merged with this table's coordinator's pending ops when a transaction is
269
+ * active (read-your-own-writes — see {@link iterateEffective} /
270
+ * {@link readLiveRowByPk}). Merged emission stays in encoded-PK-key order,
271
+ * preserving the module's `providesOrdering` / `monotonicOn` advertisements.
272
+ */
157
273
  query(filterInfo: FilterInfo): AsyncIterable<Row>;
274
+ /**
275
+ * Iterate the effective entry state of this table's data store within
276
+ * `bounds`: the committed `store.iterate` stream merged with the
277
+ * coordinator's pending ops for the data store (read-your-own-writes).
278
+ *
279
+ * Both inputs are sorted by encoded key bytes, so this is an
280
+ * order-preserving two-way merge: a pending put wins over a committed entry
281
+ * at the same key, a pending delete suppresses its committed entry, and
282
+ * pending puts outside `bounds` are excluded. With no active transaction
283
+ * (or an empty pending bucket) it degrades to the bare committed iterate.
284
+ *
285
+ * The pending side is the module coordinator's bucket for THIS table's data
286
+ * store handle (`store`) — every data op is queued under that exact handle, so
287
+ * a sibling table's pending ops (a different data-store handle) never bleed in.
288
+ */
289
+ protected iterateEffective(store: KVStore, bounds: IterateOptions, reverse?: boolean): AsyncIterable<KVEntry>;
158
290
  /** Analyze filter info to determine PK access pattern. */
159
291
  protected analyzePKAccess(filterInfo: FilterInfo): PKAccessPattern;
160
- /** Scan a range of PK values. */
161
- protected scanPKRange(store: KVStore, _access: PKAccessPattern, filterInfo: FilterInfo): AsyncIterable<Row>;
292
+ /**
293
+ * Convert a leading-PK-column range access into one seek + early-terminate
294
+ * iterate window.
295
+ *
296
+ * Each LT/LE/GT/GE constraint's bound value is encoded under the SAME
297
+ * per-column DESC direction and key collation as the data keys (via
298
+ * {@link encodePkPrefixBounds}), giving the byte region `[lo, hi)` whose
299
+ * leading column equals that value (`lo = encode([x])`,
300
+ * `hi = incrementLastByte(lo)`). The op maps that region's endpoints onto a
301
+ * `gte`/`lt` window; because a DESC column bit-inverts its bytes (larger value
302
+ * ⇒ smaller bytes), the lower/upper assignment swaps with direction:
303
+ *
304
+ * | op | ASC | DESC |
305
+ * |----|----------|----------|
306
+ * | GE | gte = lo | lt = hi |
307
+ * | GT | gte = hi | lt = lo |
308
+ * | LE | lt = hi | gte = lo |
309
+ * | LT | lt = lo | gte = hi |
310
+ *
311
+ * Across constraints (BETWEEN ⇒ one lower + one upper; a redundant same-side
312
+ * pair ⇒ the tighter wins) we keep the MAX lower candidate for `gte` and the
313
+ * MIN upper candidate for `lt`. A candidate that resolves to `undefined` (an
314
+ * `hi` whose increment overflowed all-0xff) leaves that side unbounded — a safe
315
+ * SUPERSET, since {@link matchesFilters} stays the authoritative collation-aware
316
+ * row filter. A NULL/missing bound value is likewise skipped (the planner never
317
+ * pushes `= NULL`, and a range op against NULL rejects every row in matchesFilters).
318
+ *
319
+ * Falls back to a full scan when the leading text PK column declares a
320
+ * comparator-only collation with no registered byte encoder: `encodeText` would
321
+ * silently key it under NOCASE bytes that do not track the column's logical
322
+ * order, so a derived window could UNDER-fetch. A non-text leading column has
323
+ * `pkKeyCollations[0] === undefined` and encodes type-natively — always safe.
324
+ */
325
+ protected buildPKRangeBounds(access: PKAccessPattern): IterateOptions;
326
+ /**
327
+ * Scan a leading-PK-column range, seeking to the window start and
328
+ * early-terminating at its end.
329
+ *
330
+ * {@link buildPKRangeBounds} converts the LT/LE/GT/GE constraints into one
331
+ * encoded-byte `gte`/`lt` window under the same per-column DESC directions and
332
+ * key collations the data keys use, so the iterate visits a SUPERSET of the
333
+ * qualifying rows (a collation widening or the bound-byte increment can
334
+ * over-fetch, never under-fetch). {@link matchesFilters} stays the authoritative
335
+ * collation-aware row filter. {@link iterateEffective} restricts the pending
336
+ * merge to the same `bounds`, so read-your-own-writes holds on the narrowed window.
337
+ */
338
+ protected scanPKRange(store: KVStore, access: PKAccessPattern, filterInfo: FilterInfo): AsyncIterable<Row>;
162
339
  /** Check if a row matches the filter constraints. */
163
340
  protected matchesFilters(row: Row, filterInfo: FilterInfo): boolean;
164
- /** Compare two values according to an operator. */
165
- protected compareValues(a: SqlValue, op: IndexConstraintOp, b: SqlValue): boolean;
341
+ /**
342
+ * Compare two values according to an operator, under `collation` (the column's
343
+ * declared collation; undefined ⇒ BINARY). Delegates to the engine's
344
+ * `compareSqlValues`, so the LT/LE/GT/GE range bounds honour a NOCASE/RTRIM
345
+ * column collation rather than a raw BINARY JS comparison — the capability
346
+ * `StoreModule.getBestAccessPlan` advertises via `honorsCollatedRangeBounds`.
347
+ * NULL on either side fails every operator except EQ-with-both-NULL (the
348
+ * internal point-lookup convention; the planner never pushes `= NULL`).
349
+ */
350
+ protected compareValues(a: SqlValue, op: IndexConstraintOp, b: SqlValue, collation?: string): boolean;
166
351
  /** Perform an update operation (INSERT, UPDATE, DELETE). */
167
352
  update(args: UpdateArgs): Promise<UpdateResult>;
168
353
  /**
@@ -179,6 +364,12 @@ export declare class StoreTable extends VirtualTable {
179
364
  * UniqueConstraintSchema instance so the hot UNIQUE-check path doesn't recompile.
180
365
  */
181
366
  private compileFor;
367
+ /**
368
+ * Returns the compiled predicate for a partial secondary index, or undefined
369
+ * for a full index. Compilation is memoized per IndexSchema instance so the hot
370
+ * DML index-maintenance path doesn't recompile.
371
+ */
372
+ private compileIndexFor;
182
373
  /** Check if two PK arrays are equal. */
183
374
  protected keysEqual(a: SqlValue[], b: SqlValue[]): boolean;
184
375
  /**
@@ -200,8 +391,12 @@ export declare class StoreTable extends VirtualTable {
200
391
  *
201
392
  * Reads through the transaction coordinator's pending writes when active so
202
393
  * intra-transaction duplicates are detected.
394
+ *
395
+ * REPLACE evictions (rows at OTHER PKs) are deleted from storage and pushed onto
396
+ * `evicted` so the DML executor runs the full delete pipeline for each
397
+ * (change-tracking, row-time MV maintenance, FK cascade, auto-events).
203
398
  */
204
- protected checkUniqueConstraints(inTransaction: boolean, newRow: Row, selfPks: SqlValue[][], onConflict?: ConflictResolution): Promise<UpdateResult | null>;
399
+ protected checkUniqueConstraints(inTransaction: boolean, newRow: Row, selfPks: SqlValue[][], onConflict: ConflictResolution | undefined, evicted: Row[]): Promise<UpdateResult | null>;
205
400
  /**
206
401
  * Scan committed + pending data rows for a row matching `newRow` on
207
402
  * `uc.columns` whose PK is not in `selfPks`. For partial UNIQUE, candidates
@@ -209,6 +404,125 @@ export declare class StoreTable extends VirtualTable {
209
404
  * match or null.
210
405
  */
211
406
  private findUniqueConflict;
407
+ /**
408
+ * Find a UNIQUE conflict through a linked row-time covering MV's backing table
409
+ * (the store analogue of the memory `checkUniqueViaMaterializedView`). The
410
+ * backing scan yields candidate conflicting **source** PKs (reads-own-writes via
411
+ * the backing's coordinated connection); each is validated against the *live*
412
+ * store row (committed + this transaction's pending overlay) so a backing entry
413
+ * that lags a row deleted/updated internally this statement is skipped rather
414
+ * than raised as a false conflict. Returns the first real conflict or null.
415
+ */
416
+ private findUniqueConflictViaCoveringMv;
417
+ /**
418
+ * Read the live row at `pk` — this transaction's pending overlay (a pending
419
+ * delete ⇒ gone; a pending put ⇒ its value) shadowing the committed store.
420
+ * Backs `query()`'s point-lookup arm and validates covering-MV conflict
421
+ * candidates against the source of truth.
422
+ */
423
+ private readLiveRowByPk;
424
+ /** Encode `pkValues` (in PK-definition order) exactly as the data store keys rows. */
425
+ encodeDataKey(pkValues: SqlValue[]): Uint8Array;
426
+ /**
427
+ * Byte bounds covering every data key whose leading PK columns equal
428
+ * `prefixValues` — encoded under the same per-column DESC directions and key
429
+ * collations as {@link encodeDataKey}, so seek + early-terminate addresses the
430
+ * exact slice. An empty prefix yields full-scan bounds.
431
+ */
432
+ encodePkPrefixBounds(prefixValues: SqlValue[]): {
433
+ gte: Uint8Array;
434
+ lt?: Uint8Array;
435
+ };
436
+ /**
437
+ * Effective (pending-over-committed) point read by encoded data key: a pending
438
+ * delete ⇒ null, a pending put ⇒ its value, else the committed store entry.
439
+ */
440
+ readEffectiveRowByKey(key: Uint8Array): Promise<Row | null>;
441
+ /**
442
+ * Effective ordered entry scan within `bounds` (see {@link iterateEffective}).
443
+ * Opens the data store first — which fires the lazy first-access `saveTableDDL`
444
+ * for a freshly created table, the catalog write a store-backed MV backing
445
+ * relies on to survive reopen.
446
+ */
447
+ iterateEffectiveEntries(bounds: IterateOptions, reverse?: boolean): AsyncIterable<KVEntry>;
448
+ /** Buffer a privileged row-count delta, applied at coordinator commit (host writes). */
449
+ trackPrivilegedMutation(delta: number): void;
450
+ /**
451
+ * Declared secondary-UNIQUE enforcement for maintenance writes — the store
452
+ * mirror of the memory manager's `enforceSecondaryUniqueOnMaintenance` (see
453
+ * `vtab/backing-host.ts` § Constraint validation for the contract and
454
+ * docs/materialized-views.md § Derived-row constraint validation for the
455
+ * semantics). Called by `StoreBackingHost.applyMaintenance` AFTER the op
456
+ * batch lands in the coordinator's pending state: post-batch is load-bearing
457
+ * (a `replace-all` diff applies puts before deletes, so a per-op check would
458
+ * false-positive when the derived set moves a unique value between primary
459
+ * keys), and checking only the WRITTEN images is complete (pre-existing
460
+ * contents already satisfied the constraint).
461
+ *
462
+ * Reuses {@link findUniqueConflict} — pending-overlay reads, per-column
463
+ * collations, NULL-pass, partial-predicate scope, self-PK exclusion — with
464
+ * the covering-MV route deliberately bypassed: a covering MV over THIS table
465
+ * is cascade-maintained only after the batch returns, so it lags the batch
466
+ * and would miss a same-batch colliding pair. The conflict action is a hard
467
+ * abort (a derivation write carries no user OR clause, and a declared
468
+ * `on conflict replace`/`ignore` default must not evict or drop derived
469
+ * rows). Per-image cost is one effective scan — the same full-scan posture
470
+ * the store's DML UNIQUE enforcement already takes.
471
+ *
472
+ * Zero overhead when the table declares no secondary UNIQUE (every MV-sugar
473
+ * backing, and most maintained tables): one empty-array check.
474
+ */
475
+ enforceSecondaryUniqueForMaintenance(changes: readonly BackingRowChange[]): Promise<void>;
476
+ /**
477
+ * Reset statistics to an absolute committed row count and flush immediately.
478
+ * Used by the host's `replaceContents` (create-fill / refresh), where the new
479
+ * count is exact, replacing any drifted delta-tracked estimate.
480
+ */
481
+ resetStats(rowCount: number): Promise<void>;
482
+ /**
483
+ * Open (and cache) the data store, firing the lazy first-access `saveTableDDL`.
484
+ * Public for the host's `replaceContents`, which writes the store directly.
485
+ */
486
+ openDataStore(): Promise<KVStore>;
487
+ /**
488
+ * Effective (pending-over-committed) point read by PK values — the public
489
+ * read an external writer issues before an upsert to learn the row's current
490
+ * image. Thin wrapper over the same private point-lookup that backs
491
+ * {@link query}'s point arm, so an external read merges pending-over-committed
492
+ * exactly like an engine read does.
493
+ */
494
+ readRowByPk(pk: SqlValue[]): Promise<Row | null>;
495
+ /**
496
+ * Apply externally-originated row ops directly to this source table's
497
+ * COMMITTED storage: table-owned data-key put/delete, secondary-index
498
+ * maintenance, and stats tracking. The index-maintaining counterpart of
499
+ * `StoreBackingHost.applyMaintenance` (which targets index-less MV backings),
500
+ * built for trusted replication-style writes.
501
+ *
502
+ * Deliberately:
503
+ * - emits NO module {@link DataChangeEvent}s — the external writer owns
504
+ * emission and the `remote` flag;
505
+ * - opens NO coordinator transaction — writes land in committed state
506
+ * immediately (`store.put`/`store.delete`, never the coordinator);
507
+ * - runs NO constraint validation (PK/UNIQUE/CHECK/FK) — the origin is
508
+ * trusted, mirroring the backing-host posture.
509
+ *
510
+ * Returns the EFFECTIVE per-op {@link BackingRowChange}s with accurate
511
+ * before-images (the shape `Database.ingestExternalRowChanges` consumes),
512
+ * suppressing no-ops to match the normative upsert-suppression contract in
513
+ * `vtab/backing-host.ts`: a delete of an absent key, and a value-identical
514
+ * upsert (`rowsValueIdentical` — byte-faithful, collation-UNAWARE, against the
515
+ * effective existing row) write nothing and report nothing. A collation-equal /
516
+ * byte-different upsert (e.g. a case-only rewrite under a NOCASE PK) keeps the
517
+ * SAME data key (key identity is collation-aware) but IS a real update that
518
+ * replaces the stored bytes and reports `update`.
519
+ *
520
+ * Last-writer-wins against any concurrently pending local transaction on this
521
+ * table: the external write commits to storage at once, and that transaction's
522
+ * pending batch may overwrite these keys when it commits. This is the same
523
+ * posture the prior raw-KV sync adapter took — not a regression, now stated.
524
+ */
525
+ applyExternalRowChanges(ops: readonly ExternalRowOp[]): Promise<BackingRowChange[]>;
212
526
  /**
213
527
  * Fully delete the row at `pk` (data + secondary indexes + stats + delete event).
214
528
  * Used by REPLACE conflict resolution to evict a conflicting unique row before
@@ -236,6 +550,25 @@ export declare class StoreTable extends VirtualTable {
236
550
  rollback(): Promise<void>;
237
551
  /** Disconnect from the store. */
238
552
  disconnect(): Promise<void>;
553
+ /**
554
+ * Hard teardown: fully detach this instance from the module-wide coordinator.
555
+ *
556
+ * Distinct from the per-scan {@link disconnect} (which only flushes stats and
557
+ * deliberately keeps the table hooked mid-life). Called ONLY at the genuine
558
+ * eviction sites — `StoreModule.tearDownTableStorage` (drop / reclaim) and
559
+ * `renameTable` — where this instance is removed from the module's `tables` map
560
+ * and will never be used again. It best-effort flushes any buffered stats (the
561
+ * backing store is about to be deleted / relocated, so this is the last chance,
562
+ * same posture as the teardown-time `disconnect` it replaces), then runs the
563
+ * coordinator disposer so this instance's {stats apply/discard} callback pair —
564
+ * and the `this` its closures capture — is spliced off the shared coordinator's
565
+ * array rather than pinned for the module's lifetime.
566
+ *
567
+ * Idempotent: the disposer is run at most once and both it and the coordinator
568
+ * reference are nulled, so a double-dispose is a no-op and a re-`attachCoordinator`
569
+ * after dispose registers a fresh pair instead of double-registering.
570
+ */
571
+ dispose(): Promise<void>;
239
572
  /** Get the current estimated row count. */
240
573
  getEstimatedRowCount(): Promise<number>;
241
574
  /** Track a mutation and schedule lazy stats persistence. */
@@ -1 +1 @@
1
- {"version":3,"file":"store-table.d.ts","sourceRoot":"","sources":["../../../src/common/store-table.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACN,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAMlB,KAAK,QAAQ,EAEb,KAAK,WAAW,EAGhB,KAAK,GAAG,EACR,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EAEf,KAAK,YAAY,EACjB,MAAM,kBAAkB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