@indigoai-us/hq-cloud 6.16.68 → 6.16.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/bin/sync-runner-company.d.ts.map +1 -1
  2. package/dist/bin/sync-runner-company.js +14 -0
  3. package/dist/bin/sync-runner-company.js.map +1 -1
  4. package/dist/bin/sync-runner-company.test.js +64 -0
  5. package/dist/bin/sync-runner-company.test.js.map +1 -1
  6. package/dist/bin/sync-runner-events.test.js +19 -0
  7. package/dist/bin/sync-runner-events.test.js.map +1 -1
  8. package/dist/bin/sync-runner.d.ts +5 -0
  9. package/dist/bin/sync-runner.d.ts.map +1 -1
  10. package/dist/bin/sync-runner.js.map +1 -1
  11. package/dist/cli/share.d.ts +18 -1
  12. package/dist/cli/share.d.ts.map +1 -1
  13. package/dist/cli/share.js +135 -120
  14. package/dist/cli/share.js.map +1 -1
  15. package/dist/cli/sync.d.ts +181 -1
  16. package/dist/cli/sync.d.ts.map +1 -1
  17. package/dist/cli/sync.js +63 -27
  18. package/dist/cli/sync.js.map +1 -1
  19. package/dist/cli/sync.test.js +105 -0
  20. package/dist/cli/sync.test.js.map +1 -1
  21. package/dist/journal-decode-window.d.ts +42 -0
  22. package/dist/journal-decode-window.d.ts.map +1 -0
  23. package/dist/journal-decode-window.js +60 -0
  24. package/dist/journal-decode-window.js.map +1 -0
  25. package/dist/journal-decode-window.test.d.ts +2 -0
  26. package/dist/journal-decode-window.test.d.ts.map +1 -0
  27. package/dist/journal-decode-window.test.js +99 -0
  28. package/dist/journal-decode-window.test.js.map +1 -0
  29. package/dist/journal-row-store.d.ts +4 -0
  30. package/dist/journal-row-store.d.ts.map +1 -1
  31. package/dist/journal-row-store.js +64 -2
  32. package/dist/journal-row-store.js.map +1 -1
  33. package/dist/journal-streaming.heap.test.d.ts +2 -0
  34. package/dist/journal-streaming.heap.test.d.ts.map +1 -0
  35. package/dist/journal-streaming.heap.test.js +190 -0
  36. package/dist/journal-streaming.heap.test.js.map +1 -0
  37. package/dist/journal.d.ts +1 -11
  38. package/dist/journal.d.ts.map +1 -1
  39. package/dist/journal.js +4 -53
  40. package/dist/journal.js.map +1 -1
  41. package/dist/journal.test.js +13 -7
  42. package/dist/journal.test.js.map +1 -1
  43. package/dist/lib/net-errors.d.ts +12 -0
  44. package/dist/lib/net-errors.d.ts.map +1 -1
  45. package/dist/lib/net-errors.js +22 -0
  46. package/dist/lib/net-errors.js.map +1 -1
  47. package/dist/lib/net-errors.test.js +35 -1
  48. package/dist/lib/net-errors.test.js.map +1 -1
  49. package/dist/lib/s3-content-checksum.d.ts +16 -0
  50. package/dist/lib/s3-content-checksum.d.ts.map +1 -0
  51. package/dist/lib/s3-content-checksum.js +91 -0
  52. package/dist/lib/s3-content-checksum.js.map +1 -0
  53. package/dist/lib/s3-content-checksum.test.d.ts +2 -0
  54. package/dist/lib/s3-content-checksum.test.d.ts.map +1 -0
  55. package/dist/lib/s3-content-checksum.test.js +26 -0
  56. package/dist/lib/s3-content-checksum.test.js.map +1 -0
  57. package/dist/object-io.d.ts +2 -0
  58. package/dist/object-io.d.ts.map +1 -1
  59. package/dist/object-io.js +37 -19
  60. package/dist/object-io.js.map +1 -1
  61. package/dist/object-io.test.js +89 -2
  62. package/dist/object-io.test.js.map +1 -1
  63. package/dist/sync/candidate-uploader.d.ts.map +1 -1
  64. package/dist/sync/candidate-uploader.js +6 -1
  65. package/dist/sync/candidate-uploader.js.map +1 -1
  66. package/dist/sync/multipart-uploader.d.ts.map +1 -1
  67. package/dist/sync/multipart-uploader.js +2 -1
  68. package/dist/sync/multipart-uploader.js.map +1 -1
  69. package/package.json +1 -1
  70. package/dist/journal-row-cache.d.ts +0 -102
  71. package/dist/journal-row-cache.d.ts.map +0 -1
  72. package/dist/journal-row-cache.heap.test.d.ts +0 -2
  73. package/dist/journal-row-cache.heap.test.d.ts.map +0 -1
  74. package/dist/journal-row-cache.heap.test.js +0 -102
  75. package/dist/journal-row-cache.heap.test.js.map +0 -1
  76. package/dist/journal-row-cache.js +0 -549
  77. package/dist/journal-row-cache.js.map +0 -1
  78. package/dist/journal-row-cache.test.d.ts +0 -2
  79. package/dist/journal-row-cache.test.d.ts.map +0 -1
  80. package/dist/journal-row-cache.test.js +0 -155
  81. package/dist/journal-row-cache.test.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"journal-row-cache.d.ts","sourceRoot":"","sources":["../src/journal-row-cache.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACtF,YAAY,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAErE,mEAAmE;AACnE,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAC7C,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,OAAQ,CAAC;AAc5C,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,eAAe,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAID,wBAAgB,kBAAkB,IAAI,kBAAkB,CAmBvD;AAED,gFAAgF;AAChF,wBAAgB,sBAAsB,CACpC,KAAK,GA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,CAAC,YAAY,CAAC,GAAG,SAAS,EACxE,KAAK,EAAE;IAAE,MAAM,IAAI,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC3E,OAAO,CAeT"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=journal-row-cache.heap.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"journal-row-cache.heap.test.d.ts","sourceRoot":"","sources":["../src/journal-row-cache.heap.test.ts"],"names":[],"mappings":""}
@@ -1,102 +0,0 @@
1
- import { afterEach, describe, expect, it } from "vitest";
2
- import * as fs from "node:fs";
3
- import * as os from "node:os";
4
- import * as path from "node:path";
5
- import * as v8 from "node:v8";
6
- import * as vm from "node:vm";
7
- import { DiskJournalRowCache, JOURNAL_CACHE_MAX_ROWS, JOURNAL_CACHE_PURGE_TO, } from "./journal-row-cache.js";
8
- import { JournalRowStore } from "./journal-row-store.js";
9
- const HEAP_BOUND_BYTES = 60 * 1024 * 1024;
10
- const ROW_COUNT = 200_000;
11
- function acquireGc() {
12
- const existing = globalThis.gc;
13
- if (typeof existing === "function")
14
- return existing;
15
- v8.setFlagsFromString("--expose-gc");
16
- const exposed = vm.runInNewContext("gc");
17
- v8.setFlagsFromString("--no-expose-gc");
18
- if (typeof exposed !== "function")
19
- return () => undefined;
20
- return exposed;
21
- }
22
- function collect(gc) {
23
- gc();
24
- gc();
25
- gc();
26
- }
27
- function usedBytes() {
28
- const usage = process.memoryUsage();
29
- return usage.heapUsed + usage.arrayBuffers;
30
- }
31
- function entry(index) {
32
- return {
33
- hash: index.toString(16).padStart(64, "0"),
34
- size: 100 + (index % 1000),
35
- syncedAt: new Date(1_700_000_000_000 + index).toISOString(),
36
- direction: "up",
37
- kind: "file",
38
- mtimeMs: 1_700_000_000_000 + index,
39
- ctimeMs: 1_700_000_000_001 + index,
40
- };
41
- }
42
- function pathFor(index) {
43
- return `tree/${index.toString().padStart(6, "0")}.md`;
44
- }
45
- const dirs = [];
46
- const caches = [];
47
- afterEach(() => {
48
- for (const cache of caches)
49
- cache.close();
50
- caches.length = 0;
51
- for (const dir of dirs)
52
- fs.rmSync(dir, { recursive: true, force: true });
53
- dirs.length = 0;
54
- });
55
- describe("journal row cache heap bound", () => {
56
- it("keeps a 200k-row journal under 60 MB after spill, with a 10k/5k LRU", () => {
57
- const gc = acquireGc();
58
- collect(gc);
59
- const packedBefore = usedBytes();
60
- const packed = new JournalRowStore(ROW_COUNT, { trackChanges: false });
61
- for (let index = 0; index < ROW_COUNT; index++)
62
- packed.set(pathFor(index), entry(index));
63
- collect(gc);
64
- const packedAfter = usedBytes();
65
- const packedDelta = packedAfter - packedBefore;
66
- const packedBytesPerRow = packedDelta / ROW_COUNT;
67
- packed.clear();
68
- collect(gc);
69
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), "hq-journal-cache-heap-"));
70
- dirs.push(dir);
71
- collect(gc);
72
- const cacheBefore = usedBytes();
73
- const cache = DiskJournalRowCache.open(dir);
74
- caches.push(cache);
75
- cache.loadFromEntries(function* () {
76
- for (let index = 0; index < ROW_COUNT; index++)
77
- yield [pathFor(index), entry(index)];
78
- }());
79
- collect(gc);
80
- const cacheAfter = usedBytes();
81
- const cacheDelta = cacheAfter - cacheBefore;
82
- const stats = cache.stats();
83
- console.log(JSON.stringify({
84
- probe: "journal-row-cache-heap",
85
- rows: ROW_COUNT,
86
- packedHeapDeltaBytes: packedDelta,
87
- packedBytesPerRow: Math.round(packedBytesPerRow),
88
- cacheHeapDeltaBytes: cacheDelta,
89
- cacheBytesPerRowIfUncapped: Math.round(cacheDelta / ROW_COUNT),
90
- rowsInMemory: stats.rowsInMemory,
91
- peakRowsInMemory: stats.peakRowsInMemory,
92
- durableRows: stats.durableRows,
93
- }));
94
- expect(stats.durableRows).toBe(ROW_COUNT);
95
- expect(stats.peakRowsInMemory).toBeLessThanOrEqual(JOURNAL_CACHE_MAX_ROWS);
96
- expect(stats.rowsInMemory).toBe(JOURNAL_CACHE_PURGE_TO);
97
- expect(cacheDelta).toBeLessThan(HEAP_BOUND_BYTES);
98
- expect(cache.get(pathFor(0))?.size).toBe(100);
99
- expect(cache.get(pathFor(ROW_COUNT - 1))?.size).toBe(100 + ((ROW_COUNT - 1) % 1000));
100
- }, 180_000);
101
- });
102
- //# sourceMappingURL=journal-row-cache.heap.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"journal-row-cache.heap.test.js","sourceRoot":"","sources":["../src/journal-row-cache.heap.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAC1C,MAAM,SAAS,GAAG,OAAO,CAAC;AAE1B,SAAS,SAAS;IAChB,MAAM,QAAQ,GAAI,UAAkC,CAAC,EAAE,CAAC;IACxD,IAAI,OAAO,QAAQ,KAAK,UAAU;QAAE,OAAO,QAAQ,CAAC;IACpD,EAAE,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,CAAY,CAAC;IACpD,EAAE,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;IACxC,IAAI,OAAO,OAAO,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E,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9C,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACvF,CAAC,EAAE,OAAO,CAAC,CAAC;AACd,CAAC,CAAC,CAAC"}
@@ -1,549 +0,0 @@
1
- /**
2
- * Bounded LRU journal-row cache backed by the on-disk journal.
3
- *
4
- * The packed resident store keeps every row of a scope in process memory.
5
- * Full personal vaults are 500k–700k rows; that is the idle RSS the runner
6
- * cannot afford. This module holds at most {@link JOURNAL_CACHE_MAX_ROWS}
7
- * decoded rows, and when that ceiling is reached it purges back to
8
- * {@link JOURNAL_CACHE_PURGE_TO} most-recently-used rows. Everything else
9
- * lives in a JSONL row log plus a sorted path→offset index, both ordinary
10
- * files (no native add-on).
11
- *
12
- * Constants live in one place. They are not env-var knobs; a future tunable
13
- * must go through hq-flags.
14
- */
15
- import * as fs from "node:fs";
16
- import * as path from "node:path";
17
- /** Ceiling: reaching this many in-memory rows triggers a purge. */
18
- export const JOURNAL_CACHE_MAX_ROWS = 10_000;
19
- /** After a purge, keep this many most-recently-used rows. */
20
- export const JOURNAL_CACHE_PURGE_TO = 5_000;
21
- const INDEX_MAGIC = Buffer.from("HQJIDX01");
22
- const RECORD_BYTES = 80;
23
- const HASH_BYTES = 32;
24
- const FLAG_HAS_MTIME = 1 << 0;
25
- const FLAG_HAS_CTIME = 1 << 1;
26
- const FLAG_LOCAL_DIVERGES = 1 << 2;
27
- const FLAG_SYMLINK = 1 << 3;
28
- const FLAG_REMOVED = 1 << 4;
29
- const FLAG_DELETE_INTENT = 1 << 5;
30
- const FLAG_HASH_FALLBACK = 1 << 6;
31
- const lowerHex = /^[0-9a-f]+$/;
32
- const liveCaches = new Set();
33
- export function journalCacheMetric() {
34
- let rowsInMemory = 0;
35
- let hits = 0;
36
- let misses = 0;
37
- for (const cache of liveCaches) {
38
- const stats = cache.stats();
39
- rowsInMemory += stats.rowsInMemory;
40
- hits += stats.hits;
41
- misses += stats.misses;
42
- }
43
- return {
44
- type: "journal-cache",
45
- rowsInMemory,
46
- maxRows: JOURNAL_CACHE_MAX_ROWS,
47
- purgeTo: JOURNAL_CACHE_PURGE_TO,
48
- hits,
49
- misses,
50
- heapUsedMb: Math.round(process.memoryUsage().heapUsed / (1024 * 1024)),
51
- };
52
- }
53
- /** Existing stderr JSON channel: one line, no secrets, numeric cache census. */
54
- export function emitJournalCacheMetric(write = (line) => {
55
- process.stderr.write(line);
56
- }) {
57
- write(`${JSON.stringify(journalCacheMetric())}\n`);
58
- }
59
- export function journalRowCacheDirectory(stateDir, slug) {
60
- return path.join(stateDir, "journal-row-cache", slug);
61
- }
62
- function isCanonicalHex(value, length) {
63
- return value.length === length && lowerHex.test(value);
64
- }
65
- function decodeHex(value, target, offset) {
66
- for (let index = 0; index < value.length / 2; index++) {
67
- target[offset + index] = Number.parseInt(value.slice(index * 2, index * 2 + 2), 16);
68
- }
69
- }
70
- function encodeHex(source, offset, length) {
71
- let value = "";
72
- for (let index = 0; index < length; index++)
73
- value += source[offset + index].toString(16).padStart(2, "0");
74
- return value;
75
- }
76
- function flagsFor(entry) {
77
- let flags = 0;
78
- if (entry.mtimeMs !== undefined)
79
- flags |= FLAG_HAS_MTIME;
80
- if (entry.ctimeMs !== undefined)
81
- flags |= FLAG_HAS_CTIME;
82
- if (entry.localDiverges)
83
- flags |= FLAG_LOCAL_DIVERGES;
84
- if (entry.kind === "symlink")
85
- flags |= FLAG_SYMLINK;
86
- if (entry.removedAt !== undefined)
87
- flags |= FLAG_REMOVED;
88
- if (entry.localDeleteIntent !== undefined)
89
- flags |= FLAG_DELETE_INTENT;
90
- if (!isCanonicalHex(entry.hash, 64))
91
- flags |= FLAG_HASH_FALLBACK;
92
- return flags;
93
- }
94
- function fingerprintFromEntry(entry) {
95
- return {
96
- hash: entry.hash,
97
- size: entry.size,
98
- ...(entry.mtimeMs !== undefined ? { mtimeMs: entry.mtimeMs } : {}),
99
- ...(entry.ctimeMs !== undefined ? { ctimeMs: entry.ctimeMs } : {}),
100
- ...(entry.kind !== undefined ? { kind: entry.kind } : {}),
101
- ...(entry.localDiverges !== undefined ? { localDiverges: entry.localDiverges } : {}),
102
- ...(entry.removedAt !== undefined ? { removedAt: entry.removedAt } : {}),
103
- ...(entry.localDeleteIntent !== undefined ? { localDeleteIntent: entry.localDeleteIntent } : {}),
104
- };
105
- }
106
- /**
107
- * LRU of decoded journal rows plus an on-disk path index and JSONL row log.
108
- *
109
- * The sorted index (and its concatenated paths blob) stay as Buffers — they
110
- * are not row objects. A miss seeks the JSONL log by the stored offset.
111
- */
112
- export class DiskJournalRowCache {
113
- maxRows;
114
- purgeTo;
115
- directory;
116
- lru = new Map();
117
- /** Rows written after the last index rebuild; path strings, but bounded. */
118
- live = new Map();
119
- index = Buffer.alloc(0);
120
- paths = Buffer.alloc(0);
121
- indexCount = 0;
122
- durableRows = 0;
123
- hits = 0;
124
- misses = 0;
125
- diskReads = 0;
126
- purges = 0;
127
- peakRowsInMemory = 0;
128
- rowsFd;
129
- rowsLength = 0;
130
- closed = false;
131
- constructor(directory, options) {
132
- this.directory = directory;
133
- this.maxRows = options.maxRows ?? JOURNAL_CACHE_MAX_ROWS;
134
- this.purgeTo = options.purgeTo ?? JOURNAL_CACHE_PURGE_TO;
135
- if (this.purgeTo < 1 || this.maxRows < this.purgeTo) {
136
- throw new Error("journal-row-cache: maxRows must be >= purgeTo >= 1");
137
- }
138
- fs.mkdirSync(directory, { recursive: true });
139
- const rowsPath = path.join(directory, "rows.jsonl");
140
- this.rowsFd = fs.openSync(rowsPath, fs.existsSync(rowsPath) ? "r+" : "w+");
141
- this.rowsLength = fs.fstatSync(this.rowsFd).size;
142
- this.loadIndexIfPresent();
143
- liveCaches.add(this);
144
- }
145
- static open(directory, options = {}) {
146
- return new DiskJournalRowCache(directory, options);
147
- }
148
- get size() {
149
- return this.durableRows;
150
- }
151
- stats() {
152
- return {
153
- rowsInMemory: this.lru.size,
154
- maxRows: this.maxRows,
155
- purgeTo: this.purgeTo,
156
- hits: this.hits,
157
- misses: this.misses,
158
- diskReads: this.diskReads,
159
- purges: this.purges,
160
- peakRowsInMemory: this.peakRowsInMemory,
161
- durableRows: this.durableRows,
162
- };
163
- }
164
- hasInMemory(pathKey) {
165
- return this.lru.has(pathKey);
166
- }
167
- inMemoryPaths() {
168
- return [...this.lru.keys()];
169
- }
170
- get(pathKey) {
171
- const cached = this.lru.get(pathKey);
172
- if (cached !== undefined) {
173
- this.hits += 1;
174
- this.touch(pathKey, cached);
175
- return cached;
176
- }
177
- const loaded = this.loadFromDisk(pathKey);
178
- if (loaded === undefined) {
179
- this.misses += 1;
180
- return undefined;
181
- }
182
- this.misses += 1;
183
- this.remember(pathKey, loaded);
184
- return loaded;
185
- }
186
- statFingerprint(pathKey) {
187
- const cached = this.lru.get(pathKey);
188
- if (cached !== undefined) {
189
- this.hits += 1;
190
- this.touch(pathKey, cached);
191
- return fingerprintFromEntry(cached);
192
- }
193
- const live = this.live.get(pathKey);
194
- if (live) {
195
- if (live.tombstone)
196
- return undefined;
197
- this.hits += 1;
198
- return live.fingerprint;
199
- }
200
- const indexed = this.lookupIndex(pathKey);
201
- if (indexed === undefined) {
202
- this.misses += 1;
203
- return undefined;
204
- }
205
- this.hits += 1;
206
- return indexed.fingerprint;
207
- }
208
- has(pathKey) {
209
- if (this.lru.has(pathKey))
210
- return true;
211
- const live = this.live.get(pathKey);
212
- if (live)
213
- return !live.tombstone;
214
- return this.lookupIndex(pathKey) !== undefined;
215
- }
216
- set(pathKey, entry) {
217
- const frozen = freezeEntry(structuredClone(entry));
218
- const offset = this.appendRow(pathKey, frozen, false);
219
- const existed = this.has(pathKey);
220
- this.live.set(pathKey, {
221
- rowOffset: offset,
222
- tombstone: false,
223
- fingerprint: fingerprintFromEntry(frozen),
224
- });
225
- if (!existed)
226
- this.durableRows += 1;
227
- this.remember(pathKey, frozen);
228
- }
229
- delete(pathKey) {
230
- if (!this.has(pathKey))
231
- return false;
232
- this.appendRow(pathKey, null, true);
233
- this.live.set(pathKey, {
234
- rowOffset: this.rowsLength,
235
- tombstone: true,
236
- fingerprint: { hash: "", size: 0 },
237
- });
238
- this.lru.delete(pathKey);
239
- this.durableRows -= 1;
240
- return true;
241
- }
242
- *entries() {
243
- for (const pathKey of this.keys()) {
244
- const entry = this.get(pathKey);
245
- if (entry !== undefined)
246
- yield [pathKey, entry];
247
- }
248
- }
249
- *keys() {
250
- const seen = new Set();
251
- for (const [pathKey, live] of this.live) {
252
- seen.add(pathKey);
253
- if (!live.tombstone)
254
- yield pathKey;
255
- }
256
- for (let index = 0; index < this.indexCount; index++) {
257
- const pathKey = this.pathAt(index);
258
- if (seen.has(pathKey))
259
- continue;
260
- yield pathKey;
261
- }
262
- }
263
- *values() {
264
- for (const [, entry] of this.entries())
265
- yield entry;
266
- }
267
- *entriesForPrefix(prefix) {
268
- const normalized = prefix.replace(/\/+$/, "");
269
- for (const [pathKey, entry] of this.entries()) {
270
- if (normalized === "" || pathKey === normalized || pathKey.startsWith(`${normalized}/`)) {
271
- yield [pathKey, entry];
272
- }
273
- }
274
- }
275
- toRecord() {
276
- const record = {};
277
- for (const [pathKey, entry] of this.entries())
278
- record[pathKey] = structuredClone(entry);
279
- return record;
280
- }
281
- /**
282
- * Write every entry to the row log, rebuild the sorted on-disk index, and
283
- * keep only the LRU window in memory. Used when spilling a packed store.
284
- */
285
- loadFromEntries(entries) {
286
- this.clear();
287
- const pathChunks = [];
288
- let pathsLength = 0;
289
- const pathOffsets = [];
290
- const pathLens = [];
291
- const rowOffsets = [];
292
- const sizes = [];
293
- const mtimes = [];
294
- const ctimes = [];
295
- const flagWords = [];
296
- const hashes = [];
297
- let count = 0;
298
- for (const [pathKey, entry] of entries) {
299
- const pathBuf = Buffer.from(pathKey, "utf8");
300
- pathOffsets.push(pathsLength);
301
- pathLens.push(pathBuf.length);
302
- pathChunks.push(pathBuf);
303
- pathsLength += pathBuf.length;
304
- rowOffsets.push(this.appendRow(pathKey, entry, false));
305
- sizes.push(entry.size);
306
- mtimes.push(entry.mtimeMs ?? Number.NaN);
307
- ctimes.push(entry.ctimeMs ?? Number.NaN);
308
- flagWords.push(flagsFor(entry));
309
- const hash = Buffer.alloc(HASH_BYTES);
310
- if (isCanonicalHex(entry.hash, 64))
311
- decodeHex(entry.hash, hash, 0);
312
- hashes.push(hash);
313
- this.remember(pathKey, freezeEntry(structuredClone(entry)));
314
- count += 1;
315
- }
316
- this.paths = pathChunks.length === 0 ? Buffer.alloc(0) : Buffer.concat(pathChunks, pathsLength);
317
- const order = Uint32Array.from({ length: count }, (_, index) => index);
318
- order.sort((left, right) => {
319
- const leftPath = this.paths.subarray(pathOffsets[left], pathOffsets[left] + pathLens[left]);
320
- const rightPath = this.paths.subarray(pathOffsets[right], pathOffsets[right] + pathLens[right]);
321
- return leftPath.compare(rightPath);
322
- });
323
- const compactedPaths = Buffer.allocUnsafe(pathsLength);
324
- const index = Buffer.alloc(INDEX_MAGIC.length + 4 + count * RECORD_BYTES);
325
- INDEX_MAGIC.copy(index, 0);
326
- index.writeUInt32LE(count, INDEX_MAGIC.length);
327
- let pathsCursor = 0;
328
- for (let sorted = 0; sorted < count; sorted++) {
329
- const source = order[sorted];
330
- const pathLen = pathLens[source];
331
- this.paths.copy(compactedPaths, pathsCursor, pathOffsets[source], pathOffsets[source] + pathLen);
332
- const rec = INDEX_MAGIC.length + 4 + sorted * RECORD_BYTES;
333
- index.writeUInt32LE(pathsCursor, rec);
334
- index.writeUInt32LE(pathLen, rec + 4);
335
- index.writeDoubleLE(rowOffsets[source], rec + 8);
336
- index.writeDoubleLE(sizes[source], rec + 16);
337
- index.writeDoubleLE(mtimes[source], rec + 24);
338
- index.writeDoubleLE(ctimes[source], rec + 32);
339
- index.writeUInt32LE(flagWords[source], rec + 40);
340
- hashes[source].copy(index, rec + 44);
341
- pathsCursor += pathLen;
342
- }
343
- this.paths = compactedPaths;
344
- this.index = index.subarray(INDEX_MAGIC.length + 4);
345
- this.indexCount = count;
346
- this.durableRows = count;
347
- this.live.clear();
348
- fs.writeFileSync(path.join(this.directory, "index.bin"), index);
349
- fs.writeFileSync(path.join(this.directory, "paths.bin"), this.paths);
350
- }
351
- applyDurableDelta(upserts, deletes) {
352
- for (const pathKey of deletes)
353
- this.delete(pathKey);
354
- for (const [pathKey, entry] of Object.entries(upserts))
355
- this.set(pathKey, entry);
356
- }
357
- clear() {
358
- this.lru.clear();
359
- this.live.clear();
360
- this.index = Buffer.alloc(0);
361
- this.paths = Buffer.alloc(0);
362
- this.indexCount = 0;
363
- this.durableRows = 0;
364
- this.rowsLength = 0;
365
- fs.ftruncateSync(this.rowsFd, 0);
366
- }
367
- close() {
368
- if (this.closed)
369
- return;
370
- this.closed = true;
371
- liveCaches.delete(this);
372
- fs.closeSync(this.rowsFd);
373
- }
374
- remember(pathKey, entry) {
375
- if (this.lru.has(pathKey))
376
- this.lru.delete(pathKey);
377
- this.lru.set(pathKey, entry);
378
- if (this.lru.size > this.peakRowsInMemory)
379
- this.peakRowsInMemory = this.lru.size;
380
- if (this.lru.size >= this.maxRows)
381
- this.purge();
382
- }
383
- touch(pathKey, entry) {
384
- this.lru.delete(pathKey);
385
- this.lru.set(pathKey, entry);
386
- }
387
- purge() {
388
- const excess = this.lru.size - this.purgeTo;
389
- if (excess <= 0)
390
- return;
391
- const keys = this.lru.keys();
392
- for (let index = 0; index < excess; index++) {
393
- const pathKey = keys.next().value;
394
- if (pathKey === undefined)
395
- break;
396
- this.lru.delete(pathKey);
397
- }
398
- this.purges += 1;
399
- }
400
- loadFromDisk(pathKey) {
401
- const live = this.live.get(pathKey);
402
- if (live) {
403
- if (live.tombstone)
404
- return undefined;
405
- return this.readRow(live.rowOffset);
406
- }
407
- const indexed = this.lookupIndex(pathKey);
408
- if (indexed === undefined)
409
- return undefined;
410
- return this.readRow(indexed.rowOffset);
411
- }
412
- readRow(offset) {
413
- this.diskReads += 1;
414
- const chunk = Buffer.alloc(64 * 1024);
415
- let collected = "";
416
- let position = offset;
417
- while (position < this.rowsLength) {
418
- const bytes = fs.readSync(this.rowsFd, chunk, 0, chunk.length, position);
419
- if (bytes <= 0)
420
- break;
421
- collected += chunk.toString("utf8", 0, bytes);
422
- const newline = collected.indexOf("\n");
423
- if (newline !== -1) {
424
- collected = collected.slice(0, newline);
425
- break;
426
- }
427
- position += bytes;
428
- }
429
- if (collected.length === 0)
430
- return undefined;
431
- const parsed = JSON.parse(collected);
432
- if (parsed.d || parsed.e === null)
433
- return undefined;
434
- return freezeEntry(parsed.e);
435
- }
436
- appendRow(pathKey, entry, tombstone) {
437
- const offset = this.rowsLength;
438
- const line = `${JSON.stringify({ p: pathKey, e: entry, d: tombstone || undefined })}\n`;
439
- const bytes = Buffer.from(line, "utf8");
440
- fs.writeSync(this.rowsFd, bytes, 0, bytes.length, offset);
441
- this.rowsLength += bytes.length;
442
- return offset;
443
- }
444
- loadIndexIfPresent() {
445
- const indexPath = path.join(this.directory, "index.bin");
446
- const pathsPath = path.join(this.directory, "paths.bin");
447
- if (!fs.existsSync(indexPath) || !fs.existsSync(pathsPath))
448
- return;
449
- const index = fs.readFileSync(indexPath);
450
- if (index.length < INDEX_MAGIC.length + 4)
451
- return;
452
- if (!index.subarray(0, INDEX_MAGIC.length).equals(INDEX_MAGIC))
453
- return;
454
- this.indexCount = index.readUInt32LE(INDEX_MAGIC.length);
455
- this.index = index.subarray(INDEX_MAGIC.length + 4);
456
- this.paths = fs.readFileSync(pathsPath);
457
- this.durableRows = this.indexCount;
458
- }
459
- lookupIndex(pathKey) {
460
- if (this.indexCount === 0)
461
- return undefined;
462
- const needle = Buffer.from(pathKey, "utf8");
463
- let low = 0;
464
- let high = this.indexCount - 1;
465
- while (low <= high) {
466
- const mid = (low + high) >>> 1;
467
- const compared = this.pathBufferAt(mid).compare(needle);
468
- if (compared === 0)
469
- return this.recordAt(mid);
470
- if (compared < 0)
471
- low = mid + 1;
472
- else
473
- high = mid - 1;
474
- }
475
- return undefined;
476
- }
477
- pathAt(index) {
478
- return this.pathBufferAt(index).toString("utf8");
479
- }
480
- pathBufferAt(index) {
481
- const rec = index * RECORD_BYTES;
482
- const pathOffset = this.index.readUInt32LE(rec);
483
- const pathLen = this.index.readUInt32LE(rec + 4);
484
- return this.paths.subarray(pathOffset, pathOffset + pathLen);
485
- }
486
- recordAt(index) {
487
- const rec = index * RECORD_BYTES;
488
- const rowOffset = this.index.readDoubleLE(rec + 8);
489
- const flags = this.index.readUInt32LE(rec + 40);
490
- const fingerprint = {
491
- hash: encodeHex(this.index.subarray(rec + 44, rec + 44 + HASH_BYTES), 0, HASH_BYTES),
492
- size: this.index.readDoubleLE(rec + 16),
493
- };
494
- if (flags & FLAG_HAS_MTIME)
495
- fingerprint.mtimeMs = this.index.readDoubleLE(rec + 24);
496
- if (flags & FLAG_HAS_CTIME)
497
- fingerprint.ctimeMs = this.index.readDoubleLE(rec + 32);
498
- if (flags & FLAG_SYMLINK)
499
- fingerprint.kind = "symlink";
500
- else
501
- fingerprint.kind = "file";
502
- if (flags & FLAG_LOCAL_DIVERGES)
503
- fingerprint.localDiverges = true;
504
- if (flags & FLAG_REMOVED)
505
- fingerprint.removedAt = "present";
506
- if (flags & FLAG_DELETE_INTENT)
507
- fingerprint.localDeleteIntent = {
508
- version: 1,
509
- remoteEtag: "",
510
- localHash: "",
511
- localKind: "file",
512
- };
513
- if (flags & FLAG_HASH_FALLBACK) {
514
- const row = this.readRow(rowOffset);
515
- if (row)
516
- return { rowOffset, fingerprint: fingerprintFromEntry(row) };
517
- }
518
- return { rowOffset, fingerprint };
519
- }
520
- }
521
- function freezeEntry(entry) {
522
- if (entry.localDeleteIntent !== undefined)
523
- Object.freeze(entry.localDeleteIntent);
524
- return Object.freeze(entry);
525
- }
526
- export function journalFingerprintMatchesStat(fingerprint, lstat) {
527
- if (!fingerprint)
528
- return false;
529
- if (!fingerprint.hash)
530
- return false;
531
- if (fingerprint.kind === "symlink")
532
- return false;
533
- if (fingerprint.localDiverges)
534
- return false;
535
- if (fingerprint.removedAt !== undefined)
536
- return false;
537
- if (fingerprint.localDeleteIntent !== undefined)
538
- return false;
539
- if (fingerprint.mtimeMs === undefined || fingerprint.ctimeMs === undefined)
540
- return false;
541
- if (fingerprint.mtimeMs % 1000 === 0 && fingerprint.ctimeMs % 1000 === 0)
542
- return false;
543
- if (!lstat.isFile())
544
- return false;
545
- return (lstat.size === fingerprint.size &&
546
- lstat.mtimeMs === fingerprint.mtimeMs &&
547
- lstat.ctimeMs === fingerprint.ctimeMs);
548
- }
549
- //# sourceMappingURL=journal-row-cache.js.map