UNPKG

@metamask/ocap-kernel

Version:
41 lines 1.89 kB
import { KernelQueue } from "./KernelQueue.cjs"; import type { KernelStore } from "./store/index.cjs"; import type { VatId, RunQueueItem, CrankResults } from "./types.cjs"; import { VatHandle } from "./VatHandle.cjs"; /** * The KernelRouter is responsible for routing messages to the correct vat. * * This class is responsible for routing messages to the correct vat, including * sending messages, resolving promises, and dropping imports. */ export declare class KernelRouter { #private; /** * Construct a new KernelRouter. * * @param kernelStore - The kernel's store. * @param kernelQueue - The kernel's queue. * @param getVat - A function that returns a vat handle for a given vat id. */ constructor(kernelStore: KernelStore, kernelQueue: KernelQueue, getVat: (vatId: VatId) => VatHandle); /** * Deliver a run queue item to its target. * * If the item being delivered is message whose target is a promise, it is * delivered based on the kernel's model of the promise's state: * - unresolved: it is put onto the queue that the kernel maintains for that promise * - fulfilled: it is forwarded to the promise resolution target * - rejected: the result promise of the message is in turn rejected according * to the kernel's model of the promise's rejection value * * If the item being delivered is a notification, the kernel's model of the * state of the promise being notified is updated, and any queue items * enqueued for that promise are placed onto the run queue. The notification * is also forwarded to all of the promise's registered subscribers. * * @param item - The message/notification to deliver. * @returns The crank outcome. */ deliver(item: RunQueueItem): Promise<CrankResults | undefined>; } //# sourceMappingURL=KernelRouter.d.cts.map