Skip to content

Commit

Permalink
refactor(swingset): refine types for ManagerOptions, CapData
Browse files Browse the repository at this point in the history
 - ManagerOptions includes enablePipelining, notifyTermination
 - align type annotations with where CapData slots are parsed
 - replayTranscript is async
  • Loading branch information
dckc committed May 25, 2021
1 parent 299d55c commit 208b211
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/SwingSet/src/capdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { assert, details as X } from '@agoric/assert';
* @param {any} capdata The object to be tested
* @throws {Error} if, upon inspection, the parameter does not satisfy the above
* criteria.
* @returns {asserts capdata is CapData}
* @returns {asserts capdata is CapData<unknown>}
*/
export function insistCapData(capdata) {
assert.typeof(
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/src/kernel/parseKernelSlots.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { assert, details as X } from '@agoric/assert';
* id: Nat
* }
*
* @param {string} s The string to be parsed, as described above.
* @param {unknown} s The string to be parsed, as described above.
*
* @returns {{type: 'object' | 'device' | 'promise', id: number}} a kernel slot object corresponding to the parameter.
*
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/src/kernel/state/kernelKeeper.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ export default function makeKernelKeeper(kvStore, kernelSlog) {
* Note that currently we are only reference counting promises, but ultimately
* we intend to keep track of all objects with kernel slots.
*
* @param {string} kernelSlot The kernel slot whose refcount is to be incremented.
* @param {unknown} kernelSlot The kernel slot whose refcount is to be incremented.
* @param {string} _tag
*/
function incrementRefCount(kernelSlot, _tag) {
Expand Down
10 changes: 6 additions & 4 deletions packages/SwingSet/src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@
* enableSetup: true,
* }} HasSetup
*
* TODO: metered...
*
* TODO: liveSlotsConsole...
* See validateManagerOptions() in factory.js
*
* @typedef { 'local' | 'nodeWorker' | 'node-subprocess' | 'xs-worker' } ManagerType
* @typedef {{
* enablePipelining?: boolean,
* managerType: ManagerType,
* metered?: boolean,
* enableDisavow?: boolean,
* vatParameters: Record<string, unknown>,
* notifyTermination?: (shouldReject: boolean, info: SwingSetCapData) => void,
* virtualObjectCacheSize: number,
* vatParameters: Record<string, unknown>,
* name: string,
* compareSyscalls?: (originalSyscall: {}, newSyscall: {}) => Error | undefined,
* } & (HasBundle | HasSetup)} ManagerOptions
Expand Down Expand Up @@ -116,7 +118,7 @@
* vatSyscallHandler: unknown) => Promise<VatManager>,
* } } VatManagerFactory
* @typedef { { deliver: (delivery: VatDeliveryObject) => Promise<VatDeliveryResult>,
* replayTranscript: () => void,
* replayTranscript: () => Promise<void>,
* shutdown: () => Promise<void>,
* } } VatManager
* @typedef { () => Promise<void> } WaitUntilQuiescent
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/src/vats/comms/parseLocalSlots.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { assert, details as X } from '@agoric/assert';
* id: Nat
* }
*
* @param {string} s The string to be parsed, as described above.
* @param {unknown} s The string to be parsed, as described above.
*
* @returns {{type: 'object' | 'promise', id: number}} a local slot object corresponding to the parameter.
*
Expand Down

0 comments on commit 208b211

Please sign in to comment.