@metamask/ocap-kernel
Version:
OCap kernel core components
41 lines • 1.89 kB
text/typescript
import { KernelQueue } from "./KernelQueue.mjs";
import type { KernelStore } from "./store/index.mjs";
import type { VatId, RunQueueItem, CrankResults } from "./types.mjs";
import { VatHandle } from "./VatHandle.mjs";
/**
* 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.mts.map