@agoric/swing-store 0.9.2-dev-627b56b.0 → 0.9.2-dev-8ef62f4.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/package.json +4 -4
- package/src/bundleStore.js +4 -0
- package/src/exporter.js +2 -0
- package/src/snapStore.js +5 -0
- package/src/transcriptStore.js +6 -0
- package/test/test-deletion.js +1 -0
- package/test/test-exportImport.js +1 -0
- package/test/test-snapstore.js +1 -0
- package/test/test-state.js +1 -0
- package/test/util.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/swing-store",
|
|
3
|
-
"version": "0.9.2-dev-
|
|
3
|
+
"version": "0.9.2-dev-8ef62f4.0+8ef62f4",
|
|
4
4
|
"description": "Persistent storage for SwingSet",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"lint:eslint": "eslint ."
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@agoric/assert": "0.6.1-dev-
|
|
25
|
-
"@agoric/internal": "0.3.3-dev-
|
|
24
|
+
"@agoric/assert": "0.6.1-dev-8ef62f4.0+8ef62f4",
|
|
25
|
+
"@agoric/internal": "0.3.3-dev-8ef62f4.0+8ef62f4",
|
|
26
26
|
"@endo/base64": "^1.0.0",
|
|
27
27
|
"@endo/bundle-source": "^3.0.1",
|
|
28
28
|
"@endo/check-bundle": "^1.0.1",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"typeCoverage": {
|
|
52
52
|
"atLeast": 76.1
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "8ef62f4439a59a5558fda5130a0c43a3cac76905"
|
|
55
55
|
}
|
package/src/bundleStore.js
CHANGED
|
@@ -267,6 +267,7 @@ export function makeBundleStore(db, ensureTxn, noteExport = () => {}) {
|
|
|
267
267
|
const rawBundle = row.bundle || Fail`bundle ${q(bundleID)} pruned`;
|
|
268
268
|
yield* Readable.from(Buffer.from(rawBundle));
|
|
269
269
|
}
|
|
270
|
+
harden(exportBundle);
|
|
270
271
|
|
|
271
272
|
const sqlGetBundleIDs = db.prepare(`
|
|
272
273
|
SELECT bundleID
|
|
@@ -286,12 +287,14 @@ export function makeBundleStore(db, ensureTxn, noteExport = () => {}) {
|
|
|
286
287
|
yield [bundleArtifactName(bundleID), bundleID];
|
|
287
288
|
}
|
|
288
289
|
}
|
|
290
|
+
harden(getExportRecords);
|
|
289
291
|
|
|
290
292
|
async function* getArtifactNames() {
|
|
291
293
|
for (const bundleID of sqlGetBundleIDs.iterate()) {
|
|
292
294
|
yield bundleArtifactName(bundleID);
|
|
293
295
|
}
|
|
294
296
|
}
|
|
297
|
+
harden(getArtifactNames);
|
|
295
298
|
|
|
296
299
|
function computeSha512(bytes) {
|
|
297
300
|
const hash = createHash('sha512');
|
|
@@ -364,6 +367,7 @@ export function makeBundleStore(db, ensureTxn, noteExport = () => {}) {
|
|
|
364
367
|
function* getBundleIDs() {
|
|
365
368
|
yield* sqlListBundleIDs.iterate();
|
|
366
369
|
}
|
|
370
|
+
harden(getBundleIDs);
|
|
367
371
|
|
|
368
372
|
return harden({
|
|
369
373
|
importBundleRecord,
|
package/src/exporter.js
CHANGED
|
@@ -164,6 +164,7 @@ export function makeSwingStoreExporter(dirPath, options = {}) {
|
|
|
164
164
|
yield* transcriptStore.getExportRecords(true);
|
|
165
165
|
yield* bundleStore.getExportRecords();
|
|
166
166
|
}
|
|
167
|
+
harden(getExportData);
|
|
167
168
|
|
|
168
169
|
/**
|
|
169
170
|
* @returns {AsyncIterableIterator<string>}
|
|
@@ -174,6 +175,7 @@ export function makeSwingStoreExporter(dirPath, options = {}) {
|
|
|
174
175
|
yield* transcriptStore.getArtifactNames(artifactMode);
|
|
175
176
|
yield* bundleStore.getArtifactNames();
|
|
176
177
|
}
|
|
178
|
+
harden(getArtifactNames);
|
|
177
179
|
|
|
178
180
|
/**
|
|
179
181
|
* @param {string} name
|
package/src/snapStore.js
CHANGED
|
@@ -306,6 +306,7 @@ export function makeSnapStore(
|
|
|
306
306
|
const snapshotReader = gzReader.pipe(unzipper);
|
|
307
307
|
yield* snapshotReader;
|
|
308
308
|
}
|
|
309
|
+
harden(exporter);
|
|
309
310
|
return exporter();
|
|
310
311
|
}
|
|
311
312
|
|
|
@@ -344,6 +345,7 @@ export function makeSnapStore(
|
|
|
344
345
|
Fail`actual hash ${q(hash)} !== expected ${q(snapshotID)}`;
|
|
345
346
|
}
|
|
346
347
|
}
|
|
348
|
+
harden(loadSnapshot);
|
|
347
349
|
|
|
348
350
|
const sqlDeleteVatSnapshots = db.prepare(`
|
|
349
351
|
DELETE FROM snapshots
|
|
@@ -481,6 +483,7 @@ export function makeSnapStore(
|
|
|
481
483
|
}
|
|
482
484
|
}
|
|
483
485
|
}
|
|
486
|
+
harden(getExportRecords);
|
|
484
487
|
|
|
485
488
|
async function* getArtifactNames(artifactMode) {
|
|
486
489
|
for (const rec of sqlGetAvailableSnapshots.iterate(1)) {
|
|
@@ -492,6 +495,7 @@ export function makeSnapStore(
|
|
|
492
495
|
}
|
|
493
496
|
}
|
|
494
497
|
}
|
|
498
|
+
harden(getArtifactNames);
|
|
495
499
|
|
|
496
500
|
const sqlAddSnapshotRecord = db.prepare(`
|
|
497
501
|
INSERT INTO snapshots (vatID, snapPos, hash, inUse)
|
|
@@ -640,6 +644,7 @@ export function makeSnapStore(
|
|
|
640
644
|
function* listAllSnapshots() {
|
|
641
645
|
yield* sqlListAllSnapshots.iterate();
|
|
642
646
|
}
|
|
647
|
+
harden(listAllSnapshots);
|
|
643
648
|
|
|
644
649
|
const sqlDumpCurrentSnapshots = db.prepare(`
|
|
645
650
|
SELECT vatID, snapPos, hash, compressedSnapshot, inUse
|
package/src/transcriptStore.js
CHANGED
|
@@ -43,6 +43,7 @@ import { createSHA256 } from './hasher.js';
|
|
|
43
43
|
function* empty() {
|
|
44
44
|
// Yield nothing
|
|
45
45
|
}
|
|
46
|
+
harden(empty);
|
|
46
47
|
|
|
47
48
|
/**
|
|
48
49
|
* @param {number} position
|
|
@@ -158,6 +159,7 @@ export function makeTranscriptStore(
|
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
161
|
}
|
|
162
|
+
harden(readFullVatTranscript);
|
|
161
163
|
|
|
162
164
|
function spanArtifactName(rec) {
|
|
163
165
|
return `transcript.${rec.vatID}.${rec.startPos}.${rec.endPos}`;
|
|
@@ -393,6 +395,7 @@ export function makeTranscriptStore(
|
|
|
393
395
|
}
|
|
394
396
|
}
|
|
395
397
|
}
|
|
398
|
+
harden(getExportRecords);
|
|
396
399
|
|
|
397
400
|
const sqlCountSpanItems = db.prepare(`
|
|
398
401
|
SELECT COUNT(*) FROM transcriptItems
|
|
@@ -447,6 +450,7 @@ export function makeTranscriptStore(
|
|
|
447
450
|
}
|
|
448
451
|
}
|
|
449
452
|
}
|
|
453
|
+
harden(getArtifactNames);
|
|
450
454
|
|
|
451
455
|
const sqlGetSpanEndPos = db.prepare(`
|
|
452
456
|
SELECT endPos
|
|
@@ -501,6 +505,7 @@ export function makeTranscriptStore(
|
|
|
501
505
|
expectedCount,
|
|
502
506
|
)})`;
|
|
503
507
|
}
|
|
508
|
+
harden(reader);
|
|
504
509
|
|
|
505
510
|
if (startPos === endPos) {
|
|
506
511
|
return empty();
|
|
@@ -541,6 +546,7 @@ export function makeTranscriptStore(
|
|
|
541
546
|
yield Buffer.from(`${entry}\n`);
|
|
542
547
|
}
|
|
543
548
|
}
|
|
549
|
+
harden(exportSpan);
|
|
544
550
|
|
|
545
551
|
const sqlAddItem = db.prepare(`
|
|
546
552
|
INSERT INTO transcriptItems (vatID, item, position, incarnation)
|
package/test/test-deletion.js
CHANGED
|
@@ -83,6 +83,7 @@ async function fakeAVatSnapshot(vat, ks) {
|
|
|
83
83
|
async function* getSnapshotStream() {
|
|
84
84
|
yield Buffer.from(`snapshot of vat ${vat.vatID} as of ${vat.endPos}`);
|
|
85
85
|
}
|
|
86
|
+
harden(getSnapshotStream);
|
|
86
87
|
await ks.snapStore.saveSnapshot(vat.vatID, vat.endPos, getSnapshotStream());
|
|
87
88
|
ks.transcriptStore.addItem(vat.vatID, 'save-snapshot');
|
|
88
89
|
vat.endPos += 1;
|
package/test/test-snapstore.js
CHANGED
package/test/test-state.js
CHANGED
package/test/util.js
CHANGED