@indigoai-us/hq-cloud 6.16.58-alpha.3 → 6.16.59
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/dist/bin/sync-runner-company.d.ts +0 -14
- package/dist/bin/sync-runner-company.d.ts.map +1 -1
- package/dist/bin/sync-runner-company.js +89 -57
- package/dist/bin/sync-runner-company.js.map +1 -1
- package/dist/bin/sync-runner-company.test.js +313 -56
- package/dist/bin/sync-runner-company.test.js.map +1 -1
- package/dist/bin/sync-runner-planning.d.ts +3 -12
- package/dist/bin/sync-runner-planning.d.ts.map +1 -1
- package/dist/bin/sync-runner-planning.js +3 -65
- package/dist/bin/sync-runner-planning.js.map +1 -1
- package/dist/bin/sync-runner-planning.test.js +1 -172
- package/dist/bin/sync-runner-planning.test.js.map +1 -1
- package/dist/bin/sync-runner-watch-loop.d.ts +2 -51
- package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +165 -409
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner-watch-routes.d.ts +2 -19
- package/dist/bin/sync-runner-watch-routes.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-routes.js +5 -40
- package/dist/bin/sync-runner-watch-routes.js.map +1 -1
- package/dist/bin/sync-runner-watch-routes.test.js +0 -47
- package/dist/bin/sync-runner-watch-routes.test.js.map +1 -1
- package/dist/bin/sync-runner.d.ts +13 -59
- package/dist/bin/sync-runner.d.ts.map +1 -1
- package/dist/bin/sync-runner.js +4 -48
- package/dist/bin/sync-runner.js.map +1 -1
- package/dist/bin/sync-runner.test.js +229 -1499
- package/dist/bin/sync-runner.test.js.map +1 -1
- package/dist/cli/share.d.ts +0 -19
- package/dist/cli/share.d.ts.map +1 -1
- package/dist/cli/share.js +0 -55
- package/dist/cli/share.js.map +1 -1
- package/dist/cli/share.test.js +1 -87
- package/dist/cli/share.test.js.map +1 -1
- package/dist/cli/sync-scope.test.js +0 -8
- package/dist/cli/sync-scope.test.js.map +1 -1
- package/dist/cli/sync.d.ts +8 -12
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +152 -302
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/sync.test.js +126 -256
- package/dist/cli/sync.test.js.map +1 -1
- package/dist/cognito-auth.d.ts +34 -1
- package/dist/cognito-auth.d.ts.map +1 -1
- package/dist/cognito-auth.js +92 -21
- package/dist/cognito-auth.js.map +1 -1
- package/dist/context.d.ts +5 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +92 -12
- package/dist/context.js.map +1 -1
- package/dist/context.test.js +77 -2
- package/dist/context.test.js.map +1 -1
- package/dist/ignore.d.ts +10 -0
- package/dist/ignore.d.ts.map +1 -1
- package/dist/ignore.js +47 -5
- package/dist/ignore.js.map +1 -1
- package/dist/ignore.test.js +30 -3
- package/dist/ignore.test.js.map +1 -1
- package/dist/journal-row-store.d.ts +5 -40
- package/dist/journal-row-store.d.ts.map +1 -1
- package/dist/journal-row-store.js +21 -240
- package/dist/journal-row-store.js.map +1 -1
- package/dist/journal-row-store.test.js +0 -54
- package/dist/journal-row-store.test.js.map +1 -1
- package/dist/journal-snapshot-v4.d.ts.map +1 -1
- package/dist/journal-snapshot-v4.js +6 -11
- package/dist/journal-snapshot-v4.js.map +1 -1
- package/dist/journal-store.test.js +7 -324
- package/dist/journal-store.test.js.map +1 -1
- package/dist/journal.d.ts +16 -51
- package/dist/journal.d.ts.map +1 -1
- package/dist/journal.js +79 -303
- package/dist/journal.js.map +1 -1
- package/dist/lib/exit-codes.d.ts +0 -15
- package/dist/lib/exit-codes.d.ts.map +1 -1
- package/dist/lib/exit-codes.js +0 -15
- package/dist/lib/exit-codes.js.map +1 -1
- package/dist/lib/net-errors.d.ts +12 -0
- package/dist/lib/net-errors.d.ts.map +1 -1
- package/dist/lib/net-errors.js +35 -0
- package/dist/lib/net-errors.js.map +1 -1
- package/dist/lib/net-errors.test.js +19 -1
- package/dist/lib/net-errors.test.js.map +1 -1
- package/dist/machine-auth.test.js +6 -4
- package/dist/machine-auth.test.js.map +1 -1
- package/dist/machine-token-cache-isolation.test.d.ts +24 -0
- package/dist/machine-token-cache-isolation.test.d.ts.map +1 -0
- package/dist/machine-token-cache-isolation.test.js +241 -0
- package/dist/machine-token-cache-isolation.test.js.map +1 -0
- package/dist/manifest/build-manifest-resident-parity.test.js +3 -3
- package/dist/manifest/build-manifest-resident-parity.test.js.map +1 -1
- package/dist/personal-vault.d.ts.map +1 -1
- package/dist/personal-vault.js +3 -10
- package/dist/personal-vault.js.map +1 -1
- package/dist/personal-vault.test.js +0 -35
- package/dist/personal-vault.test.js.map +1 -1
- package/dist/remote-pull.d.ts.map +1 -1
- package/dist/remote-pull.js +2 -9
- package/dist/remote-pull.js.map +1 -1
- package/dist/remote-pull.test.js +2 -59
- package/dist/remote-pull.test.js.map +1 -1
- package/dist/s3.d.ts +0 -1
- package/dist/s3.d.ts.map +1 -1
- package/dist/s3.js +2 -20
- package/dist/s3.js.map +1 -1
- package/dist/sync/area-ledger.d.ts +3 -27
- package/dist/sync/area-ledger.d.ts.map +1 -1
- package/dist/sync/area-ledger.js +39 -149
- package/dist/sync/area-ledger.js.map +1 -1
- package/dist/sync/area-ledger.test.js +5 -192
- package/dist/sync/area-ledger.test.js.map +1 -1
- package/dist/sync/parallel-sync-coordinator.test.js +0 -29
- package/dist/sync/parallel-sync-coordinator.test.js.map +1 -1
- package/dist/sync/realtime-telemetry.d.ts +1 -1
- package/dist/sync/realtime-telemetry.d.ts.map +1 -1
- package/dist/sync/realtime-telemetry.js +6 -14
- package/dist/sync/realtime-telemetry.js.map +1 -1
- package/dist/sync/realtime-telemetry.test.js +16 -136
- package/dist/sync/realtime-telemetry.test.js.map +1 -1
- package/dist/sync/state-store.d.ts +0 -6
- package/dist/sync/state-store.d.ts.map +1 -1
- package/dist/sync/state-store.js +2 -14
- package/dist/sync/state-store.js.map +1 -1
- package/dist/watcher.d.ts +0 -12
- package/dist/watcher.d.ts.map +1 -1
- package/dist/watcher.js +0 -131
- package/dist/watcher.js.map +1 -1
- package/dist/watcher.test.js +0 -63
- package/dist/watcher.test.js.map +1 -1
- package/package.json +1 -2
- package/dist/cli/onepass-pull-planner-regressions.test.d.ts +0 -2
- package/dist/cli/onepass-pull-planner-regressions.test.d.ts.map +0 -1
- package/dist/cli/onepass-pull-planner-regressions.test.js +0 -300
- package/dist/cli/onepass-pull-planner-regressions.test.js.map +0 -1
- package/dist/cli/onepass-pull-planner.test.d.ts +0 -2
- package/dist/cli/onepass-pull-planner.test.d.ts.map +0 -1
- package/dist/cli/onepass-pull-planner.test.js +0 -266
- package/dist/cli/onepass-pull-planner.test.js.map +0 -1
- package/dist/cli/streaming-pull-planner.bench.test.d.ts +0 -15
- package/dist/cli/streaming-pull-planner.bench.test.d.ts.map +0 -1
- package/dist/cli/streaming-pull-planner.bench.test.js +0 -273
- package/dist/cli/streaming-pull-planner.bench.test.js.map +0 -1
- package/dist/s3.list-cost.test.d.ts +0 -2
- package/dist/s3.list-cost.test.d.ts.map +0 -1
- package/dist/s3.list-cost.test.js +0 -51
- package/dist/s3.list-cost.test.js.map +0 -1
- package/dist/sync/remote-file-spool.d.ts +0 -16
- package/dist/sync/remote-file-spool.d.ts.map +0 -1
- package/dist/sync/remote-file-spool.js +0 -91
- package/dist/sync/remote-file-spool.js.map +0 -1
- package/dist/sync/remote-file-spool.test.d.ts +0 -2
- package/dist/sync/remote-file-spool.test.d.ts.map +0 -1
- package/dist/sync/remote-file-spool.test.js +0 -77
- package/dist/sync/remote-file-spool.test.js.map +0 -1
|
@@ -28,19 +28,6 @@ export interface JournalRowStoreOptions {
|
|
|
28
28
|
/** Retain row-level before-images so callers can derive a delta. Defaults to true. */
|
|
29
29
|
trackChanges?: boolean;
|
|
30
30
|
}
|
|
31
|
-
/**
|
|
32
|
-
* A compact, insertion-ordered directory-prefix index. The immutable bulk is
|
|
33
|
-
* stored in packed row-id ranges; only rows structurally changed after the
|
|
34
|
-
* index was built need JavaScript sets.
|
|
35
|
-
*/
|
|
36
|
-
interface JournalPrefixIndex {
|
|
37
|
-
readonly prefixIds: Map<string, number>;
|
|
38
|
-
readonly offsets: Uint32Array;
|
|
39
|
-
readonly rowIds: Uint32Array;
|
|
40
|
-
readonly changedRows: Set<number>;
|
|
41
|
-
readonly appendedRows: Map<number, Set<number>>;
|
|
42
|
-
nextPrefixId: number;
|
|
43
|
-
}
|
|
44
31
|
/**
|
|
45
32
|
* The packed row sections carried by HQSNAP4. Typed arrays are intentionally
|
|
46
33
|
* views: the snapshot decoder installs them without decoding rows into objects.
|
|
@@ -130,8 +117,6 @@ export interface JournalRowOverlayChange {
|
|
|
130
117
|
export declare class JournalRowOverlay implements JournalRowsView {
|
|
131
118
|
private readonly base;
|
|
132
119
|
private readonly changes;
|
|
133
|
-
/** Base keys deleted then reinserted must move to the record's tail. */
|
|
134
|
-
private readonly moved;
|
|
135
120
|
private readonly dirtyPaths;
|
|
136
121
|
private dirtyLog;
|
|
137
122
|
constructor(base: JournalRowSource);
|
|
@@ -143,19 +128,17 @@ export declare class JournalRowOverlay implements JournalRowsView {
|
|
|
143
128
|
keys(): IterableIterator<string>;
|
|
144
129
|
entries(): IterableIterator<[string, Readonly<JournalEntry>]>;
|
|
145
130
|
values(): IterableIterator<Readonly<JournalEntry>>;
|
|
146
|
-
entriesForPrefix(prefix: string): IterableIterator<[string, Readonly<JournalEntry>]>;
|
|
147
131
|
toRecord(): Record<string, JournalEntry>;
|
|
148
132
|
dirtyLogSnapshot(): readonly JournalRowOverlayChange[];
|
|
149
133
|
drainDirtyLog(): JournalRowOverlayChange[];
|
|
150
134
|
/**
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
135
|
+
* Drop rows whose delta has reached the shared store. The overlay never owns
|
|
136
|
+
* the base, so its caller must publish first; retaining these materialized
|
|
137
|
+
* replacements after a successful checkpoint would recreate a full journal
|
|
138
|
+
* copy over a long full-sync pass.
|
|
154
139
|
*/
|
|
155
|
-
|
|
156
|
-
private entriesForPrefixByKey;
|
|
140
|
+
clearCommittedChanges(): void;
|
|
157
141
|
private recordDirty;
|
|
158
|
-
private setReplacement;
|
|
159
142
|
}
|
|
160
143
|
/**
|
|
161
144
|
* A struct-of-arrays store for resident journal rows. It deliberately owns no
|
|
@@ -180,15 +163,6 @@ export declare class JournalRowStore {
|
|
|
180
163
|
private buckets;
|
|
181
164
|
private readonly directories;
|
|
182
165
|
private readonly directoryIds;
|
|
183
|
-
/**
|
|
184
|
-
* Prefix candidates are valuable only to a prefix scan. Snapshot recovery
|
|
185
|
-
* also constructs row stores for whole-journal writers (notably the short
|
|
186
|
-
* reverse shadow), where building this index would add an O(rows) pause to
|
|
187
|
-
* an operation that never queries a prefix. Build its packed ranges at an
|
|
188
|
-
* explicit warm boundary or on the first scan, then retain only structural
|
|
189
|
-
* changes in the small mutable overlay.
|
|
190
|
-
*/
|
|
191
|
-
private prefixRows;
|
|
192
166
|
private readonly authors;
|
|
193
167
|
private readonly authorIds;
|
|
194
168
|
private readonly freeRows;
|
|
@@ -237,8 +211,6 @@ export declare class JournalRowStore {
|
|
|
237
211
|
entriesForPrefix(prefix: string): IterableIterator<[string, Readonly<JournalEntry>]>;
|
|
238
212
|
values(): IterableIterator<Readonly<JournalEntry>>;
|
|
239
213
|
toRecord(): Record<string, JournalEntry>;
|
|
240
|
-
/** Build packed prefix candidates before a latency-sensitive targeted-pull phase. */
|
|
241
|
-
preparePrefixIndex(): JournalPrefixIndex;
|
|
242
214
|
/**
|
|
243
215
|
* Returns and clears changes since the prior checkpoint.
|
|
244
216
|
*
|
|
@@ -274,12 +246,6 @@ export declare class JournalRowStore {
|
|
|
274
246
|
static fromSnapshot(snapshot: JournalRowStoreSnapshot): JournalRowStore;
|
|
275
247
|
private reset;
|
|
276
248
|
private insertWithoutDirtyLog;
|
|
277
|
-
private addRowToPrefixIndex;
|
|
278
|
-
private removeRowFromPrefixIndex;
|
|
279
|
-
private ensurePrefixId;
|
|
280
|
-
private addDynamicPrefixRow;
|
|
281
|
-
private removeDynamicPrefixRow;
|
|
282
|
-
private prefixesForPath;
|
|
283
249
|
private recordDirty;
|
|
284
250
|
private allocateRow;
|
|
285
251
|
private ensureRowCapacity;
|
|
@@ -295,7 +261,6 @@ export declare class JournalRowStore {
|
|
|
295
261
|
private storeLeafFallback;
|
|
296
262
|
private leafBytes;
|
|
297
263
|
private pathForRow;
|
|
298
|
-
private pathForRowForPrefixIndex;
|
|
299
264
|
private findRowId;
|
|
300
265
|
private findIndexedRow;
|
|
301
266
|
private ensureBucketCapacity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal-row-store.d.ts","sourceRoot":"","sources":["../src/journal-row-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,gGAAgG;AAChG,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;CAiB6B,CAAC;AAEhE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;CAClD;AAED,MAAM,WAAW,sBAAsB;IACrC,sFAAsF;IACtF,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED
|
|
1
|
+
{"version":3,"file":"journal-row-store.d.ts","sourceRoot":"","sources":["../src/journal-row-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,gGAAgG;AAChG,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;CAiB6B,CAAC;AAEhE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,E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
|
-
/** Base keys deleted then reinserted must move to the record's tail. */
|
|
199
|
-
moved = new Set();
|
|
200
198
|
dirtyPaths = new Set();
|
|
201
199
|
dirtyLog = [];
|
|
202
200
|
constructor(base) {
|
|
203
201
|
this.base = base;
|
|
204
202
|
}
|
|
205
203
|
get size() {
|
|
206
|
-
if ("size" in this.base && typeof this.base.size === "number") {
|
|
207
|
-
let size = this.base.size;
|
|
208
|
-
for (const [key, entry] of this.changes) {
|
|
209
|
-
const baseHasKey = this.base.has(key);
|
|
210
|
-
if (entry === undefined && baseHasKey)
|
|
211
|
-
size -= 1;
|
|
212
|
-
else if (entry !== undefined && !baseHasKey)
|
|
213
|
-
size += 1;
|
|
214
|
-
}
|
|
215
|
-
return size;
|
|
216
|
-
}
|
|
217
204
|
let size = 0;
|
|
218
205
|
for (const _ of this.keys())
|
|
219
206
|
size += 1;
|
|
@@ -227,7 +214,7 @@ export class JournalRowOverlay {
|
|
|
227
214
|
}
|
|
228
215
|
set(path, entry) {
|
|
229
216
|
this.recordDirty(path);
|
|
230
|
-
this.
|
|
217
|
+
this.changes.set(path, freezeEntry(structuredClone(entry)));
|
|
231
218
|
}
|
|
232
219
|
delete(path) {
|
|
233
220
|
if (!this.has(path))
|
|
@@ -238,14 +225,12 @@ export class JournalRowOverlay {
|
|
|
238
225
|
}
|
|
239
226
|
*keys() {
|
|
240
227
|
for (const key of this.base.keys()) {
|
|
241
|
-
if (this.moved.has(key))
|
|
242
|
-
continue;
|
|
243
228
|
if (this.changes.get(key) === undefined && this.changes.has(key))
|
|
244
229
|
continue;
|
|
245
230
|
yield key;
|
|
246
231
|
}
|
|
247
232
|
for (const [key, entry] of this.changes) {
|
|
248
|
-
if (entry !== undefined &&
|
|
233
|
+
if (entry !== undefined && !this.base.has(key))
|
|
249
234
|
yield key;
|
|
250
235
|
}
|
|
251
236
|
}
|
|
@@ -260,24 +245,6 @@ export class JournalRowOverlay {
|
|
|
260
245
|
for (const [, entry] of this.entries())
|
|
261
246
|
yield entry;
|
|
262
247
|
}
|
|
263
|
-
*entriesForPrefix(prefix) {
|
|
264
|
-
const normalizedPrefix = prefix.replace(/\/+$/, "");
|
|
265
|
-
const base = this.base;
|
|
266
|
-
const baseEntries = base.entriesForPrefix?.(normalizedPrefix) ?? this.entriesForPrefixByKey(normalizedPrefix);
|
|
267
|
-
for (const [key, entry] of baseEntries) {
|
|
268
|
-
if (this.moved.has(key))
|
|
269
|
-
continue;
|
|
270
|
-
const replacement = this.changes.has(key) ? this.changes.get(key) : entry;
|
|
271
|
-
if (replacement !== undefined)
|
|
272
|
-
yield [key, replacement];
|
|
273
|
-
}
|
|
274
|
-
for (const [key, entry] of this.changes) {
|
|
275
|
-
if (entry === undefined || (this.base.has(key) && !this.moved.has(key)))
|
|
276
|
-
continue;
|
|
277
|
-
if (isPrefixMatch(key, normalizedPrefix))
|
|
278
|
-
yield [key, entry];
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
248
|
toRecord() {
|
|
282
249
|
const record = {};
|
|
283
250
|
for (const [key, entry] of this.entries())
|
|
@@ -294,31 +261,15 @@ export class JournalRowOverlay {
|
|
|
294
261
|
return drained;
|
|
295
262
|
}
|
|
296
263
|
/**
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
264
|
+
* Drop rows whose delta has reached the shared store. The overlay never owns
|
|
265
|
+
* the base, so its caller must publish first; retaining these materialized
|
|
266
|
+
* replacements after a successful checkpoint would recreate a full journal
|
|
267
|
+
* copy over a long full-sync pass.
|
|
300
268
|
*/
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
for (const key of this.moved)
|
|
306
|
-
next.moved.add(key);
|
|
307
|
-
for (const key of deletes)
|
|
308
|
-
next.changes.set(key, undefined);
|
|
309
|
-
for (const [key, entry] of Object.entries(upserts)) {
|
|
310
|
-
next.setReplacement(key, freezeEntry(structuredClone(entry)));
|
|
311
|
-
}
|
|
312
|
-
return next;
|
|
313
|
-
}
|
|
314
|
-
*entriesForPrefixByKey(prefix) {
|
|
315
|
-
for (const key of this.base.keys()) {
|
|
316
|
-
if (!isPrefixMatch(key, prefix))
|
|
317
|
-
continue;
|
|
318
|
-
const entry = this.base.get(key);
|
|
319
|
-
if (entry !== undefined)
|
|
320
|
-
yield [key, entry];
|
|
321
|
-
}
|
|
269
|
+
clearCommittedChanges() {
|
|
270
|
+
this.changes.clear();
|
|
271
|
+
this.dirtyLog = [];
|
|
272
|
+
this.dirtyPaths.clear();
|
|
322
273
|
}
|
|
323
274
|
recordDirty(path) {
|
|
324
275
|
if (this.dirtyPaths.has(path))
|
|
@@ -331,17 +282,6 @@ export class JournalRowOverlay {
|
|
|
331
282
|
previousFingerprint: previous === undefined ? undefined : journalEntryFingerprint(previous),
|
|
332
283
|
}));
|
|
333
284
|
}
|
|
334
|
-
setReplacement(path, entry) {
|
|
335
|
-
if (this.changes.get(path) === undefined && this.changes.has(path)) {
|
|
336
|
-
this.changes.delete(path);
|
|
337
|
-
if (this.base.has(path))
|
|
338
|
-
this.moved.add(path);
|
|
339
|
-
}
|
|
340
|
-
this.changes.set(path, entry);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
function isPrefixMatch(key, normalizedPrefix) {
|
|
344
|
-
return normalizedPrefix === "" || key === normalizedPrefix || key.startsWith(`${normalizedPrefix}/`);
|
|
345
285
|
}
|
|
346
286
|
/**
|
|
347
287
|
* A struct-of-arrays store for resident journal rows. It deliberately owns no
|
|
@@ -366,15 +306,6 @@ export class JournalRowStore {
|
|
|
366
306
|
buckets;
|
|
367
307
|
directories = [""];
|
|
368
308
|
directoryIds = new Map([["", 0]]);
|
|
369
|
-
/**
|
|
370
|
-
* Prefix candidates are valuable only to a prefix scan. Snapshot recovery
|
|
371
|
-
* also constructs row stores for whole-journal writers (notably the short
|
|
372
|
-
* reverse shadow), where building this index would add an O(rows) pause to
|
|
373
|
-
* an operation that never queries a prefix. Build its packed ranges at an
|
|
374
|
-
* explicit warm boundary or on the first scan, then retain only structural
|
|
375
|
-
* changes in the small mutable overlay.
|
|
376
|
-
*/
|
|
377
|
-
prefixRows;
|
|
378
309
|
authors = [""];
|
|
379
310
|
authorIds = new Map();
|
|
380
311
|
freeRows = [];
|
|
@@ -494,7 +425,6 @@ export class JournalRowStore {
|
|
|
494
425
|
this.storeLeafFallback(rowId, leaf, leafBytes);
|
|
495
426
|
this.insertIndex(rowId);
|
|
496
427
|
this.appendIterationRow(rowId);
|
|
497
|
-
this.addRowToPrefixIndex(rowId, path);
|
|
498
428
|
this.liveRows++;
|
|
499
429
|
}
|
|
500
430
|
delete(path) {
|
|
@@ -503,7 +433,6 @@ export class JournalRowStore {
|
|
|
503
433
|
return false;
|
|
504
434
|
if (this.trackChanges)
|
|
505
435
|
this.recordDirty(rowId, path, true, journalEntryFingerprint(this.materialize(rowId)));
|
|
506
|
-
this.removeRowFromPrefixIndex(rowId, path);
|
|
507
436
|
this.deleteIndex(rowId);
|
|
508
437
|
this.removeIterationRow(rowId);
|
|
509
438
|
this.clearRow(rowId);
|
|
@@ -532,33 +461,17 @@ export class JournalRowStore {
|
|
|
532
461
|
yield* this.entries();
|
|
533
462
|
return;
|
|
534
463
|
}
|
|
535
|
-
const
|
|
536
|
-
const
|
|
537
|
-
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
const rowId = index.rowIds[offset];
|
|
547
|
-
if (index.changedRows.has(rowId))
|
|
548
|
-
continue;
|
|
549
|
-
yield [this.pathForRow(rowId), this.materialize(rowId)];
|
|
550
|
-
}
|
|
551
|
-
const appended = index.appendedRows.get(prefixId);
|
|
552
|
-
if (appended === undefined)
|
|
553
|
-
return;
|
|
554
|
-
for (const rowId of appended) {
|
|
555
|
-
if (this.freeRowSet.has(rowId))
|
|
556
|
-
continue;
|
|
557
|
-
const path = this.pathForRow(rowId);
|
|
558
|
-
// A reused row id may still occur in an older dynamic bucket. The
|
|
559
|
-
// immutable index never has that ambiguity because changed rows skip it.
|
|
560
|
-
if (isPrefixMatch(path, normalizedPrefix))
|
|
561
|
-
yield [path, this.materialize(rowId)];
|
|
464
|
+
const exactRowId = this.findRowId(normalizedPrefix);
|
|
465
|
+
const descendantPrefix = `${normalizedPrefix}/`;
|
|
466
|
+
for (let rowId = this.firstIterationRowId; rowId !== -1;) {
|
|
467
|
+
const nextRowId = this.iterationNext[rowId];
|
|
468
|
+
const directory = this.directories[this.dirIds[rowId]];
|
|
469
|
+
if (rowId === exactRowId ||
|
|
470
|
+
directory === normalizedPrefix ||
|
|
471
|
+
directory.startsWith(descendantPrefix)) {
|
|
472
|
+
yield [this.pathForRow(rowId), this.materialize(rowId)];
|
|
473
|
+
}
|
|
474
|
+
rowId = nextRowId;
|
|
562
475
|
}
|
|
563
476
|
}
|
|
564
477
|
*values() {
|
|
@@ -577,52 +490,6 @@ export class JournalRowStore {
|
|
|
577
490
|
}
|
|
578
491
|
return record;
|
|
579
492
|
}
|
|
580
|
-
/** Build packed prefix candidates before a latency-sensitive targeted-pull phase. */
|
|
581
|
-
preparePrefixIndex() {
|
|
582
|
-
if (this.prefixRows !== undefined)
|
|
583
|
-
return this.prefixRows;
|
|
584
|
-
const prefixIds = new Map();
|
|
585
|
-
for (const rowId of this.rowIds()) {
|
|
586
|
-
for (const prefix of this.prefixesForPath(this.pathForRowForPrefixIndex(rowId))) {
|
|
587
|
-
if (!prefixIds.has(prefix))
|
|
588
|
-
prefixIds.set(prefix, prefixIds.size);
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
const counts = new Uint32Array(prefixIds.size);
|
|
592
|
-
for (const rowId of this.rowIds()) {
|
|
593
|
-
const path = this.pathForRowForPrefixIndex(rowId);
|
|
594
|
-
const ownPrefixId = prefixIds.get(path);
|
|
595
|
-
if (ownPrefixId !== undefined)
|
|
596
|
-
counts[ownPrefixId] += 1;
|
|
597
|
-
for (const prefix of this.prefixesForPath(path))
|
|
598
|
-
counts[prefixIds.get(prefix)] += 1;
|
|
599
|
-
}
|
|
600
|
-
const offsets = new Uint32Array(prefixIds.size + 1);
|
|
601
|
-
for (let prefixId = 0; prefixId < counts.length; prefixId += 1) {
|
|
602
|
-
offsets[prefixId + 1] = offsets[prefixId] + counts[prefixId];
|
|
603
|
-
}
|
|
604
|
-
const nextOffsets = new Uint32Array(offsets);
|
|
605
|
-
const rowIds = new Uint32Array(offsets[offsets.length - 1]);
|
|
606
|
-
for (const rowId of this.rowIds()) {
|
|
607
|
-
const path = this.pathForRowForPrefixIndex(rowId);
|
|
608
|
-
const ownPrefixId = prefixIds.get(path);
|
|
609
|
-
if (ownPrefixId !== undefined)
|
|
610
|
-
rowIds[nextOffsets[ownPrefixId]++] = rowId;
|
|
611
|
-
for (const prefix of this.prefixesForPath(path)) {
|
|
612
|
-
const prefixId = prefixIds.get(prefix);
|
|
613
|
-
rowIds[nextOffsets[prefixId]++] = rowId;
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
this.prefixRows = {
|
|
617
|
-
prefixIds,
|
|
618
|
-
offsets,
|
|
619
|
-
rowIds,
|
|
620
|
-
changedRows: new Set(),
|
|
621
|
-
appendedRows: new Map(),
|
|
622
|
-
nextPrefixId: prefixIds.size,
|
|
623
|
-
};
|
|
624
|
-
return this.prefixRows;
|
|
625
|
-
}
|
|
626
493
|
/**
|
|
627
494
|
* Returns and clears changes since the prior checkpoint.
|
|
628
495
|
*
|
|
@@ -837,9 +704,6 @@ export class JournalRowStore {
|
|
|
837
704
|
store.liveRows = snapshot.rowCount;
|
|
838
705
|
store.firstIterationRowId = iteration.first;
|
|
839
706
|
store.lastIterationRowId = iteration.last;
|
|
840
|
-
// Prefix candidates are deliberately lazy after recovery. A reverse
|
|
841
|
-
// shadow only appends a delta and never scans prefixes, while the retained
|
|
842
|
-
// area aggregate calls preparePrefixIndex() during its pre-realtime warmup.
|
|
843
707
|
return store;
|
|
844
708
|
}
|
|
845
709
|
reset(rowCapacity) {
|
|
@@ -862,7 +726,6 @@ export class JournalRowStore {
|
|
|
862
726
|
this.directories.length = 1;
|
|
863
727
|
this.directoryIds.clear();
|
|
864
728
|
this.directoryIds.set("", 0);
|
|
865
|
-
this.prefixRows = undefined;
|
|
866
729
|
this.authors.length = 1;
|
|
867
730
|
this.authorIds.clear();
|
|
868
731
|
this.freeRows.length = 0;
|
|
@@ -891,83 +754,8 @@ export class JournalRowStore {
|
|
|
891
754
|
this.storeLeafFallback(rowId, leaf, leafBytes);
|
|
892
755
|
this.insertIndex(rowId);
|
|
893
756
|
this.appendIterationRow(rowId);
|
|
894
|
-
this.addRowToPrefixIndex(rowId, path);
|
|
895
757
|
this.liveRows++;
|
|
896
758
|
}
|
|
897
|
-
addRowToPrefixIndex(rowId, path) {
|
|
898
|
-
const index = this.prefixRows;
|
|
899
|
-
if (index === undefined)
|
|
900
|
-
return;
|
|
901
|
-
// A reused row id could appear in the immutable range under its old path.
|
|
902
|
-
// It must be served only by the post-index dynamic bucket from now on.
|
|
903
|
-
index.changedRows.add(rowId);
|
|
904
|
-
const ownPrefixId = index.prefixIds.get(path);
|
|
905
|
-
if (ownPrefixId !== undefined)
|
|
906
|
-
this.addDynamicPrefixRow(index, ownPrefixId, rowId);
|
|
907
|
-
for (const prefix of this.prefixesForPath(path)) {
|
|
908
|
-
const prefixId = this.ensurePrefixId(index, prefix);
|
|
909
|
-
this.addDynamicPrefixRow(index, prefixId, rowId);
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
removeRowFromPrefixIndex(rowId, path) {
|
|
913
|
-
const index = this.prefixRows;
|
|
914
|
-
if (index === undefined)
|
|
915
|
-
return;
|
|
916
|
-
index.changedRows.add(rowId);
|
|
917
|
-
this.removeDynamicPrefixRow(index, path, rowId);
|
|
918
|
-
for (const prefix of this.prefixesForPath(path))
|
|
919
|
-
this.removeDynamicPrefixRow(index, prefix, rowId);
|
|
920
|
-
}
|
|
921
|
-
ensurePrefixId(index, prefix) {
|
|
922
|
-
const known = index.prefixIds.get(prefix);
|
|
923
|
-
if (known !== undefined)
|
|
924
|
-
return known;
|
|
925
|
-
// Released dynamic ids cannot be reused: other live dynamic prefixes may
|
|
926
|
-
// have larger ids, and an id collision would merge their candidate sets.
|
|
927
|
-
const prefixId = index.nextPrefixId++;
|
|
928
|
-
index.prefixIds.set(prefix, prefixId);
|
|
929
|
-
// A file may have been written before it gained descendants. It belongs
|
|
930
|
-
// first in this newly-created directory bucket, just as it did in the
|
|
931
|
-
// global insertion order before the index was warmed.
|
|
932
|
-
const exactRowId = this.findRowId(prefix);
|
|
933
|
-
if (exactRowId !== undefined)
|
|
934
|
-
this.addDynamicPrefixRow(index, prefixId, exactRowId);
|
|
935
|
-
return prefixId;
|
|
936
|
-
}
|
|
937
|
-
addDynamicPrefixRow(index, prefixId, rowId) {
|
|
938
|
-
let rows = index.appendedRows.get(prefixId);
|
|
939
|
-
if (rows === undefined) {
|
|
940
|
-
rows = new Set();
|
|
941
|
-
index.appendedRows.set(prefixId, rows);
|
|
942
|
-
}
|
|
943
|
-
rows.add(rowId);
|
|
944
|
-
}
|
|
945
|
-
removeDynamicPrefixRow(index, prefix, rowId) {
|
|
946
|
-
const prefixId = index.prefixIds.get(prefix);
|
|
947
|
-
if (prefixId === undefined)
|
|
948
|
-
return;
|
|
949
|
-
const rows = index.appendedRows.get(prefixId);
|
|
950
|
-
if (rows === undefined)
|
|
951
|
-
return;
|
|
952
|
-
rows.delete(rowId);
|
|
953
|
-
if (rows.size !== 0)
|
|
954
|
-
return;
|
|
955
|
-
index.appendedRows.delete(prefixId);
|
|
956
|
-
// Static packed ranges own their prefix strings for the index lifetime.
|
|
957
|
-
// A dynamically-created directory with no surviving row must release its
|
|
958
|
-
// string immediately: watcher churn can otherwise retain every transient
|
|
959
|
-
// directory name indefinitely.
|
|
960
|
-
if (prefixId + 1 >= index.offsets.length)
|
|
961
|
-
index.prefixIds.delete(prefix);
|
|
962
|
-
}
|
|
963
|
-
*prefixesForPath(path) {
|
|
964
|
-
const { directory } = splitPath(path);
|
|
965
|
-
for (let prefix = directory; prefix !== "";) {
|
|
966
|
-
yield prefix;
|
|
967
|
-
const slash = prefix.lastIndexOf("/");
|
|
968
|
-
prefix = slash === -1 ? "" : prefix.slice(0, slash);
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
759
|
recordDirty(rowId, path, hadPrevious, previousFingerprint) {
|
|
972
760
|
if (this.dirtyPaths.has(path))
|
|
973
761
|
return;
|
|
@@ -1229,13 +1017,6 @@ export class JournalRowStore {
|
|
|
1229
1017
|
: textDecoder.decode(this.leafBytes(rowId));
|
|
1230
1018
|
return directory === "" ? leaf : directory + "/" + leaf;
|
|
1231
1019
|
}
|
|
1232
|
-
pathForRowForPrefixIndex(rowId) {
|
|
1233
|
-
const directory = this.directories[this.dirIds[rowId]];
|
|
1234
|
-
const leaf = this.leafFallbacks.has(rowId)
|
|
1235
|
-
? this.leafFallbacks.get(rowId)
|
|
1236
|
-
: textDecoder.decode(this.leafBytes(rowId));
|
|
1237
|
-
return directory === "" ? leaf : directory + "/" + leaf;
|
|
1238
|
-
}
|
|
1239
1020
|
findRowId(path) {
|
|
1240
1021
|
const { directory, leaf } = splitPath(path);
|
|
1241
1022
|
const directoryId = this.directoryIds.get(directory);
|