-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(swingset): RecordedVatOptions holds workerOptions, not managerType
The internal record of vat options is stored by the vatKeeper's `setSourceAndOptions()`, and is of type RecordedVatOptions. This is passed to the vat loader to decide how to construct ManagerOptions to start the worker. This commit replaces the `.managerType` property of RecordedVatOptions with a new WorkerOptions record. For now, this only has a `.type` field, whose value is either `local` or `xsnap`. Soon, the xsnap flavor will acquire new `bundleIDs` properties. The user-facing vat-options APIs (config.vats, kernel.createTestVat, and E(vatAdminSvc).createVat) continue to use a `managerType` of 'local' or 'xs-worker' to control the selection. (I prefer the name `xsnap` to describe the XS-in-subprocess worker, but the old 'xs-worker' name is used extensively by unit tests in other packages, and is impractical to change right now). The `makeWorkerOptions()` helper function is used to convert the user-facing options into the internal form.
- Loading branch information
Showing
11 changed files
with
115 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* @param {import("../types-external").KernelKeeper} kernelKeeper | ||
* @param {string} [managerType] | ||
* @returns {Promise<import("../types-internal").WorkerOptions>} | ||
*/ | ||
export async function makeWorkerOptions(kernelKeeper, managerType) { | ||
managerType = managerType || kernelKeeper.getDefaultManagerType(); | ||
if (managerType === 'local') { | ||
return harden({ type: 'local' }); | ||
} else if (managerType === 'xs-worker') { | ||
return harden({ type: 'xsnap' }); | ||
} | ||
throw Error(`unknown managerType '${managerType}'`); | ||
} | ||
|
||
/** | ||
* @param {import("../types-internal").WorkerOptions} origWorkerOptions | ||
* @returns {Promise<import("../types-internal").WorkerOptions>} | ||
*/ | ||
export async function updateWorkerOptions(origWorkerOptions) { | ||
const { type } = origWorkerOptions; | ||
if (type === 'local') { | ||
return origWorkerOptions; | ||
} else if (type === 'xsnap') { | ||
return harden({ ...origWorkerOptions }); | ||
} | ||
throw Error(`unknown worker type '${type}'`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters