@quereus/store 0.3.6 → 0.3.7
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.
- package/README.md +2 -2
- package/dist/src/common/ddl-generator.d.ts +15 -0
- package/dist/src/common/ddl-generator.d.ts.map +1 -0
- package/dist/src/common/ddl-generator.js +131 -0
- package/dist/src/common/ddl-generator.js.map +1 -0
- package/dist/src/common/encoding.d.ts +65 -0
- package/dist/src/common/encoding.d.ts.map +1 -0
- package/dist/src/common/encoding.js +339 -0
- package/dist/src/common/encoding.js.map +1 -0
- package/dist/src/common/events.d.ts +119 -0
- package/dist/src/common/events.d.ts.map +1 -0
- package/dist/src/common/events.js +158 -0
- package/dist/src/common/events.js.map +1 -0
- package/dist/src/common/index.d.ts +15 -0
- package/dist/src/common/index.d.ts.map +1 -0
- package/dist/src/common/index.js +23 -0
- package/dist/src/common/index.js.map +1 -0
- package/dist/src/common/key-builder.d.ts +58 -0
- package/dist/src/common/key-builder.d.ts.map +1 -0
- package/dist/src/common/key-builder.js +130 -0
- package/dist/src/common/key-builder.js.map +1 -0
- package/dist/src/common/kv-store.d.ts +150 -0
- package/dist/src/common/kv-store.d.ts.map +1 -0
- package/dist/src/common/kv-store.js +6 -0
- package/dist/src/common/kv-store.js.map +1 -0
- package/dist/src/common/memory-store.d.ts +37 -0
- package/dist/src/common/memory-store.d.ts.map +1 -0
- package/dist/src/common/memory-store.js +146 -0
- package/dist/src/common/memory-store.js.map +1 -0
- package/dist/src/common/serialization.d.ts +41 -0
- package/dist/src/common/serialization.d.ts.map +1 -0
- package/dist/src/common/serialization.js +111 -0
- package/dist/src/common/serialization.js.map +1 -0
- package/dist/src/common/store-connection.d.ts +34 -0
- package/dist/src/common/store-connection.d.ts.map +1 -0
- package/dist/src/common/store-connection.js +55 -0
- package/dist/src/common/store-connection.js.map +1 -0
- package/dist/src/common/store-module.d.ts +111 -0
- package/dist/src/common/store-module.d.ts.map +1 -0
- package/dist/src/common/store-module.js +331 -0
- package/dist/src/common/store-module.js.map +1 -0
- package/dist/src/common/store-table.d.ts +115 -0
- package/dist/src/common/store-table.d.ts.map +1 -0
- package/dist/src/common/store-table.js +472 -0
- package/dist/src/common/store-table.js.map +1 -0
- package/dist/src/common/transaction.d.ts +57 -0
- package/dist/src/common/transaction.d.ts.map +1 -0
- package/dist/src/common/transaction.js +156 -0
- package/dist/src/common/transaction.js.map +1 -0
- package/dist/src/index.d.ts +17 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +18 -0
- package/dist/src/index.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic KVStore-backed Virtual Table implementation.
|
|
3
|
+
*
|
|
4
|
+
* This is a platform-agnostic table implementation that works with any
|
|
5
|
+
* KVStore implementation (LevelDB, IndexedDB, or custom stores).
|
|
6
|
+
*/
|
|
7
|
+
import { VirtualTable, IndexConstraintOp, ConflictResolution, QuereusError, ConstraintError, StatusCode, } from '@quereus/quereus';
|
|
8
|
+
import { StoreConnection } from './store-connection.js';
|
|
9
|
+
import { buildDataKey, buildTableScanBounds, buildIndexKey, buildMetaKey, } from './key-builder.js';
|
|
10
|
+
import { serializeRow, deserializeRow, serializeStats, deserializeStats, } from './serialization.js';
|
|
11
|
+
/** Number of mutations before persisting statistics. */
|
|
12
|
+
const STATS_FLUSH_INTERVAL = 100;
|
|
13
|
+
/**
|
|
14
|
+
* Generic KVStore-backed virtual table.
|
|
15
|
+
*
|
|
16
|
+
* This class provides the core table functionality shared across all
|
|
17
|
+
* storage backends. Platform-specific behavior is delegated to the
|
|
18
|
+
* StoreTableModule.
|
|
19
|
+
*/
|
|
20
|
+
export class StoreTable extends VirtualTable {
|
|
21
|
+
storeModule;
|
|
22
|
+
config;
|
|
23
|
+
store = null;
|
|
24
|
+
coordinator = null;
|
|
25
|
+
connection = null;
|
|
26
|
+
eventEmitter;
|
|
27
|
+
encodeOptions;
|
|
28
|
+
ddlSaved = false;
|
|
29
|
+
// Statistics tracking
|
|
30
|
+
cachedStats = null;
|
|
31
|
+
pendingStatsDelta = 0;
|
|
32
|
+
mutationCount = 0;
|
|
33
|
+
statsFlushPending = false;
|
|
34
|
+
constructor(db, storeModule, tableSchema, config, eventEmitter, isConnected = false) {
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
+
super(db, storeModule, tableSchema.schemaName, tableSchema.name);
|
|
37
|
+
this.storeModule = storeModule;
|
|
38
|
+
this.tableSchema = tableSchema;
|
|
39
|
+
this.config = config;
|
|
40
|
+
this.eventEmitter = eventEmitter;
|
|
41
|
+
this.encodeOptions = { collation: config.collation || 'NOCASE' };
|
|
42
|
+
this.ddlSaved = isConnected;
|
|
43
|
+
}
|
|
44
|
+
/** Get the table configuration. */
|
|
45
|
+
getConfig() {
|
|
46
|
+
return this.config;
|
|
47
|
+
}
|
|
48
|
+
/** Get the table schema. */
|
|
49
|
+
getSchema() {
|
|
50
|
+
return this.tableSchema;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Ensure the store is open and DDL is persisted.
|
|
54
|
+
*/
|
|
55
|
+
async ensureStore() {
|
|
56
|
+
if (!this.store) {
|
|
57
|
+
const tableKey = `${this.schemaName}.${this.tableName}`.toLowerCase();
|
|
58
|
+
this.store = await this.storeModule.getStore(tableKey, this.config);
|
|
59
|
+
// Save DDL on first access (only for newly created tables)
|
|
60
|
+
if (!this.ddlSaved && this.tableSchema) {
|
|
61
|
+
await this.storeModule.saveTableDDL(this.tableSchema);
|
|
62
|
+
this.ddlSaved = true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return this.store;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Ensure the coordinator is available and connection is registered.
|
|
69
|
+
*/
|
|
70
|
+
async ensureCoordinator() {
|
|
71
|
+
if (!this.coordinator) {
|
|
72
|
+
const tableKey = `${this.schemaName}.${this.tableName}`.toLowerCase();
|
|
73
|
+
this.coordinator = await this.storeModule.getCoordinator(tableKey, this.config);
|
|
74
|
+
// Register callbacks for transaction lifecycle
|
|
75
|
+
this.coordinator.registerCallbacks({
|
|
76
|
+
onCommit: () => this.applyPendingStats(),
|
|
77
|
+
onRollback: () => this.discardPendingStats(),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
// Ensure connection is registered with database
|
|
81
|
+
if (!this.connection) {
|
|
82
|
+
this.connection = new StoreConnection(this.tableName, this.coordinator);
|
|
83
|
+
// Register with the database for transaction management
|
|
84
|
+
const dbInternal = this.db;
|
|
85
|
+
await dbInternal.registerConnection(this.connection);
|
|
86
|
+
}
|
|
87
|
+
return this.coordinator;
|
|
88
|
+
}
|
|
89
|
+
/** Apply pending stats on commit. */
|
|
90
|
+
applyPendingStats() {
|
|
91
|
+
if (this.pendingStatsDelta === 0)
|
|
92
|
+
return;
|
|
93
|
+
if (!this.cachedStats) {
|
|
94
|
+
this.cachedStats = { rowCount: 0, updatedAt: Date.now() };
|
|
95
|
+
}
|
|
96
|
+
this.cachedStats.rowCount = Math.max(0, this.cachedStats.rowCount + this.pendingStatsDelta);
|
|
97
|
+
this.cachedStats.updatedAt = Date.now();
|
|
98
|
+
this.mutationCount += Math.abs(this.pendingStatsDelta);
|
|
99
|
+
this.pendingStatsDelta = 0;
|
|
100
|
+
// Schedule lazy flush if needed
|
|
101
|
+
if (this.mutationCount >= STATS_FLUSH_INTERVAL && !this.statsFlushPending) {
|
|
102
|
+
this.statsFlushPending = true;
|
|
103
|
+
queueMicrotask(() => this.flushStats());
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/** Discard pending stats on rollback. */
|
|
107
|
+
discardPendingStats() {
|
|
108
|
+
this.pendingStatsDelta = 0;
|
|
109
|
+
}
|
|
110
|
+
/** Flush statistics to persistent storage. */
|
|
111
|
+
async flushStats() {
|
|
112
|
+
this.statsFlushPending = false;
|
|
113
|
+
this.mutationCount = 0;
|
|
114
|
+
if (!this.cachedStats || !this.store) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const schema = this.tableSchema;
|
|
118
|
+
const statsKey = buildMetaKey('stats', schema.schemaName, schema.name);
|
|
119
|
+
await this.store.put(statsKey, serializeStats(this.cachedStats));
|
|
120
|
+
}
|
|
121
|
+
/** Create a new connection for transaction support. */
|
|
122
|
+
async createConnection() {
|
|
123
|
+
await this.ensureCoordinator();
|
|
124
|
+
return this.connection;
|
|
125
|
+
}
|
|
126
|
+
/** Get the current connection. */
|
|
127
|
+
getConnection() {
|
|
128
|
+
return this.connection ?? undefined;
|
|
129
|
+
}
|
|
130
|
+
/** Extract primary key values from a row. */
|
|
131
|
+
extractPK(row) {
|
|
132
|
+
const schema = this.tableSchema;
|
|
133
|
+
return schema.primaryKeyDefinition.map(pk => row[pk.index]);
|
|
134
|
+
}
|
|
135
|
+
/** Query the table with optional filters. */
|
|
136
|
+
async *query(filterInfo) {
|
|
137
|
+
const store = await this.ensureStore();
|
|
138
|
+
const schema = this.tableSchema;
|
|
139
|
+
// Check if we can use PK-based access
|
|
140
|
+
const pkAccess = this.analyzePKAccess(filterInfo);
|
|
141
|
+
if (pkAccess.type === 'point') {
|
|
142
|
+
const key = buildDataKey(schema.schemaName, schema.name, pkAccess.values, this.encodeOptions);
|
|
143
|
+
const value = await store.get(key);
|
|
144
|
+
if (value) {
|
|
145
|
+
const row = deserializeRow(value);
|
|
146
|
+
if (this.matchesFilters(row, filterInfo)) {
|
|
147
|
+
yield row;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (pkAccess.type === 'range') {
|
|
153
|
+
yield* this.scanPKRange(store, pkAccess, filterInfo);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
// Full table scan
|
|
157
|
+
const bounds = buildTableScanBounds(schema.schemaName, schema.name);
|
|
158
|
+
for await (const entry of store.iterate(bounds)) {
|
|
159
|
+
const row = deserializeRow(entry.value);
|
|
160
|
+
if (this.matchesFilters(row, filterInfo)) {
|
|
161
|
+
yield row;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/** Analyze filter info to determine PK access pattern. */
|
|
166
|
+
analyzePKAccess(filterInfo) {
|
|
167
|
+
const schema = this.tableSchema;
|
|
168
|
+
const pkColumns = schema.primaryKeyDefinition.map(pk => pk.index);
|
|
169
|
+
if (pkColumns.length === 0) {
|
|
170
|
+
return { type: 'scan' };
|
|
171
|
+
}
|
|
172
|
+
// Check for equality on all PK columns
|
|
173
|
+
const eqValues = new Array(pkColumns.length);
|
|
174
|
+
let allEq = true;
|
|
175
|
+
for (let i = 0; i < pkColumns.length; i++) {
|
|
176
|
+
const pkColIdx = pkColumns[i];
|
|
177
|
+
const eqConstraintEntry = filterInfo.constraints?.find(c => c.constraint.iColumn === pkColIdx && c.constraint.op === IndexConstraintOp.EQ);
|
|
178
|
+
if (eqConstraintEntry && eqConstraintEntry.argvIndex > 0) {
|
|
179
|
+
eqValues[i] = filterInfo.args[eqConstraintEntry.argvIndex - 1];
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
allEq = false;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (allEq) {
|
|
187
|
+
return { type: 'point', values: eqValues };
|
|
188
|
+
}
|
|
189
|
+
// Check for range constraints on first PK column
|
|
190
|
+
const firstPkCol = pkColumns[0];
|
|
191
|
+
const rangeOps = [IndexConstraintOp.LT, IndexConstraintOp.LE, IndexConstraintOp.GT, IndexConstraintOp.GE];
|
|
192
|
+
const rangeConstraints = filterInfo.constraints?.filter(c => c.constraint.iColumn === firstPkCol && rangeOps.includes(c.constraint.op)) || [];
|
|
193
|
+
if (rangeConstraints.length > 0) {
|
|
194
|
+
return {
|
|
195
|
+
type: 'range',
|
|
196
|
+
columnIndex: firstPkCol,
|
|
197
|
+
constraints: rangeConstraints.map(c => ({
|
|
198
|
+
columnIndex: c.constraint.iColumn,
|
|
199
|
+
op: c.constraint.op,
|
|
200
|
+
value: c.argvIndex > 0 ? filterInfo.args[c.argvIndex - 1] : undefined,
|
|
201
|
+
})),
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
return { type: 'scan' };
|
|
205
|
+
}
|
|
206
|
+
/** Scan a range of PK values. */
|
|
207
|
+
async *scanPKRange(store, _access, filterInfo) {
|
|
208
|
+
const schema = this.tableSchema;
|
|
209
|
+
const bounds = buildTableScanBounds(schema.schemaName, schema.name);
|
|
210
|
+
// TODO: Refine bounds based on range constraints
|
|
211
|
+
for await (const entry of store.iterate(bounds)) {
|
|
212
|
+
const row = deserializeRow(entry.value);
|
|
213
|
+
if (this.matchesFilters(row, filterInfo)) {
|
|
214
|
+
yield row;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/** Check if a row matches the filter constraints. */
|
|
219
|
+
matchesFilters(row, filterInfo) {
|
|
220
|
+
if (!filterInfo.constraints || filterInfo.constraints.length === 0) {
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
for (const constraintEntry of filterInfo.constraints) {
|
|
224
|
+
const { constraint, argvIndex } = constraintEntry;
|
|
225
|
+
if (constraint.iColumn < 0 || argvIndex <= 0) {
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
const rowValue = row[constraint.iColumn];
|
|
229
|
+
const filterValue = filterInfo.args[argvIndex - 1];
|
|
230
|
+
if (!this.compareValues(rowValue, constraint.op, filterValue)) {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
236
|
+
/** Compare two values according to an operator. */
|
|
237
|
+
compareValues(a, op, b) {
|
|
238
|
+
if (a === null || b === null) {
|
|
239
|
+
return op === IndexConstraintOp.EQ ? a === b : false;
|
|
240
|
+
}
|
|
241
|
+
switch (op) {
|
|
242
|
+
case IndexConstraintOp.EQ:
|
|
243
|
+
return a === b || (typeof a === 'string' && typeof b === 'string' &&
|
|
244
|
+
this.config.collation === 'NOCASE' && a.toLowerCase() === b.toLowerCase());
|
|
245
|
+
case IndexConstraintOp.NE: return a !== b;
|
|
246
|
+
case IndexConstraintOp.LT: return a < b;
|
|
247
|
+
case IndexConstraintOp.LE: return a <= b;
|
|
248
|
+
case IndexConstraintOp.GT: return a > b;
|
|
249
|
+
case IndexConstraintOp.GE: return a >= b;
|
|
250
|
+
default: return true;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/** Perform an update operation (INSERT, UPDATE, DELETE). */
|
|
254
|
+
async update(args) {
|
|
255
|
+
const store = await this.ensureStore();
|
|
256
|
+
const coordinator = await this.ensureCoordinator();
|
|
257
|
+
const inTransaction = coordinator.isInTransaction();
|
|
258
|
+
const schema = this.tableSchema;
|
|
259
|
+
const { operation, values, oldKeyValues } = args;
|
|
260
|
+
switch (operation) {
|
|
261
|
+
case 'insert': {
|
|
262
|
+
if (!values)
|
|
263
|
+
throw new QuereusError('INSERT requires values', StatusCode.MISUSE);
|
|
264
|
+
const pk = this.extractPK(values);
|
|
265
|
+
const key = buildDataKey(schema.schemaName, schema.name, pk, this.encodeOptions);
|
|
266
|
+
// Check for existing row (for conflict handling)
|
|
267
|
+
const existing = await store.get(key);
|
|
268
|
+
if (existing && args.onConflict !== ConflictResolution.REPLACE) {
|
|
269
|
+
throw new ConstraintError('UNIQUE constraint failed: primary key');
|
|
270
|
+
}
|
|
271
|
+
const serializedRow = serializeRow(values);
|
|
272
|
+
if (inTransaction) {
|
|
273
|
+
coordinator.put(key, serializedRow);
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
await store.put(key, serializedRow);
|
|
277
|
+
}
|
|
278
|
+
// Update secondary indexes
|
|
279
|
+
await this.updateSecondaryIndexes(coordinator, inTransaction, null, values, pk);
|
|
280
|
+
// Track statistics (only count as new if not replacing)
|
|
281
|
+
if (!existing) {
|
|
282
|
+
this.trackMutation(+1, inTransaction);
|
|
283
|
+
}
|
|
284
|
+
// Queue or emit event
|
|
285
|
+
const insertEvent = {
|
|
286
|
+
type: 'insert',
|
|
287
|
+
schemaName: schema.schemaName,
|
|
288
|
+
tableName: schema.name,
|
|
289
|
+
key: pk,
|
|
290
|
+
newRow: values,
|
|
291
|
+
};
|
|
292
|
+
if (inTransaction) {
|
|
293
|
+
coordinator.queueEvent(insertEvent);
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
this.eventEmitter?.emitDataChange(insertEvent);
|
|
297
|
+
}
|
|
298
|
+
return values;
|
|
299
|
+
}
|
|
300
|
+
case 'update': {
|
|
301
|
+
if (!values || !oldKeyValues)
|
|
302
|
+
throw new QuereusError('UPDATE requires values and oldKeyValues', StatusCode.MISUSE);
|
|
303
|
+
const oldPk = this.extractPK(oldKeyValues);
|
|
304
|
+
const newPk = this.extractPK(values);
|
|
305
|
+
const oldKey = buildDataKey(schema.schemaName, schema.name, oldPk, this.encodeOptions);
|
|
306
|
+
const newKey = buildDataKey(schema.schemaName, schema.name, newPk, this.encodeOptions);
|
|
307
|
+
// Get old row for index updates
|
|
308
|
+
const oldRowData = await store.get(oldKey);
|
|
309
|
+
const oldRow = oldRowData ? deserializeRow(oldRowData) : null;
|
|
310
|
+
// Delete old key if PK changed
|
|
311
|
+
if (!this.keysEqual(oldPk, newPk)) {
|
|
312
|
+
if (inTransaction) {
|
|
313
|
+
coordinator.delete(oldKey);
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
await store.delete(oldKey);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
const serializedRow = serializeRow(values);
|
|
320
|
+
if (inTransaction) {
|
|
321
|
+
coordinator.put(newKey, serializedRow);
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
await store.put(newKey, serializedRow);
|
|
325
|
+
}
|
|
326
|
+
// Update secondary indexes
|
|
327
|
+
await this.updateSecondaryIndexes(coordinator, inTransaction, oldRow, values, newPk);
|
|
328
|
+
// Queue or emit event
|
|
329
|
+
const updateEvent = {
|
|
330
|
+
type: 'update',
|
|
331
|
+
schemaName: schema.schemaName,
|
|
332
|
+
tableName: schema.name,
|
|
333
|
+
key: newPk,
|
|
334
|
+
oldRow: oldRow || undefined,
|
|
335
|
+
newRow: values,
|
|
336
|
+
};
|
|
337
|
+
if (inTransaction) {
|
|
338
|
+
coordinator.queueEvent(updateEvent);
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
this.eventEmitter?.emitDataChange(updateEvent);
|
|
342
|
+
}
|
|
343
|
+
return values;
|
|
344
|
+
}
|
|
345
|
+
case 'delete': {
|
|
346
|
+
if (!oldKeyValues)
|
|
347
|
+
throw new QuereusError('DELETE requires oldKeyValues', StatusCode.MISUSE);
|
|
348
|
+
const pk = this.extractPK(oldKeyValues);
|
|
349
|
+
const key = buildDataKey(schema.schemaName, schema.name, pk, this.encodeOptions);
|
|
350
|
+
// Get old row for index cleanup
|
|
351
|
+
const oldRowData = await store.get(key);
|
|
352
|
+
const oldRow = oldRowData ? deserializeRow(oldRowData) : null;
|
|
353
|
+
if (inTransaction) {
|
|
354
|
+
coordinator.delete(key);
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
await store.delete(key);
|
|
358
|
+
}
|
|
359
|
+
// Remove from secondary indexes
|
|
360
|
+
if (oldRow) {
|
|
361
|
+
await this.updateSecondaryIndexes(coordinator, inTransaction, oldRow, null, pk);
|
|
362
|
+
this.trackMutation(-1, inTransaction);
|
|
363
|
+
}
|
|
364
|
+
// Queue or emit event
|
|
365
|
+
const deleteEvent = {
|
|
366
|
+
type: 'delete',
|
|
367
|
+
schemaName: schema.schemaName,
|
|
368
|
+
tableName: schema.name,
|
|
369
|
+
key: pk,
|
|
370
|
+
oldRow: oldRow || undefined,
|
|
371
|
+
};
|
|
372
|
+
if (inTransaction) {
|
|
373
|
+
coordinator.queueEvent(deleteEvent);
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
this.eventEmitter?.emitDataChange(deleteEvent);
|
|
377
|
+
}
|
|
378
|
+
return undefined;
|
|
379
|
+
}
|
|
380
|
+
default:
|
|
381
|
+
throw new QuereusError(`Unknown operation: ${operation}`, StatusCode.MISUSE);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
/** Update secondary indexes after a row change. */
|
|
385
|
+
async updateSecondaryIndexes(coordinator, inTransaction, oldRow, newRow, pk) {
|
|
386
|
+
const schema = this.tableSchema;
|
|
387
|
+
const indexes = schema.indexes || [];
|
|
388
|
+
const store = coordinator.getStore();
|
|
389
|
+
for (const index of indexes) {
|
|
390
|
+
const indexCols = index.columns.map(c => c.index);
|
|
391
|
+
// Remove old index entry
|
|
392
|
+
if (oldRow) {
|
|
393
|
+
const oldIndexValues = indexCols.map(i => oldRow[i]);
|
|
394
|
+
const oldIndexKey = buildIndexKey(schema.schemaName, schema.name, index.name, oldIndexValues, pk, this.encodeOptions);
|
|
395
|
+
if (inTransaction) {
|
|
396
|
+
coordinator.delete(oldIndexKey);
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
await store.delete(oldIndexKey);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
// Add new index entry
|
|
403
|
+
if (newRow) {
|
|
404
|
+
const newIndexValues = indexCols.map(i => newRow[i]);
|
|
405
|
+
const newIndexKey = buildIndexKey(schema.schemaName, schema.name, index.name, newIndexValues, pk, this.encodeOptions);
|
|
406
|
+
// Index value is empty - we just need the key for lookups
|
|
407
|
+
const emptyValue = new Uint8Array(0);
|
|
408
|
+
if (inTransaction) {
|
|
409
|
+
coordinator.put(newIndexKey, emptyValue);
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
await store.put(newIndexKey, emptyValue);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
/** Check if two PK arrays are equal. */
|
|
418
|
+
keysEqual(a, b) {
|
|
419
|
+
if (a.length !== b.length)
|
|
420
|
+
return false;
|
|
421
|
+
for (let i = 0; i < a.length; i++) {
|
|
422
|
+
if (a[i] !== b[i])
|
|
423
|
+
return false;
|
|
424
|
+
}
|
|
425
|
+
return true;
|
|
426
|
+
}
|
|
427
|
+
/** Disconnect from the store. */
|
|
428
|
+
async disconnect() {
|
|
429
|
+
// Flush any pending stats before disconnecting
|
|
430
|
+
if (this.mutationCount > 0 && this.store) {
|
|
431
|
+
await this.flushStats();
|
|
432
|
+
}
|
|
433
|
+
// Store is managed by the module, not the table
|
|
434
|
+
this.store = null;
|
|
435
|
+
}
|
|
436
|
+
/** Get the current estimated row count. */
|
|
437
|
+
async getEstimatedRowCount() {
|
|
438
|
+
if (this.cachedStats) {
|
|
439
|
+
return this.cachedStats.rowCount;
|
|
440
|
+
}
|
|
441
|
+
const store = await this.ensureStore();
|
|
442
|
+
const schema = this.tableSchema;
|
|
443
|
+
const statsKey = buildMetaKey('stats', schema.schemaName, schema.name);
|
|
444
|
+
const statsData = await store.get(statsKey);
|
|
445
|
+
if (statsData) {
|
|
446
|
+
this.cachedStats = deserializeStats(statsData);
|
|
447
|
+
return this.cachedStats.rowCount;
|
|
448
|
+
}
|
|
449
|
+
// No stats yet, return 0
|
|
450
|
+
return 0;
|
|
451
|
+
}
|
|
452
|
+
/** Track a mutation and schedule lazy stats persistence. */
|
|
453
|
+
trackMutation(delta, inTransaction = false) {
|
|
454
|
+
if (inTransaction) {
|
|
455
|
+
// Buffer during transaction - stats will be applied at commit
|
|
456
|
+
this.pendingStatsDelta += delta;
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
if (!this.cachedStats) {
|
|
460
|
+
this.cachedStats = { rowCount: 0, updatedAt: Date.now() };
|
|
461
|
+
}
|
|
462
|
+
this.cachedStats.rowCount = Math.max(0, this.cachedStats.rowCount + delta);
|
|
463
|
+
this.cachedStats.updatedAt = Date.now();
|
|
464
|
+
this.mutationCount++;
|
|
465
|
+
// Schedule lazy flush after threshold
|
|
466
|
+
if (this.mutationCount >= STATS_FLUSH_INTERVAL && !this.statsFlushPending) {
|
|
467
|
+
this.statsFlushPending = true;
|
|
468
|
+
queueMicrotask(() => this.flushStats());
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
//# sourceMappingURL=store-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-table.js","sourceRoot":"","sources":["../../../src/common/store-table.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,UAAU,GASX,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,gBAAgB,GAEjB,MAAM,oBAAoB,CAAC;AAG5B,wDAAwD;AACxD,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAyBjC;;;;;;GAMG;AACH,MAAM,OAAO,UAAW,SAAQ,YAAY;IAChC,WAAW,CAAmB;IAC9B,MAAM,CAAmB;IACzB,KAAK,GAAmB,IAAI,CAAC;IAC7B,WAAW,GAAkC,IAAI,CAAC;IAClD,UAAU,GAA2B,IAAI,CAAC;IAC1C,YAAY,CAAqB;IACjC,aAAa,CAAgB;IAC7B,QAAQ,GAAG,KAAK,CAAC;IAE3B,sBAAsB;IACZ,WAAW,GAAsB,IAAI,CAAC;IACtC,iBAAiB,GAAG,CAAC,CAAC;IACtB,aAAa,GAAG,CAAC,CAAC;IAClB,iBAAiB,GAAG,KAAK,CAAC;IAEpC,YACE,EAAY,EACZ,WAA6B,EAC7B,WAAwB,EACxB,MAAwB,EACxB,YAAgC,EAChC,WAAW,GAAG,KAAK;QAEnB,8DAA8D;QAC9D,KAAK,CAAC,EAAE,EAAE,WAAsD,EAAE,WAAW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 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transaction coordinator for virtual table modules.
|
|
3
|
+
*
|
|
4
|
+
* Manages a shared WriteBatch across all tables in a transaction,
|
|
5
|
+
* providing multi-table atomicity.
|
|
6
|
+
*/
|
|
7
|
+
import type { DataChangeEvent, StoreEventEmitter } from './events.js';
|
|
8
|
+
import type { KVStore } from './kv-store.js';
|
|
9
|
+
/** Callback for transaction lifecycle events. */
|
|
10
|
+
export interface TransactionCallbacks {
|
|
11
|
+
onCommit: () => void;
|
|
12
|
+
onRollback: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Coordinates transactions across multiple tables.
|
|
16
|
+
*
|
|
17
|
+
* All mutations within a transaction are buffered in a shared WriteBatch.
|
|
18
|
+
* On commit, the batch is written atomically and events are fired.
|
|
19
|
+
* On rollback, the batch and events are discarded.
|
|
20
|
+
*/
|
|
21
|
+
export declare class TransactionCoordinator {
|
|
22
|
+
private store;
|
|
23
|
+
private eventEmitter?;
|
|
24
|
+
private inTransaction;
|
|
25
|
+
private pendingOps;
|
|
26
|
+
private pendingEvents;
|
|
27
|
+
private savepoints;
|
|
28
|
+
private callbacks;
|
|
29
|
+
constructor(store: KVStore, eventEmitter?: StoreEventEmitter);
|
|
30
|
+
/** Register callbacks for transaction lifecycle events. */
|
|
31
|
+
registerCallbacks(callbacks: TransactionCallbacks): void;
|
|
32
|
+
/** Check if a transaction is active. */
|
|
33
|
+
isInTransaction(): boolean;
|
|
34
|
+
/** Begin a transaction. */
|
|
35
|
+
begin(): void;
|
|
36
|
+
/** Queue a put operation. */
|
|
37
|
+
put(key: Uint8Array, value: Uint8Array): void;
|
|
38
|
+
/** Queue a delete operation. */
|
|
39
|
+
delete(key: Uint8Array): void;
|
|
40
|
+
/** Queue a data change event (fired on commit). */
|
|
41
|
+
queueEvent(event: DataChangeEvent): void;
|
|
42
|
+
/** Commit the transaction. */
|
|
43
|
+
commit(): Promise<void>;
|
|
44
|
+
/** Rollback the transaction. */
|
|
45
|
+
rollback(): void;
|
|
46
|
+
/** Create a savepoint. */
|
|
47
|
+
createSavepoint(index: number): void;
|
|
48
|
+
/** Release a savepoint (no-op, just removes from map). */
|
|
49
|
+
releaseSavepoint(index: number): void;
|
|
50
|
+
/** Rollback to a savepoint. */
|
|
51
|
+
rollbackToSavepoint(index: number): void;
|
|
52
|
+
/** Clear all transaction state. */
|
|
53
|
+
private clearTransaction;
|
|
54
|
+
/** Get the underlying store for direct reads. */
|
|
55
|
+
getStore(): KVStore;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/common/transaction.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAe7C,iDAAiD;AACjD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;;GAMG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,YAAY,CAAC,CAAoB;IAGzC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,UAAU,CAAmB;IACrC,OAAO,CAAC,aAAa,CAAyB;IAC9C,OAAO,CAAC,UAAU,CAAqC;IACvD,OAAO,CAAC,SAAS,CAA8B;gBAEnC,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,iBAAiB;IAK5D,2DAA2D;IAC3D,iBAAiB,CAAC,SAAS,EAAE,oBAAoB,GAAG,IAAI;IAIxD,wCAAwC;IACxC,eAAe,IAAI,OAAO;IAI1B,2BAA2B;IAC3B,KAAK,IAAI,IAAI;IAWb,6BAA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