Skip to content

Commit

Permalink
fixup! feat(SwingSet): force reload from snapshot
Browse files Browse the repository at this point in the history
clarify startXSnap init details
  • Loading branch information
mhofman committed Apr 30, 2023
1 parent c3f055d commit f990398
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions packages/SwingSet/src/controller/startXSnap.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const NETSTRING_MAX_CHUNK_SIZE = 12_000_000;
*/

/**
* @typedef {object} StartXSnapLoadFromSnapshotDetails
* @property {'snapshot'} source
* @typedef {object} StartXSnapInitFromSnapshotStreamDetails
* @property {'snapshotStream'} from
* @property {AsyncIterable<Uint8Array>} snapshotStream
* @property {string} [snapshotDescription]
*/
Expand All @@ -27,7 +27,7 @@ const NETSTRING_MAX_CHUNK_SIZE = 12_000_000;
* TODO: transition to direct snapshot stream, and remove this option
*/

/** @typedef {StartXSnapInitFromBundlesDetails | StartXSnapLoadFromSnapshotDetails | StartXSnapInitFromSnapStoreDetails} StartXSnapInitDetails */
/** @typedef {StartXSnapInitFromBundlesDetails | StartXSnapInitFromSnapshotStreamDetails | StartXSnapInitFromSnapStoreDetails} StartXSnapInitDetails */

/** @typedef {ReturnType<typeof makeStartXSnap>} StartXSnap */

Expand Down Expand Up @@ -108,10 +108,10 @@ export function makeStartXSnap(options) {
return { snapshotStream, snapshotDescription };
}

if (loadDetails.source === 'snapshot') {
const { snapshotStream, snapshotDescription } = loadDetails;
return { snapshotStream, snapshotDescription };
}
case 'snapshotStream': {
const { snapshotStream, snapshotDescription } = initDetails;
return { snapshotStream, snapshotDescription };
}

default:
// @ts-expect-error exhaustive check
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ export function makeXsSubprocessFactory({
bundleIDs,
handleCommand: handleCommandKit.handleCommand,
metered,
load: {
source: 'snapshot',
init: {
from: 'snapshotStream',
snapshotStream: restartWorkerStream,
snapshotDescription,
},
Expand Down

0 comments on commit f990398

Please sign in to comment.