@quereus/store 3.3.0 → 4.1.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.
- package/README.md +436 -317
- package/dist/src/common/backing-host.d.ts +198 -0
- package/dist/src/common/backing-host.d.ts.map +1 -0
- package/dist/src/common/backing-host.js +452 -0
- package/dist/src/common/backing-host.js.map +1 -0
- package/dist/src/common/bytes.d.ts +16 -0
- package/dist/src/common/bytes.d.ts.map +1 -0
- package/dist/src/common/bytes.js +33 -0
- package/dist/src/common/bytes.js.map +1 -0
- package/dist/src/common/cached-kv-store.d.ts +3 -3
- package/dist/src/common/cached-kv-store.d.ts.map +1 -1
- package/dist/src/common/cached-kv-store.js +6 -4
- package/dist/src/common/cached-kv-store.js.map +1 -1
- package/dist/src/common/encoding.d.ts +9 -1
- package/dist/src/common/encoding.d.ts.map +1 -1
- package/dist/src/common/encoding.js +12 -2
- package/dist/src/common/encoding.js.map +1 -1
- package/dist/src/common/index.d.ts +8 -6
- package/dist/src/common/index.d.ts.map +1 -1
- package/dist/src/common/index.js +7 -3
- package/dist/src/common/index.js.map +1 -1
- package/dist/src/common/key-builder.d.ts +125 -4
- package/dist/src/common/key-builder.d.ts.map +1 -1
- package/dist/src/common/key-builder.js +186 -9
- package/dist/src/common/key-builder.js.map +1 -1
- package/dist/src/common/kv-store.d.ts +75 -4
- package/dist/src/common/kv-store.d.ts.map +1 -1
- package/dist/src/common/memory-store.d.ts +3 -3
- package/dist/src/common/memory-store.d.ts.map +1 -1
- package/dist/src/common/memory-store.js +4 -2
- package/dist/src/common/memory-store.js.map +1 -1
- package/dist/src/common/store-connection.d.ts +11 -4
- package/dist/src/common/store-connection.d.ts.map +1 -1
- package/dist/src/common/store-connection.js +12 -6
- package/dist/src/common/store-connection.js.map +1 -1
- package/dist/src/common/store-module.d.ts +580 -20
- package/dist/src/common/store-module.d.ts.map +1 -1
- package/dist/src/common/store-module.js +1590 -135
- package/dist/src/common/store-module.js.map +1 -1
- package/dist/src/common/store-table.d.ts +347 -14
- package/dist/src/common/store-table.d.ts.map +1 -1
- package/dist/src/common/store-table.js +751 -98
- package/dist/src/common/store-table.js.map +1 -1
- package/dist/src/common/transaction.d.ts +135 -27
- package/dist/src/common/transaction.d.ts.map +1 -1
- package/dist/src/common/transaction.js +216 -55
- package/dist/src/common/transaction.js.map +1 -1
- package/package.json +8 -8
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { encodeCompositeKey } from './encoding.js';
|
|
17
17
|
const encoder = new TextEncoder();
|
|
18
|
+
const decoder = new TextDecoder();
|
|
18
19
|
/**
|
|
19
20
|
* Store name suffixes for different data types.
|
|
20
21
|
*/
|
|
@@ -60,9 +61,13 @@ export function buildStatsKey(schemaName, tableName) {
|
|
|
60
61
|
*
|
|
61
62
|
* `directions[i] === true` marks PK column i as DESC — its encoded bytes are
|
|
62
63
|
* bit-inverted so natural byte-lex iteration yields DESC order for that column.
|
|
64
|
+
*
|
|
65
|
+
* `collations[i]`, when defined, encodes PK column i under its own key collation
|
|
66
|
+
* (overriding `options.collation`), so each text PK column honors its declared
|
|
67
|
+
* collation in the physical key bytes. Non-text members ignore it.
|
|
63
68
|
*/
|
|
64
|
-
export function buildDataKey(pkValues, options, directions) {
|
|
65
|
-
return encodeCompositeKey(pkValues, options, directions);
|
|
69
|
+
export function buildDataKey(pkValues, options, directions, collations) {
|
|
70
|
+
return encodeCompositeKey(pkValues, options, directions, collations);
|
|
66
71
|
}
|
|
67
72
|
/**
|
|
68
73
|
* Build a secondary index key.
|
|
@@ -71,10 +76,16 @@ export function buildDataKey(pkValues, options, directions) {
|
|
|
71
76
|
* The index columns come first for range scans, followed by PK for uniqueness.
|
|
72
77
|
* `indexDirections` and `pkDirections` independently control DESC bit-inversion
|
|
73
78
|
* for each half so ordered index scans honor per-column direction.
|
|
79
|
+
*
|
|
80
|
+
* `pkCollations[i]`, when defined, encodes the PK-suffix column i under its own
|
|
81
|
+
* key collation (overriding `options.collation`). The PK suffix MUST be encoded
|
|
82
|
+
* with the same per-column collations as the data key (see `buildDataKey`), so
|
|
83
|
+
* index maintenance (delete-then-insert on UPDATE/DELETE) addresses the same
|
|
84
|
+
* bytes the data store keys by. Index columns keep `options.collation`.
|
|
74
85
|
*/
|
|
75
|
-
export function buildIndexKey(indexValues, pkValues, options, indexDirections, pkDirections) {
|
|
86
|
+
export function buildIndexKey(indexValues, pkValues, options, indexDirections, pkDirections, pkCollations) {
|
|
76
87
|
const indexEncoded = encodeCompositeKey(indexValues, options, indexDirections);
|
|
77
|
-
const pkEncoded = encodeCompositeKey(pkValues, options, pkDirections);
|
|
88
|
+
const pkEncoded = encodeCompositeKey(pkValues, options, pkDirections, pkCollations);
|
|
78
89
|
return concatBytes(indexEncoded, pkEncoded);
|
|
79
90
|
}
|
|
80
91
|
/**
|
|
@@ -84,6 +95,129 @@ export function buildIndexKey(indexValues, pkValues, options, indexDirections, p
|
|
|
84
95
|
export function buildCatalogKey(schemaName, tableName) {
|
|
85
96
|
return encoder.encode(`${schemaName}.${tableName}`.toLowerCase());
|
|
86
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Reserved key-prefix strings for view / materialized-view catalog entries.
|
|
100
|
+
*
|
|
101
|
+
* Table entries keep their existing **unprefixed** key `{schema}.{table}` (a UTF-8
|
|
102
|
+
* encoding of an identifier, whose bytes are all printable — never `0x00`). View and
|
|
103
|
+
* MV entries are given a leading-`0x00` reserved prefix (`"\x00view\x00"` /
|
|
104
|
+
* `"\x00mview\x00"`) so they can never collide with a same-named table entry — a view
|
|
105
|
+
* (or MV) and a table may legally share a name. A leading `0x00` byte is a valid KV
|
|
106
|
+
* key byte for every provider (in-memory, LevelDB, and IndexedDB all accept arbitrary
|
|
107
|
+
* `Uint8Array` keys).
|
|
108
|
+
*
|
|
109
|
+
* Classification rule: {@link buildCatalogScanBounds} (no schema arg) is a full range
|
|
110
|
+
* scan (`gte: []`, `lt: [0xff]`) and so returns these prefixed view/MV entries
|
|
111
|
+
* alongside the unprefixed table entries (every prefix byte `0x00` < `0xff`).
|
|
112
|
+
* {@link classifyCatalogKey} routes each loaded entry to the correct rehydration phase
|
|
113
|
+
* by testing for these prefixes; the two prefixes are mutually exclusive ('v' vs 'm'
|
|
114
|
+
* after the leading `0x00`) and neither is a prefix of a table key.
|
|
115
|
+
*/
|
|
116
|
+
const VIEW_KEY_PREFIX = '\x00view\x00';
|
|
117
|
+
const MVIEW_KEY_PREFIX = '\x00mview\x00';
|
|
118
|
+
const META_KEY_PREFIX = '\x00meta\x00';
|
|
119
|
+
const VIEW_KEY_PREFIX_BYTES = encoder.encode(VIEW_KEY_PREFIX);
|
|
120
|
+
const MVIEW_KEY_PREFIX_BYTES = encoder.encode(MVIEW_KEY_PREFIX);
|
|
121
|
+
const META_KEY_PREFIX_BYTES = encoder.encode(META_KEY_PREFIX);
|
|
122
|
+
/**
|
|
123
|
+
* Build a catalog key for a (non-materialized) view's DDL.
|
|
124
|
+
* Format: `\x00view\x00{schema}.{view}` (reserved prefix — never collides with a
|
|
125
|
+
* same-named table entry).
|
|
126
|
+
*/
|
|
127
|
+
export function buildViewCatalogKey(schemaName, viewName) {
|
|
128
|
+
return encoder.encode(`${VIEW_KEY_PREFIX}${`${schemaName}.${viewName}`.toLowerCase()}`);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Build a catalog key for a materialized view's DDL.
|
|
132
|
+
* Format: `\x00mview\x00{schema}.{mv}` (reserved prefix — never collides with a
|
|
133
|
+
* same-named table entry).
|
|
134
|
+
*/
|
|
135
|
+
export function buildMaterializedViewCatalogKey(schemaName, mvName) {
|
|
136
|
+
return encoder.encode(`${MVIEW_KEY_PREFIX}${`${schemaName}.${mvName}`.toLowerCase()}`);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Inverse of {@link buildMaterializedViewCatalogKey}: recover the qualified
|
|
140
|
+
* lowercased `schema.mv` name from a `\x00mview\x00…` catalog key by stripping the
|
|
141
|
+
* reserved prefix. Used by `rehydrateCatalog` to name each MV entry so the
|
|
142
|
+
* store can withhold the adopt fast path per-entry (the stale-at-close set in the
|
|
143
|
+
* clean-shutdown marker is keyed by this same `schema.mv` string). The caller has
|
|
144
|
+
* already classified the key as a materialized view ({@link classifyCatalogKey});
|
|
145
|
+
* the returned string is treated as opaque (never `.`-split).
|
|
146
|
+
*/
|
|
147
|
+
export function parseMaterializedViewCatalogKey(key) {
|
|
148
|
+
return decoder.decode(key.subarray(MVIEW_KEY_PREFIX_BYTES.length));
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Build a catalog key for a store-internal meta entry (not DDL). Format:
|
|
152
|
+
* `\x00meta\x00{name}` — same reserved leading-`0x00` scheme as the view/MV
|
|
153
|
+
* prefixes, so a meta key can never collide with a table entry, and the 'm'-vs
|
|
154
|
+
* `\x00meta`/`\x00mview` byte sequences diverge at the second character.
|
|
155
|
+
* The meta entries are the clean-shutdown marker ({@link CLEAN_SHUTDOWN_META_NAME})
|
|
156
|
+
* and the durable stale-MV set ({@link STALE_MVS_META_NAME}).
|
|
157
|
+
*/
|
|
158
|
+
export function buildMetaCatalogKey(name) {
|
|
159
|
+
return encoder.encode(`${META_KEY_PREFIX}${name}`);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Reserved meta-entry name for the clean-shutdown marker: written by
|
|
163
|
+
* `StoreModule.closeAll` after every batch has flushed, consumed (read +
|
|
164
|
+
* immediately deleted — single-use) by `rehydrateCatalog`. Its presence at open
|
|
165
|
+
* attests no crash since the last close, which is the trust basis for the
|
|
166
|
+
* materialized-view adopt-without-refill fast path.
|
|
167
|
+
*
|
|
168
|
+
* The marker **value** is a JSON array of the qualified lowercased `schema.mv`
|
|
169
|
+
* names that were stale-at-close (row-time maintenance detached, so the durable
|
|
170
|
+
* backing may be behind) — see {@link parseMaterializedViewCatalogKey}. `[]` is
|
|
171
|
+
* the common clean case (nothing stale). Any unparseable / wrong-shape payload
|
|
172
|
+
* (including a legacy bare `'1'`) degrades to refill-everything: the safe posture.
|
|
173
|
+
*/
|
|
174
|
+
export const CLEAN_SHUTDOWN_META_NAME = 'clean_shutdown';
|
|
175
|
+
/**
|
|
176
|
+
* Reserved meta-entry name for the durable stale-MV set: the crash-survivable
|
|
177
|
+
* record of which materialized views have **logically** fallen out of date
|
|
178
|
+
* (`derivation.stale` — row-time maintenance detached mid-session by a
|
|
179
|
+
* body-relevant source schema change, so later source writes never reached the
|
|
180
|
+
* backing). Modeled on {@link CLEAN_SHUTDOWN_META_NAME} but, unlike the marker,
|
|
181
|
+
* it is **persistent current-truth, not single-use**: `StoreModule` overwrites it
|
|
182
|
+
* (a `sync: true` point-write) whenever the stale set changes during a session and
|
|
183
|
+
* at clean close, `rehydrateCatalog` only **reads** it (never deletes it), and a
|
|
184
|
+
* crash leaves the last synced value intact.
|
|
185
|
+
*
|
|
186
|
+
* The **value** is a JSON array of lowercased qualified `schema.mv` names currently
|
|
187
|
+
* stale (e.g. `[]` or `["main.mv","main.mv2"]`). In the atomic-commit domain (a
|
|
188
|
+
* provider exposing {@link KVStoreProvider.beginAtomicBatch}) this is the adopt
|
|
189
|
+
* fast path's logical-staleness exclusion basis — `!durableStale.has(name)` —
|
|
190
|
+
* which (unlike the clean-shutdown marker) survives a crash, so a non-stale backing
|
|
191
|
+
* adopts even after a crash. Any unparseable / wrong-shape payload degrades to
|
|
192
|
+
* refill-everything: the safe posture (see `docs/materialized-views.md`
|
|
193
|
+
* § Cross-module atomicity).
|
|
194
|
+
*/
|
|
195
|
+
export const STALE_MVS_META_NAME = 'stale_mvs';
|
|
196
|
+
/**
|
|
197
|
+
* Classify a loaded catalog key by its reserved prefix so `rehydrateCatalog` can
|
|
198
|
+
* route each entry to the correct phase. A view/MV entry must never be fed to the
|
|
199
|
+
* table-phase `importCatalog` (which would fail-loud or mis-handle it); a meta
|
|
200
|
+
* entry is not DDL at all and must never reach any import phase.
|
|
201
|
+
*/
|
|
202
|
+
export function classifyCatalogKey(key) {
|
|
203
|
+
if (startsWithBytes(key, VIEW_KEY_PREFIX_BYTES))
|
|
204
|
+
return 'view';
|
|
205
|
+
if (startsWithBytes(key, MVIEW_KEY_PREFIX_BYTES))
|
|
206
|
+
return 'materializedView';
|
|
207
|
+
if (startsWithBytes(key, META_KEY_PREFIX_BYTES))
|
|
208
|
+
return 'meta';
|
|
209
|
+
return 'table';
|
|
210
|
+
}
|
|
211
|
+
/** True when `key` begins with the byte sequence `prefix`. */
|
|
212
|
+
function startsWithBytes(key, prefix) {
|
|
213
|
+
if (key.length < prefix.length)
|
|
214
|
+
return false;
|
|
215
|
+
for (let i = 0; i < prefix.length; i++) {
|
|
216
|
+
if (key[i] !== prefix[i])
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
87
221
|
/**
|
|
88
222
|
* Build range bounds for scanning all rows in a data store.
|
|
89
223
|
*
|
|
@@ -102,10 +236,20 @@ export function buildFullScanBounds() {
|
|
|
102
236
|
*
|
|
103
237
|
* `directions[i] === true` flips bytes of prefix component i to match DESC
|
|
104
238
|
* encoding in the stored index keys.
|
|
239
|
+
*
|
|
240
|
+
* `lt` is omitted when the encoded prefix is all-0xff bytes (e.g. a single
|
|
241
|
+
* leading DESC NULL, whose type byte inverts to 0xff) — no finite exclusive
|
|
242
|
+
* upper bound exists, so the scan runs to the end of the store.
|
|
243
|
+
*
|
|
244
|
+
* An empty prefix yields unbounded full-scan bounds: index stores are
|
|
245
|
+
* per-index, so every key belongs to this index, and capping at `lt: [0xff]`
|
|
246
|
+
* would wrongly exclude entries whose leading column is a DESC NULL (encoded
|
|
247
|
+
* with a 0xff type byte) — the same trap {@link buildFullScanBounds} documents
|
|
248
|
+
* for data stores.
|
|
105
249
|
*/
|
|
106
250
|
export function buildIndexPrefixBounds(prefixValues, options, directions) {
|
|
107
251
|
if (prefixValues.length === 0) {
|
|
108
|
-
return
|
|
252
|
+
return buildFullScanBounds();
|
|
109
253
|
}
|
|
110
254
|
const prefixEncoded = encodeCompositeKey(prefixValues, options, directions);
|
|
111
255
|
return {
|
|
@@ -113,6 +257,38 @@ export function buildIndexPrefixBounds(prefixValues, options, directions) {
|
|
|
113
257
|
lt: incrementLastByte(prefixEncoded),
|
|
114
258
|
};
|
|
115
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* Build range bounds for scanning a data store by a PRIMARY KEY prefix.
|
|
262
|
+
*
|
|
263
|
+
* The leading PK values are encoded exactly as {@link buildDataKey} encodes
|
|
264
|
+
* them — same per-column DESC `directions` and per-column key `collations`
|
|
265
|
+
* (`StoreTable.pkKeyCollations`) — so the bounds address the same key bytes
|
|
266
|
+
* the data store is keyed by.
|
|
267
|
+
*
|
|
268
|
+
* Relies on the composite-key prefix-preservation property: `encodeCompositeKey`
|
|
269
|
+
* concatenates self-delimiting per-column encodings (text NUL-terminated with
|
|
270
|
+
* 0x01 escaping, fixed-width tagged numerics), so the encoding of a leading
|
|
271
|
+
* value subset is a byte-prefix of every full key sharing those values — and
|
|
272
|
+
* that holds through per-column DESC bit-inversion and per-column collation
|
|
273
|
+
* encoders, which both apply column-locally.
|
|
274
|
+
*
|
|
275
|
+
* An empty prefix yields full-scan bounds (see {@link buildFullScanBounds} for
|
|
276
|
+
* why the data store must NOT cap with `lt: [0xff]` — a DESC NULL leading
|
|
277
|
+
* column encodes to a 0xff byte). The non-empty case is unaffected by that
|
|
278
|
+
* caveat because its upper bound derives from the actual prefix bytes; when
|
|
279
|
+
* those are all 0xff (so no finite increment exists), `lt` is omitted and the
|
|
280
|
+
* scan runs to the end of the store.
|
|
281
|
+
*/
|
|
282
|
+
export function buildPkPrefixBounds(prefixValues, options, directions, collations) {
|
|
283
|
+
if (prefixValues.length === 0) {
|
|
284
|
+
return buildFullScanBounds();
|
|
285
|
+
}
|
|
286
|
+
const prefixEncoded = encodeCompositeKey(prefixValues, options, directions, collations);
|
|
287
|
+
return {
|
|
288
|
+
gte: prefixEncoded,
|
|
289
|
+
lt: incrementLastByte(prefixEncoded),
|
|
290
|
+
};
|
|
291
|
+
}
|
|
116
292
|
/**
|
|
117
293
|
* Build range bounds for scanning catalog entries.
|
|
118
294
|
* Optionally filter by schema prefix.
|
|
@@ -120,6 +296,7 @@ export function buildIndexPrefixBounds(prefixValues, options, directions) {
|
|
|
120
296
|
export function buildCatalogScanBounds(schemaName) {
|
|
121
297
|
if (schemaName) {
|
|
122
298
|
const prefix = `${schemaName}.`.toLowerCase();
|
|
299
|
+
// UTF-8 output never contains 0xff bytes, so the increment cannot overflow.
|
|
123
300
|
return {
|
|
124
301
|
gte: encoder.encode(prefix),
|
|
125
302
|
lt: incrementLastByte(encoder.encode(prefix)),
|
|
@@ -132,6 +309,9 @@ export function buildCatalogScanBounds(schemaName) {
|
|
|
132
309
|
}
|
|
133
310
|
/**
|
|
134
311
|
* Increment the last byte of a key to create an exclusive upper bound.
|
|
312
|
+
* Returns undefined when every byte is 0xff — no finite upper bound exists
|
|
313
|
+
* (every successor byte string still starts with the all-0xff prefix), so
|
|
314
|
+
* callers must scan unbounded above instead.
|
|
135
315
|
*/
|
|
136
316
|
function incrementLastByte(key) {
|
|
137
317
|
const result = new Uint8Array(key.length);
|
|
@@ -144,10 +324,7 @@ function incrementLastByte(key) {
|
|
|
144
324
|
}
|
|
145
325
|
result[i] = 0;
|
|
146
326
|
}
|
|
147
|
-
|
|
148
|
-
const extended = new Uint8Array(result.length + 1);
|
|
149
|
-
extended.set(result);
|
|
150
|
-
return extended;
|
|
327
|
+
return undefined;
|
|
151
328
|
}
|
|
152
329
|
/**
|
|
153
330
|
* Concatenate multiple byte arrays.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key-builder.js","sourceRoot":"","sources":["../../../src/common/key-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,kBAAkB,EAAsB,MAAM,eAAe,CAAC;AAEvE,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC;;GAE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AC/B,OAAwB,EACxB,UAAkB,EAClB,SAAiB;IAEjB,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,UAAU,IAAI,SAAS,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AACnE,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,oBAAoB,CACnC,WAAmB,EACnB,UAAkB;IAElB,OAAO,mBAAmB,EAAE,CAAC;AAC9B,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,oBAAoB,CACnC,WAAmB,EACnB,UAAkB,EAClB,UAAkB,EAClB,YAAyB,EACzB,OAAuB;IAEvB,OAAO,sBAAsB,CAAC,YAAY,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;AAC5D,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,YAAY,CAC3B,SAAoC,EACpC,UAAkB,EAClB,UAAkB,EAClB,QAAiB;IAEjB,OAAO,eAAe,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAChD,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,mBAAmB,CAClC,SAAoC,EACpC,UAAmB;IAEnB,OAAO,sBAAsB,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -26,6 +26,25 @@ export interface KVEntry {
|
|
|
26
26
|
key: Uint8Array;
|
|
27
27
|
value: Uint8Array;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Per-write durability hint for the point-write surface (`put`/`delete`).
|
|
31
|
+
*/
|
|
32
|
+
export interface WriteOptions {
|
|
33
|
+
/**
|
|
34
|
+
* Flush this write to stable storage before resolving. Default false.
|
|
35
|
+
*
|
|
36
|
+
* Backends without a durability knob (in-memory, and any backend that cannot
|
|
37
|
+
* sync) silently ignore it — best-effort, never an error. IndexedDB is already
|
|
38
|
+
* durable at transaction `oncomplete`; `sync` additionally requests
|
|
39
|
+
* `durability: 'strict'` where the engine supports it.
|
|
40
|
+
*
|
|
41
|
+
* Used by the materialized-view clean-shutdown marker consume-delete to force
|
|
42
|
+
* the delete durable before any of the session's data writes can become durable
|
|
43
|
+
* (otherwise a power loss could resurrect a consumed marker — see
|
|
44
|
+
* `docs/materialized-views.md` § Cross-module atomicity).
|
|
45
|
+
*/
|
|
46
|
+
sync?: boolean;
|
|
47
|
+
}
|
|
29
48
|
/**
|
|
30
49
|
* Batch operation types.
|
|
31
50
|
*/
|
|
@@ -50,6 +69,28 @@ export interface WriteBatch {
|
|
|
50
69
|
/** Discard all queued operations. */
|
|
51
70
|
clear(): void;
|
|
52
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* An atomic batch spanning multiple stores of ONE provider. `write()` commits
|
|
74
|
+
* every queued op across every referenced store in a single durable,
|
|
75
|
+
* all-or-nothing physical commit. Obtained from
|
|
76
|
+
* {@link KVStoreProvider.beginAtomicBatch}; a provider exposes that method iff
|
|
77
|
+
* its stores share one atomic commit domain. All stores passed to `put`/`delete`
|
|
78
|
+
* must have been produced by the same provider.
|
|
79
|
+
*
|
|
80
|
+
* Stores are addressed by {@link KVStore} handle (matching how the transaction
|
|
81
|
+
* coordinator already tracks each op's target store), not by name — so it
|
|
82
|
+
* composes with the coordinator's per-store bucketing without a name lookup.
|
|
83
|
+
*/
|
|
84
|
+
export interface AtomicBatch {
|
|
85
|
+
/** Queue a put against the given store. */
|
|
86
|
+
put(store: KVStore, key: Uint8Array, value: Uint8Array): void;
|
|
87
|
+
/** Queue a delete against the given store. */
|
|
88
|
+
delete(store: KVStore, key: Uint8Array): void;
|
|
89
|
+
/** Commit all queued ops across all referenced stores atomically + durably. */
|
|
90
|
+
write(): Promise<void>;
|
|
91
|
+
/** Discard all queued ops. */
|
|
92
|
+
clear(): void;
|
|
93
|
+
}
|
|
53
94
|
/**
|
|
54
95
|
* Abstract key-value store interface.
|
|
55
96
|
* Provides sorted key-value storage with range iteration support.
|
|
@@ -62,12 +103,14 @@ export interface KVStore {
|
|
|
62
103
|
get(key: Uint8Array): Promise<Uint8Array | undefined>;
|
|
63
104
|
/**
|
|
64
105
|
* Put a key-value pair.
|
|
106
|
+
* @param options - Optional per-write durability hint (see {@link WriteOptions}).
|
|
65
107
|
*/
|
|
66
|
-
put(key: Uint8Array, value: Uint8Array): Promise<void>;
|
|
108
|
+
put(key: Uint8Array, value: Uint8Array, options?: WriteOptions): Promise<void>;
|
|
67
109
|
/**
|
|
68
110
|
* Delete a key.
|
|
111
|
+
* @param options - Optional per-write durability hint (see {@link WriteOptions}).
|
|
69
112
|
*/
|
|
70
|
-
delete(key: Uint8Array): Promise<void>;
|
|
113
|
+
delete(key: Uint8Array, options?: WriteOptions): Promise<void>;
|
|
71
114
|
/**
|
|
72
115
|
* Check if a key exists.
|
|
73
116
|
*/
|
|
@@ -181,21 +224,49 @@ export interface KVStoreProvider {
|
|
|
181
224
|
/**
|
|
182
225
|
* Delete all stores for a table (data, indexes, stats).
|
|
183
226
|
* Called when dropping a table.
|
|
227
|
+
*
|
|
228
|
+
* `indexNames` is the authoritative list of the table's secondary-index names
|
|
229
|
+
* (from `tableSchema.indexes`). Implementations MUST build exact index store
|
|
230
|
+
* names from it via `buildIndexStoreName` rather than prefix-scanning the live
|
|
231
|
+
* store list — `_idx_` is a legal substring of an ordinary identifier, so a
|
|
232
|
+
* prefix scan over `{table}_idx_` also matches a sibling table literally named
|
|
233
|
+
* `{table}_idx_<x>` and would destroy its data.
|
|
234
|
+
*
|
|
184
235
|
* @param schemaName - The schema name
|
|
185
236
|
* @param tableName - The table name
|
|
237
|
+
* @param indexNames - The table's secondary-index names (exact, from the schema)
|
|
186
238
|
*/
|
|
187
|
-
deleteTableStores?(schemaName: string, tableName: string): Promise<void>;
|
|
239
|
+
deleteTableStores?(schemaName: string, tableName: string, indexNames: readonly string[]): Promise<void>;
|
|
188
240
|
/**
|
|
189
241
|
* Rename all stores for a table from `oldName` to `newName`. Implementations
|
|
190
242
|
* must close any open handles, move the underlying data + index storage,
|
|
191
243
|
* and drop all cached references to the old name so that subsequent
|
|
192
244
|
* `getStore`/`getIndexStore` calls open the renamed storage.
|
|
193
245
|
*
|
|
246
|
+
* `indexNames` is the authoritative list of the table's secondary-index names
|
|
247
|
+
* (from `tableSchema.indexes`). Implementations MUST relocate exactly those
|
|
248
|
+
* index stores (built via `buildIndexStoreName`) rather than prefix-scanning —
|
|
249
|
+
* a prefix scan over `{oldName}_idx_` also matches a sibling table literally
|
|
250
|
+
* named `{oldName}_idx_<x>` and would silently move its data under `newName`.
|
|
251
|
+
*
|
|
194
252
|
* Called by StoreModule.renameTable during ALTER TABLE ... RENAME TO.
|
|
195
253
|
* @param schemaName - The schema name
|
|
196
254
|
* @param oldName - The current table name
|
|
197
255
|
* @param newName - The desired table name
|
|
256
|
+
* @param indexNames - The table's secondary-index names (exact, from the schema)
|
|
257
|
+
*/
|
|
258
|
+
renameTableStores?(schemaName: string, oldName: string, newName: string, indexNames: readonly string[]): Promise<void>;
|
|
259
|
+
/**
|
|
260
|
+
* Open an atomic batch across this provider's stores, or return undefined
|
|
261
|
+
* when the provider has no shared atomic commit domain (callers then fall
|
|
262
|
+
* back to per-store {@link KVStore.batch}).
|
|
263
|
+
*
|
|
264
|
+
* A provider implements this iff all of its stores commit into one durable,
|
|
265
|
+
* all-or-nothing physical domain (e.g. IndexedDB's single database with
|
|
266
|
+
* multiple object stores). The transaction coordinator uses it to commit a
|
|
267
|
+
* table's data + secondary-index stores in one batch, closing the crash
|
|
268
|
+
* window where a per-store loop could leave them divergent.
|
|
198
269
|
*/
|
|
199
|
-
|
|
270
|
+
beginAtomicBatch?(): AtomicBatch | undefined;
|
|
200
271
|
}
|
|
201
272
|
//# sourceMappingURL=kv-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kv-store.d.ts","sourceRoot":"","sources":["../../../src/common/kv-store.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,gEAAgE;IAChE,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,6BAA6B;IAC7B,EAA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EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvH;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,IAAI,WAAW,GAAG,SAAS,CAAC;CAC7C"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Keys are stored using hex encoding for correct lexicographic ordering.
|
|
10
10
|
*/
|
|
11
|
-
import type { KVStore, KVEntry, WriteBatch, IterateOptions } from './kv-store.js';
|
|
11
|
+
import type { KVStore, KVEntry, WriteBatch, IterateOptions, WriteOptions } from './kv-store.js';
|
|
12
12
|
/**
|
|
13
13
|
* In-memory implementation of KVStore.
|
|
14
14
|
* Uses a Map with hex-encoded keys for correct byte ordering.
|
|
@@ -17,8 +17,8 @@ export declare class InMemoryKVStore implements KVStore {
|
|
|
17
17
|
private data;
|
|
18
18
|
private closed;
|
|
19
19
|
get(key: Uint8Array): Promise<Uint8Array | undefined>;
|
|
20
|
-
put(key: Uint8Array, value: Uint8Array): Promise<void>;
|
|
21
|
-
delete(key: Uint8Array): Promise<void>;
|
|
20
|
+
put(key: Uint8Array, value: Uint8Array, _options?: WriteOptions): Promise<void>;
|
|
21
|
+
delete(key: Uint8Array, _options?: WriteOptions): Promise<void>;
|
|
22
22
|
has(key: Uint8Array): Promise<boolean>;
|
|
23
23
|
iterate(options?: IterateOptions): AsyncIterable<KVEntry>;
|
|
24
24
|
batch(): WriteBatch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-store.d.ts","sourceRoot":"","sources":["../../../src/common/memory-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"memory-store.d.ts","sourceRoot":"","sources":["../../../src/common/memory-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAiBhG;;;GAGG;AACH,qBAAa,eAAgB,YAAW,OAAO;IAC7C,OAAO,CAAC,IAAI,CAA6D;IACzE,OAAO,CAAC,MAAM,CAAS;IAEjB,GAAG,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAOrD,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAS/E,MAAM,CAAC,GAAG,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAK/D,GAAG,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;IAKrC,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC,OAAO,CAAC;IA6ChE,KAAK,IAAI,UAAU;IA2Bb,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAKtB,gBAAgB,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAajE;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,OAAO,CAAC,SAAS;CAKlB"}
|
|
@@ -32,7 +32,9 @@ export class InMemoryKVStore {
|
|
|
32
32
|
this.checkOpen();
|
|
33
33
|
return this.data.get(keyToHex(key))?.value;
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
// `_options` is accepted to satisfy the KVStore signature; an in-memory store
|
|
36
|
+
// has no crash window, so the durability hint is a no-op here.
|
|
37
|
+
async put(key, value, _options) {
|
|
36
38
|
this.checkOpen();
|
|
37
39
|
// Store copies to prevent external mutation
|
|
38
40
|
this.data.set(keyToHex(key), {
|
|
@@ -40,7 +42,7 @@ export class InMemoryKVStore {
|
|
|
40
42
|
value: new Uint8Array(value),
|
|
41
43
|
});
|
|
42
44
|
}
|
|
43
|
-
async delete(key) {
|
|
45
|
+
async delete(key, _options) {
|
|
44
46
|
this.checkOpen();
|
|
45
47
|
this.data.delete(keyToHex(key));
|
|
46
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-store.js","sourceRoot":"","sources":["../../../src/common/memory-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;;GAGG;AACH,SAAS,QAAQ,CAAC,GAAe;IAC/B,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5E,CAAC;AAED;;GAEG;AACH,SAAS,UAAU,CAAC,CAAS,EAAE,CAAS;IACtC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;AAC5B,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,eAAe;IAClB,IAAI,GAAG,IAAI,GAAG,EAAkD,CAAC;IACjE,MAAM,GAAG,KAAK,CAAC;IAEvB,KAAK,CAAC,GAAG,CAAC,GAAe;QACvB,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAe,EAAE,KAAiB;
|
|
1
|
+
{"version":3,"file":"memory-store.js","sourceRoot":"","sources":["../../../src/common/memory-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;;GAGG;AACH,SAAS,QAAQ,CAAC,GAAe;IAC/B,OAAO,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AI;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACxB,CAAC;IAEO,SAAS;QACf,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;CACF"}
|
|
@@ -7,13 +7,22 @@ import type { VirtualTableConnection } from '@quereus/quereus';
|
|
|
7
7
|
import type { TransactionCoordinator } from './transaction.js';
|
|
8
8
|
/**
|
|
9
9
|
* Connection to a KVStore-backed table.
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
|
+
* All connections of one storage module share its single TransactionCoordinator
|
|
12
|
+
* for cross-table atomicity (see {@link TransactionCoordinator}). Because the
|
|
13
|
+
* coordinator is no longer per-table, coordinator identity can no longer pin a
|
|
14
|
+
* connection to one backing-table incarnation; {@link owner} carries that pin
|
|
15
|
+
* instead — set to the owning StoreTable ONLY for connections the backing host
|
|
16
|
+
* creates (see `StoreBackingHost.connect` / `ownsConnection`). Ordinary DML
|
|
17
|
+
* connections leave it `undefined`.
|
|
11
18
|
*/
|
|
12
19
|
export declare class StoreConnection implements VirtualTableConnection {
|
|
13
20
|
readonly connectionId: string;
|
|
14
21
|
readonly tableName: string;
|
|
22
|
+
/** The owning StoreTable instance, for backing-host incarnation pinning (host connections only). */
|
|
23
|
+
readonly owner?: object;
|
|
15
24
|
private coordinator;
|
|
16
|
-
constructor(tableName: string, coordinator: TransactionCoordinator);
|
|
25
|
+
constructor(tableName: string, coordinator: TransactionCoordinator, owner?: object);
|
|
17
26
|
/** Begin a transaction. */
|
|
18
27
|
begin(): void;
|
|
19
28
|
/** Commit the transaction. */
|
|
@@ -28,7 +37,5 @@ export declare class StoreConnection implements VirtualTableConnection {
|
|
|
28
37
|
rollbackToSavepoint(index: number): void;
|
|
29
38
|
/** Disconnect (rolls back if in transaction). */
|
|
30
39
|
disconnect(): Promise<void>;
|
|
31
|
-
/** Get the coordinator for mutation operations. */
|
|
32
|
-
getCoordinator(): TransactionCoordinator;
|
|
33
40
|
}
|
|
34
41
|
//# sourceMappingURL=store-connection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-connection.d.ts","sourceRoot":"","sources":["../../../src/common/store-connection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAI/D
|
|
1
|
+
{"version":3,"file":"store-connection.d.ts","sourceRoot":"","sources":["../../../src/common/store-connection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAI/D;;;;;;;;;;GAUG;AACH,qBAAa,eAAgB,YAAW,sBAAsB;IAC5D,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,oGAAoG;IACpG,SAAgB,KAAK,CAAC,EAAE,MAAM,CAAC;IAC/B,OAAO,CAAC,WAAW,CAAyB;gBAEhC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,sBAAsB,EAAE,KAAK,CAAC,EAAE,MAAM;IAOlF,2BAA2B;IAC3B,KAAK,IAAI,IAAI;IAIb,8BAA8B;IACxB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B,gCAAgC;IAChC,QAAQ,IAAI,IAAI;IAIhB,0BAA0B;IAC1B,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIpC,2BAA2B;IAC3B,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIrC,+BAA+B;IAC/B,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIxC,iDAAiD;IAC3C,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAKlC"}
|
|
@@ -6,16 +6,26 @@
|
|
|
6
6
|
let connectionCounter = 0;
|
|
7
7
|
/**
|
|
8
8
|
* Connection to a KVStore-backed table.
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
|
+
* All connections of one storage module share its single TransactionCoordinator
|
|
11
|
+
* for cross-table atomicity (see {@link TransactionCoordinator}). Because the
|
|
12
|
+
* coordinator is no longer per-table, coordinator identity can no longer pin a
|
|
13
|
+
* connection to one backing-table incarnation; {@link owner} carries that pin
|
|
14
|
+
* instead — set to the owning StoreTable ONLY for connections the backing host
|
|
15
|
+
* creates (see `StoreBackingHost.connect` / `ownsConnection`). Ordinary DML
|
|
16
|
+
* connections leave it `undefined`.
|
|
10
17
|
*/
|
|
11
18
|
export class StoreConnection {
|
|
12
19
|
connectionId;
|
|
13
20
|
tableName;
|
|
21
|
+
/** The owning StoreTable instance, for backing-host incarnation pinning (host connections only). */
|
|
22
|
+
owner;
|
|
14
23
|
coordinator;
|
|
15
|
-
constructor(tableName, coordinator) {
|
|
24
|
+
constructor(tableName, coordinator, owner) {
|
|
16
25
|
this.connectionId = `store-${tableName}-${++connectionCounter}`;
|
|
17
26
|
this.tableName = tableName;
|
|
18
27
|
this.coordinator = coordinator;
|
|
28
|
+
this.owner = owner;
|
|
19
29
|
}
|
|
20
30
|
/** Begin a transaction. */
|
|
21
31
|
begin() {
|
|
@@ -47,9 +57,5 @@ export class StoreConnection {
|
|
|
47
57
|
this.coordinator.rollback();
|
|
48
58
|
}
|
|
49
59
|
}
|
|
50
|
-
/** Get the coordinator for mutation operations. */
|
|
51
|
-
getCoordinator() {
|
|
52
|
-
return this.coordinator;
|
|
53
|
-
}
|
|
54
60
|
}
|
|
55
61
|
//# sourceMappingURL=store-connection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-connection.js","sourceRoot":"","sources":["../../../src/common/store-connection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,IA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