@agoric/swing-store 0.9.2-dev-df4954e.0 → 0.9.2-dev-074abce.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/exporter.js +15 -12
- package/test/exportImport.test.js +6 -5
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-074abce.0+074abce",
|
|
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-074abce.0+074abce",
|
|
25
|
+
"@agoric/internal": "0.3.3-dev-074abce.0+074abce",
|
|
26
26
|
"@endo/base64": "^1.0.5",
|
|
27
27
|
"@endo/bundle-source": "^3.2.3",
|
|
28
28
|
"@endo/check-bundle": "^1.0.7",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"typeCoverage": {
|
|
52
52
|
"atLeast": 76.3
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "074abced7540692878d513933dd6d49d23e6f0c2"
|
|
55
55
|
}
|
package/src/exporter.js
CHANGED
|
@@ -111,12 +111,6 @@ export function makeSwingStoreExporter(dirPath, options = {}) {
|
|
|
111
111
|
const bundleStore = makeBundleStore(db, ensureTxn);
|
|
112
112
|
const transcriptStore = makeTranscriptStore(db, ensureTxn, () => {});
|
|
113
113
|
|
|
114
|
-
if (artifactMode !== 'debug') {
|
|
115
|
-
// throw early if this DB will not be able to create all the desired artifacts
|
|
116
|
-
const internal = { snapStore, bundleStore, transcriptStore };
|
|
117
|
-
assertComplete(internal, artifactMode);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
114
|
const sqlKVGet = db.prepare(`
|
|
121
115
|
SELECT value
|
|
122
116
|
FROM kvStore
|
|
@@ -168,16 +162,25 @@ export function makeSwingStoreExporter(dirPath, options = {}) {
|
|
|
168
162
|
}
|
|
169
163
|
harden(getExportData);
|
|
170
164
|
|
|
171
|
-
/**
|
|
172
|
-
|
|
173
|
-
* @yields {string}
|
|
174
|
-
*/
|
|
175
|
-
async function* getArtifactNames() {
|
|
165
|
+
/** @yields {string} */
|
|
166
|
+
async function* artifactNames() {
|
|
176
167
|
yield* snapStore.getArtifactNames(artifactMode);
|
|
177
168
|
yield* transcriptStore.getArtifactNames(artifactMode);
|
|
178
169
|
yield* bundleStore.getArtifactNames();
|
|
179
170
|
}
|
|
180
|
-
harden(
|
|
171
|
+
harden(artifactNames);
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* @returns {AsyncIterableIterator<string>}
|
|
175
|
+
*/
|
|
176
|
+
function getArtifactNames() {
|
|
177
|
+
if (artifactMode !== 'debug') {
|
|
178
|
+
// throw if this DB will not be able to yield all the desired artifacts
|
|
179
|
+
const internal = { snapStore, bundleStore, transcriptStore };
|
|
180
|
+
assertComplete(internal, artifactMode);
|
|
181
|
+
}
|
|
182
|
+
return artifactNames();
|
|
183
|
+
}
|
|
181
184
|
|
|
182
185
|
/**
|
|
183
186
|
* @param {string} name
|
|
@@ -220,15 +220,16 @@ async function testExportImport(
|
|
|
220
220
|
await ssOut.hostStorage.commit();
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
+
// the exporter may be broken (the swingstore may be incomplete), but that is
|
|
224
|
+
// signaled during `getArtifactNames()`, not during construction (which must
|
|
225
|
+
// finish quickly, without scanning the whole DB)
|
|
226
|
+
const exporter = makeSwingStoreExporter(dbDir, { artifactMode: exportMode });
|
|
227
|
+
|
|
223
228
|
const incomplete = 'incomplete archival transcript: 3 vs 12';
|
|
224
|
-
function doExport() {
|
|
225
|
-
return makeSwingStoreExporter(dbDir, { artifactMode: exportMode });
|
|
226
|
-
}
|
|
227
229
|
if (failureMode === 'export') {
|
|
228
|
-
await t.throws(
|
|
230
|
+
await t.throws(() => exporter.getArtifactNames(), { message: incomplete });
|
|
229
231
|
return;
|
|
230
232
|
}
|
|
231
|
-
const exporter = doExport();
|
|
232
233
|
|
|
233
234
|
const exportData = [];
|
|
234
235
|
for await (const elem of exporter.getExportData()) {
|