@quereus/store 4.5.0 → 4.7.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 +34 -6
- package/dist/src/common/encoding.d.ts +4 -3
- package/dist/src/common/encoding.d.ts.map +1 -1
- package/dist/src/common/encoding.js +17 -13
- package/dist/src/common/encoding.js.map +1 -1
- package/dist/src/common/events.d.ts +31 -25
- package/dist/src/common/events.d.ts.map +1 -1
- package/dist/src/common/events.js +38 -39
- package/dist/src/common/events.js.map +1 -1
- package/dist/src/common/implicit-unique-index.d.ts +80 -0
- package/dist/src/common/implicit-unique-index.d.ts.map +1 -0
- package/dist/src/common/implicit-unique-index.js +148 -0
- package/dist/src/common/implicit-unique-index.js.map +1 -0
- package/dist/src/common/index.d.ts +7 -3
- package/dist/src/common/index.d.ts.map +1 -1
- package/dist/src/common/index.js +5 -2
- package/dist/src/common/index.js.map +1 -1
- package/dist/src/common/json-key.d.ts +30 -2
- package/dist/src/common/json-key.d.ts.map +1 -1
- package/dist/src/common/json-key.js +49 -2
- package/dist/src/common/json-key.js.map +1 -1
- package/dist/src/common/key-builder.d.ts +40 -20
- package/dist/src/common/key-builder.d.ts.map +1 -1
- package/dist/src/common/key-builder.js +31 -23
- package/dist/src/common/key-builder.js.map +1 -1
- package/dist/src/common/kv-store.d.ts +10 -0
- package/dist/src/common/kv-store.d.ts.map +1 -1
- package/dist/src/common/pk-key-resolution.d.ts +348 -0
- package/dist/src/common/pk-key-resolution.d.ts.map +1 -0
- package/dist/src/common/pk-key-resolution.js +481 -0
- package/dist/src/common/pk-key-resolution.js.map +1 -0
- package/dist/src/common/store-module-access-plan.d.ts +32 -0
- package/dist/src/common/store-module-access-plan.d.ts.map +1 -0
- package/dist/src/common/store-module-access-plan.js +428 -0
- package/dist/src/common/store-module-access-plan.js.map +1 -0
- package/dist/src/common/store-module-alter-column.d.ts +23 -0
- package/dist/src/common/store-module-alter-column.d.ts.map +1 -0
- package/dist/src/common/store-module-alter-column.js +389 -0
- package/dist/src/common/store-module-alter-column.js.map +1 -0
- package/dist/src/common/store-module-alter.d.ts +55 -0
- package/dist/src/common/store-module-alter.d.ts.map +1 -0
- package/dist/src/common/store-module-alter.js +504 -0
- package/dist/src/common/store-module-alter.js.map +1 -0
- package/dist/src/common/store-module-base.d.ts +268 -0
- package/dist/src/common/store-module-base.d.ts.map +1 -0
- package/dist/src/common/store-module-base.js +362 -0
- package/dist/src/common/store-module-base.js.map +1 -0
- package/dist/src/common/store-module-catalog.d.ts +269 -0
- package/dist/src/common/store-module-catalog.d.ts.map +1 -0
- package/dist/src/common/store-module-catalog.js +462 -0
- package/dist/src/common/store-module-catalog.js.map +1 -0
- package/dist/src/common/store-module-index-build.d.ts +88 -0
- package/dist/src/common/store-module-index-build.d.ts.map +1 -0
- package/dist/src/common/store-module-index-build.js +280 -0
- package/dist/src/common/store-module-index-build.js.map +1 -0
- package/dist/src/common/store-module-index.d.ts +116 -0
- package/dist/src/common/store-module-index.d.ts.map +1 -0
- package/dist/src/common/store-module-index.js +373 -0
- package/dist/src/common/store-module-index.js.map +1 -0
- package/dist/src/common/store-module-rename.d.ts +49 -0
- package/dist/src/common/store-module-rename.d.ts.map +1 -0
- package/dist/src/common/store-module-rename.js +268 -0
- package/dist/src/common/store-module-rename.js.map +1 -0
- package/dist/src/common/store-module-schema-rewrite.d.ts +57 -0
- package/dist/src/common/store-module-schema-rewrite.d.ts.map +1 -0
- package/dist/src/common/store-module-schema-rewrite.js +140 -0
- package/dist/src/common/store-module-schema-rewrite.js.map +1 -0
- package/dist/src/common/store-module-schema-sync.d.ts +232 -0
- package/dist/src/common/store-module-schema-sync.d.ts.map +1 -0
- package/dist/src/common/store-module-schema-sync.js +529 -0
- package/dist/src/common/store-module-schema-sync.js.map +1 -0
- package/dist/src/common/store-module.d.ts +43 -909
- package/dist/src/common/store-module.d.ts.map +1 -1
- package/dist/src/common/store-module.js +184 -3276
- package/dist/src/common/store-module.js.map +1 -1
- package/dist/src/common/store-table-base.d.ts +539 -0
- package/dist/src/common/store-table-base.d.ts.map +1 -0
- package/dist/src/common/store-table-base.js +900 -0
- package/dist/src/common/store-table-base.js.map +1 -0
- package/dist/src/common/store-table-constraints.d.ts +237 -0
- package/dist/src/common/store-table-constraints.d.ts.map +1 -0
- package/dist/src/common/store-table-constraints.js +624 -0
- package/dist/src/common/store-table-constraints.js.map +1 -0
- package/dist/src/common/store-table-scan.d.ts +452 -0
- package/dist/src/common/store-table-scan.d.ts.map +1 -0
- package/dist/src/common/store-table-scan.js +901 -0
- package/dist/src/common/store-table-scan.js.map +1 -0
- package/dist/src/common/store-table.d.ts +71 -1144
- package/dist/src/common/store-table.d.ts.map +1 -1
- package/dist/src/common/store-table.js +168 -2385
- package/dist/src/common/store-table.js.map +1 -1
- package/dist/src/testing/index.d.ts +12 -0
- package/dist/src/testing/index.d.ts.map +1 -0
- package/dist/src/testing/index.js +12 -0
- package/dist/src/testing/index.js.map +1 -0
- package/dist/src/testing/kv-assert.d.ts +19 -0
- package/dist/src/testing/kv-assert.d.ts.map +1 -0
- package/dist/src/testing/kv-assert.js +25 -0
- package/dist/src/testing/kv-assert.js.map +1 -0
- package/dist/src/testing/kv-conformance.d.ts.map +1 -1
- package/dist/src/testing/kv-conformance.js +1 -15
- package/dist/src/testing/kv-conformance.js.map +1 -1
- package/dist/src/testing/kv-provider-conformance.d.ts +54 -0
- package/dist/src/testing/kv-provider-conformance.d.ts.map +1 -0
- package/dist/src/testing/kv-provider-conformance.js +183 -0
- package/dist/src/testing/kv-provider-conformance.js.map +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The catalog store: how a table / view / materialized view's DDL text is turned
|
|
3
|
+
* into a persisted entry, written, compared, reloaded and removed, plus the two
|
|
4
|
+
* pieces of durable open/close bookkeeping that live beside it (the clean-shutdown
|
|
5
|
+
* marker and the stale-materialized-view set).
|
|
6
|
+
*
|
|
7
|
+
* Second layer of the store-module chain:
|
|
8
|
+
* StoreModuleBase -> StoreModuleCatalog -> StoreModuleSchemaSync -> StoreModuleIndex
|
|
9
|
+
* -> StoreModuleAlterColumn -> StoreModuleAlter -> StoreModuleRename -> StoreModule
|
|
10
|
+
*/
|
|
11
|
+
import type { CatalogObjectKind, Database, MaintainedTableSchema, TableSchema, ViewSchema } from '@quereus/quereus';
|
|
12
|
+
import { StoreModuleBase } from './store-module-base.js';
|
|
13
|
+
export declare abstract class StoreModuleCatalog extends StoreModuleBase {
|
|
14
|
+
/**
|
|
15
|
+
* Build the catalog entry for a table: its CREATE TABLE DDL, one
|
|
16
|
+
* `CREATE [UNIQUE] INDEX` statement per persistable secondary index, and one
|
|
17
|
+
* `alter index … set tags (…)` statement per exposed implicit index carrying
|
|
18
|
+
* user tags, newline-joined into a single multi-statement bundle keyed by
|
|
19
|
+
* `{schema}.{table}`.
|
|
20
|
+
*
|
|
21
|
+
* Bundling the indexes into the table's own entry means every existing
|
|
22
|
+
* re-persist path — `saveTableDDL` (each `alterTable` arm, `renameTable`) and
|
|
23
|
+
* the `table_modified` listener (`persistCatalogIfChanged`) — carries the
|
|
24
|
+
* indexes along for free, and `removeTableDDL` drops them with the table. The
|
|
25
|
+
* bundle is consumed on reopen by `rehydrateCatalog` → `importCatalog`, whose
|
|
26
|
+
* `parser.parseAll` splits it AST-by-AST (never on `\n`) and imports each
|
|
27
|
+
* statement in document order, so the table registers before its indexes.
|
|
28
|
+
*
|
|
29
|
+
* Both the table DDL and the index DDL are emitted without a `db` arg, keeping
|
|
30
|
+
* the persistence-safe fully-qualified form. Hidden implicit covering indexes
|
|
31
|
+
* (the auto-built BTree backing a declared UNIQUE constraint) are excluded —
|
|
32
|
+
* they are a backing detail that round-trips via the table's UNIQUE constraint,
|
|
33
|
+
* not as a standalone CREATE INDEX. For store tables `buildTableSchemaFromAST`
|
|
34
|
+
* synthesizes none of those, so in practice every index is included; the guard
|
|
35
|
+
* is defensive. A `CREATE UNIQUE INDEX`'s derived UNIQUE constraint is already
|
|
36
|
+
* excluded from the table DDL by the generator, so it round-trips solely via
|
|
37
|
+
* its own `CREATE UNIQUE INDEX` line — no doubling.
|
|
38
|
+
*
|
|
39
|
+
* An *exposed* implicit index (a non-derived UNIQUE constraint tagged
|
|
40
|
+
* `quereus.expose_implicit_index = true`, never materialized in store mode)
|
|
41
|
+
* must NOT get a synthetic `CREATE INDEX` line — re-import would materialize a
|
|
42
|
+
* real `IndexSchema` and change the store-mode shape. Its user tags
|
|
43
|
+
* (`UniqueConstraintSchema.exposedIndexTags`) instead ride a trailing
|
|
44
|
+
* `alter index … set tags` line, which `importDDL` re-applies silently after
|
|
45
|
+
* the CREATE TABLE in the same entry has registered the constraint. Empty tag
|
|
46
|
+
* records emit no line, and `exposedImplicitIndexes` returns `[]` for
|
|
47
|
+
* memory-mode tables (name materialized) and orders descriptors by the
|
|
48
|
+
* `uniqueConstraints` array, so the bundle stays byte-deterministic — which
|
|
49
|
+
* the compare-write in `persistCatalogIfChanged` relies on.
|
|
50
|
+
*/
|
|
51
|
+
private buildCatalogEntry;
|
|
52
|
+
/**
|
|
53
|
+
* Encode a bundle of persisted schema text (DDL) for the catalog store.
|
|
54
|
+
* The guard is {@link assertPersistableDdlText} — see it for why the FULL text
|
|
55
|
+
* is checked, not just the object's name.
|
|
56
|
+
*/
|
|
57
|
+
private encodeCatalogDDL;
|
|
58
|
+
/**
|
|
59
|
+
* The catalog entry a plain table would be persisted as: its `{schema}.{table}` key
|
|
60
|
+
* (which {@link buildCatalogKey} refuses for an unencodable identifier) plus the DDL
|
|
61
|
+
* bundle {@link buildCatalogEntry} produces. Counterpart of {@link viewCatalogEntry} /
|
|
62
|
+
* {@link maintainedViewCatalogEntry}, and shared the same way — by both write paths
|
|
63
|
+
* ({@link saveTableDDL}, {@link persistTableCatalogEntryIfChanged}) and by the
|
|
64
|
+
* pre-flight veto ({@link assertCatalogObjectPersistable}) — so they cannot drift.
|
|
65
|
+
*/
|
|
66
|
+
private tableCatalogEntry;
|
|
67
|
+
/**
|
|
68
|
+
* Save table DDL (bundled with its secondary index DDL) to the catalog store.
|
|
69
|
+
* Unconditional put — every caller has just produced the authoritative bundle
|
|
70
|
+
* (create-index / drop-index / an `alterTable` arm / `renameTable`). For the
|
|
71
|
+
* event-driven `table_added` path, which may be re-delivered over an entry that
|
|
72
|
+
* is already current, use {@link persistTableCatalogEntryIfChanged}.
|
|
73
|
+
*/
|
|
74
|
+
saveTableDDL(tableSchema: TableSchema): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Compare-write a TABLE's catalog entry: write when the entry is absent or its
|
|
77
|
+
* bundle differs, skip when identical.
|
|
78
|
+
*
|
|
79
|
+
* Two callers, both needing exactly this shape:
|
|
80
|
+
* - the `table_added` arm of `StoreModuleSchemaSync.dispatchSchemaChange` — the
|
|
81
|
+
* authoritative write for a freshly registered store table, including one nobody
|
|
82
|
+
* ever reads or writes;
|
|
83
|
+
* - `StoreTableBase.initializeStore`'s first-storage-access backstop, which the
|
|
84
|
+
* `table_added` write normally renders a no-op.
|
|
85
|
+
*
|
|
86
|
+
* Distinct from both neighbours on purpose:
|
|
87
|
+
* - not {@link persistCatalogIfChanged}, whose absent → skip self-filter is exactly
|
|
88
|
+
* the case this path exists to cover (a brand-new table has no entry yet);
|
|
89
|
+
* - not bare {@link saveTableDDL}, which always puts — `table_added` is also
|
|
90
|
+
* delivered during rehydration for a store-hosted materialized-view backing, where
|
|
91
|
+
* the entry is already current and a blind put would dirty otherwise-identical
|
|
92
|
+
* catalog bytes.
|
|
93
|
+
*
|
|
94
|
+
* Shares {@link tableCatalogEntry} with the write and veto paths so all three agree
|
|
95
|
+
* on what a table's entry is.
|
|
96
|
+
*/
|
|
97
|
+
persistTableCatalogEntryIfChanged(tableSchema: TableSchema): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Remove DDL from the catalog store when a table is dropped.
|
|
100
|
+
*/
|
|
101
|
+
removeTableDDL(schemaName: string, tableName: string): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Persist a plain view's catalog entry (DDL via `generateViewDDL`), keyed by its
|
|
104
|
+
* reserved view prefix. Compare-write (skip identical) — see
|
|
105
|
+
* {@link persistObjectCatalogEntryIfChanged}.
|
|
106
|
+
*/
|
|
107
|
+
saveViewDDL(view: ViewSchema): Promise<void>;
|
|
108
|
+
/** Remove a plain view's catalog entry (on DROP VIEW). */
|
|
109
|
+
removeViewDDL(schemaName: string, viewName: string): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Persist a materialized view's catalog entry (DDL via `generateMaintainedTableDDL`
|
|
112
|
+
* over the maintained table — the unified record), keyed by its reserved MV
|
|
113
|
+
* prefix. Compare-write (skip identical) — see
|
|
114
|
+
* {@link persistObjectCatalogEntryIfChanged}.
|
|
115
|
+
*/
|
|
116
|
+
saveMaterializedViewDDL(mv: MaintainedTableSchema): Promise<void>;
|
|
117
|
+
/** Remove a materialized view's catalog entry (on DROP MATERIALIZED VIEW). */
|
|
118
|
+
removeMaterializedViewDDL(schemaName: string, mvName: string): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Pre-flight veto (see `VirtualTableModule.assertCatalogObjectPersistable`): refuse a
|
|
121
|
+
* view / materialized view / table whose catalog entry this module could not durably
|
|
122
|
+
* write.
|
|
123
|
+
*
|
|
124
|
+
* It runs exactly the derivation the write path runs — {@link viewCatalogEntry} /
|
|
125
|
+
* {@link maintainedViewCatalogEntry} / {@link tableCatalogEntry} build the key
|
|
126
|
+
* (rejecting an unencodable identifier) and {@link assertPersistableDdlText} checks the
|
|
127
|
+
* generated DDL text — so the veto and the write cannot disagree about what is
|
|
128
|
+
* persistable. It is the only synchronous path a rejection can travel: the actual save
|
|
129
|
+
* is chained onto `persistQueue` behind a `SchemaChangeNotifier` listener, and both
|
|
130
|
+
* layers swallow.
|
|
131
|
+
*
|
|
132
|
+
* The `'table'` kind arrives only from the RENAME pre-flight scan, which offers EVERY
|
|
133
|
+
* table in every schema whose record the propagation would rewrite — most of them not
|
|
134
|
+
* ours. {@link ownsTableCatalogEntry} is the synchronous self-filter that keeps a
|
|
135
|
+
* memory-backed dependent from being refused on our behalf.
|
|
136
|
+
*
|
|
137
|
+
* Gated on `subscribedDb === db`: this module persists a view/MV only while subscribed
|
|
138
|
+
* to that `Database`'s change notifier. Since `StoreModule.onRegister` subscribes at
|
|
139
|
+
* `Database.registerModule` — before any statement can run — the gate no longer
|
|
140
|
+
* shields an unsubscribed module from vetoing; it now only declines to answer on
|
|
141
|
+
* behalf of a *different* `Database` than the one this module serves (the
|
|
142
|
+
* one-instance-one-database posture `ensureSchemaSubscription` documents). That case
|
|
143
|
+
* writes nothing, so vetoing there would reject a definition that loses nothing.
|
|
144
|
+
*/
|
|
145
|
+
assertCatalogObjectPersistable(db: Database, kind: CatalogObjectKind, object: ViewSchema | TableSchema): void;
|
|
146
|
+
/**
|
|
147
|
+
* The entry {@link assertCatalogObjectPersistable} is being asked about, or `undefined`
|
|
148
|
+
* when this module would write none for it (a non-maintained table offered as
|
|
149
|
+
* `'materializedView'`, or a table we do not own).
|
|
150
|
+
*/
|
|
151
|
+
private prospectiveCatalogEntry;
|
|
152
|
+
/**
|
|
153
|
+
* Whether this module would be the one to write `table`'s catalog entry — the
|
|
154
|
+
* synchronous stand-in for the write path's absent-entry self-filter (see
|
|
155
|
+
* {@link persistCatalogIfChanged}), which reads the catalog store and so is unavailable
|
|
156
|
+
* to a hook that is synchronous and IO-free by contract.
|
|
157
|
+
*
|
|
158
|
+
* Also the self-filter for the `table_added` catalog write in
|
|
159
|
+
* `StoreModuleSchemaSync.dispatchSchemaChange`, which is likewise handed every table the
|
|
160
|
+
* engine registers regardless of who owns it.
|
|
161
|
+
*
|
|
162
|
+
* Ownership is tested exactly as `StoreModule.resolveOwnedTable` tests it: a table this
|
|
163
|
+
* session already touched (it is in `tables`), or one whose `vtabModule` is this module
|
|
164
|
+
* — or a WRAPPER exposing this module as `underlying`, which is what a store table looks
|
|
165
|
+
* like under `@quereus/quereus-isolation` (its `vtabModule` is the `IsolationModule`).
|
|
166
|
+
* Not ours ⇒ no entry ⇒ no check, which is what keeps a memory-backed dependent table in
|
|
167
|
+
* a database that also has store tables from being refused.
|
|
168
|
+
*
|
|
169
|
+
* It now agrees exactly with the `table_added` write path, which applies this same
|
|
170
|
+
* filter and then compare-writes ({@link persistTableCatalogEntryIfChanged}) with no
|
|
171
|
+
* absent → skip. It stays STRICTER than the `table_modified` write path
|
|
172
|
+
* ({@link persistCatalogIfChanged}), which skips an absent entry; refusing there is the
|
|
173
|
+
* safe side, since that table's own catalog write would throw on the diverged text
|
|
174
|
+
* anyway, on the swallowing persist queue with nothing left to tell the user.
|
|
175
|
+
*/
|
|
176
|
+
protected ownsTableCatalogEntry(table: TableSchema): boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Compare-write a catalog entry: write only when the entry is absent or its DDL
|
|
179
|
+
* differs from `newDDL` (skip identical). Unlike {@link persistCatalogIfChanged}
|
|
180
|
+
* there is **no** absent→skip self-filter — the callers have already established
|
|
181
|
+
* that the object belongs in this db's catalog (a view/MV unconditionally, since
|
|
182
|
+
* one module instance serves one Database; a table via
|
|
183
|
+
* {@link persistTableCatalogEntryIfChanged}'s ownership filter). Skipping identical
|
|
184
|
+
* writes makes any event whose regenerated DDL is unchanged (e.g. a
|
|
185
|
+
* `materialized_view_refreshed`, or a `table_added` re-delivered for an
|
|
186
|
+
* already-persisted materialized-view backing during rehydration) a no-op, so a
|
|
187
|
+
* second consecutive reopen yields identical catalog bytes. (View/MV rehydration
|
|
188
|
+
* itself fires no view/MV events at all — `importCatalog` is silent.)
|
|
189
|
+
*/
|
|
190
|
+
private persistObjectCatalogEntryIfChanged;
|
|
191
|
+
/**
|
|
192
|
+
* Read-compare-write the catalog DDL for a table that just fired `table_modified`.
|
|
193
|
+
*
|
|
194
|
+
* - **Absent** catalog entry → the table is not store-backed in this catalog (a
|
|
195
|
+
* memory table in the same `db`, or a store table never persisted) → skip. This
|
|
196
|
+
* self-filters foreign-module tables without relying on `vtabModule` identity
|
|
197
|
+
* (which points at the isolation wrapper when wrapped).
|
|
198
|
+
* - **Present** but identical DDL → skip (no redundant write). This is what makes a
|
|
199
|
+
* structural ALTER — whose own `alterTable` already wrote the final DDL, then fires
|
|
200
|
+
* `table_modified` with that same final schema — a no-op here (no double-write).
|
|
201
|
+
* - **Present** and different DDL → re-persist (the tag swap; or a beneficial
|
|
202
|
+
* propagated rewrite of a dependent store table).
|
|
203
|
+
*/
|
|
204
|
+
protected persistCatalogIfChanged(key: Uint8Array, newObject: TableSchema): Promise<void>;
|
|
205
|
+
/**
|
|
206
|
+
* Load all DDL **values** from the catalog store (keys discarded).
|
|
207
|
+
* Used to restore persisted tables on startup and by tests asserting persisted DDL.
|
|
208
|
+
* Note: this returns table, view, AND materialized-view entries intermixed —
|
|
209
|
+
* `StoreModuleSchemaSync.rehydrateCatalog` uses {@link loadCatalogEntries} (keys retained) to
|
|
210
|
+
* classify them. Meta entries (e.g. the clean-shutdown marker) are not DDL
|
|
211
|
+
* and are filtered out.
|
|
212
|
+
*/
|
|
213
|
+
loadAllDDL(): Promise<string[]>;
|
|
214
|
+
/**
|
|
215
|
+
* Load every catalog entry as `{ key, ddl }`. Unlike {@link loadAllDDL} (values
|
|
216
|
+
* only) this retains the key so `StoreModuleSchemaSync.rehydrateCatalog` can classify each entry
|
|
217
|
+
* (table / view / materialized view) by its reserved key prefix.
|
|
218
|
+
*/
|
|
219
|
+
protected loadCatalogEntries(): Promise<Array<{
|
|
220
|
+
key: Uint8Array;
|
|
221
|
+
ddl: string;
|
|
222
|
+
}>>;
|
|
223
|
+
/**
|
|
224
|
+
* Consume the clean-shutdown marker, deleting it in the same breath (single-use).
|
|
225
|
+
*
|
|
226
|
+
* Returns `{ trusted, staleAtClose }`:
|
|
227
|
+
* - `trusted` — the marker was present AND its payload parsed as a string array.
|
|
228
|
+
* Absence (a fresh store, a crash, or a prior rehydrate without an intervening
|
|
229
|
+
* `StoreModule.closeAll`) yields `false`, so every adopt this session falls back to
|
|
230
|
+
* refill.
|
|
231
|
+
* - `staleAtClose` — the qualified lowercased `schema.mv` names that were
|
|
232
|
+
* stale-at-close (written by `StoreModule.closeAll`); those MVs refill even under trust.
|
|
233
|
+
*
|
|
234
|
+
* Conservative parse: any unparseable / wrong-shape payload (including a legacy
|
|
235
|
+
* bare `'1'`, which parses to a number, not an array) degrades to
|
|
236
|
+
* `{ trusted: false, staleAtClose: ∅ }` — refill everything — rather than
|
|
237
|
+
* trust-everything. The marker is deleted regardless of parse outcome.
|
|
238
|
+
*/
|
|
239
|
+
protected consumeCleanShutdownMarker(): Promise<{
|
|
240
|
+
trusted: boolean;
|
|
241
|
+
staleAtClose: ReadonlySet<string>;
|
|
242
|
+
}>;
|
|
243
|
+
/**
|
|
244
|
+
* Write the durable stale-MV set (`\x00meta\x00stale_mvs`) with `sync: true`. Unlike
|
|
245
|
+
* the clean-shutdown marker this entry is persistent current-truth — overwritten as
|
|
246
|
+
* staleness changes, never deleted — so a crash leaves the last synced value intact.
|
|
247
|
+
* The `sync` mirrors the marker-consume delete's durability discipline (and carries
|
|
248
|
+
* the same documented backend caveat: a backend without a durability knob no-ops it).
|
|
249
|
+
*/
|
|
250
|
+
protected writeDurableStaleMvSet(json: string): Promise<void>;
|
|
251
|
+
/**
|
|
252
|
+
* Read + conservative-parse the durable stale-MV set, mirroring
|
|
253
|
+
* {@link consumeCleanShutdownMarker}'s parse discipline (but READ-only — never
|
|
254
|
+
* deleted). Returns:
|
|
255
|
+
* - `{ present: false }` — no entry on disk (a pre-atomic store, or an upgrade where
|
|
256
|
+
* the capability was gained but no stale-set has been written yet) → the caller
|
|
257
|
+
* falls back to the clean-shutdown marker path.
|
|
258
|
+
* - `{ present: true, stale }` — the parsed set of qualified `schema.mv` names.
|
|
259
|
+
* - `{ present: true, stale: null }` — a present but unparseable / wrong-shape payload
|
|
260
|
+
* → the caller refills everything (the always-safe posture).
|
|
261
|
+
*/
|
|
262
|
+
protected readDurableStaleMvSet(): Promise<{
|
|
263
|
+
present: false;
|
|
264
|
+
} | {
|
|
265
|
+
present: true;
|
|
266
|
+
stale: ReadonlySet<string> | null;
|
|
267
|
+
}>;
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=store-module-catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-module-catalog.d.ts","sourceRoot":"","sources":["../../../src/common/store-module-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,qBAAqB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAsBpH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AA8CzD,8BAAsB,kBAAmB,SAAQ,eAAe;IAC/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,OAAO,CAAC,iBAAiB;IAkBzB;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAKxB;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB;IAOzB;;;;;;OAMG;IACG,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAM3D;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,iCAAiC,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAKhF;;OAEG;IACG,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM1E;;;;OAIG;IACG,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlD,0DAA0D;IACpD,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKxE;;;;;OAKG;IACG,uBAAuB,CAAC,EAAE,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQvE,8EAA8E;IACxE,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlF;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IAMH,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,IAAI;IAM7G;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;IAc/B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,SAAS,CAAC,qBAAqB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAO5D;;;;;;;;;;;;OAYG;YACW,kCAAkC;IAOhD;;;;;;;;;;;;OAYG;cACa,uBAAuB,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB/F;;;;;;;OAOG;IACG,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAerC;;;;OAIG;cACa,kBAAkB,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,GAAG,EAAE,UAAU,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAUtF;;;;;;;;;;;;;;;OAeG;cACa,0BAA0B,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;KAAE,CAAC;IA8B9G;;;;;;OAMG;cACa,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASnE;;;;;;;;;;OAUG;cACa,qBAAqB,IAAI,OAAO,CAC/C;QAAE,OAAO,EAAE,KAAK,CAAA;KAAE,GAAG;QAAE,OAAO,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;KAAE,CACzE;CAoBD"}
|