### Table of Contents - [constructor][1] - [send][2] - [loadActor][3] - [newActor][4] - [createModule][5] - [createActor][6] - [createStateRoot][7] - [setStateRoot][8] - [registerModule][9] - [registerDriver][10] ## constructor The Hypervisor manages module instances by instantiating them and destroying them when possible. It also facilitates locating Containers **Parameters** - `opts` **[Object][11]** - `opts.tree` **[Object][11]** a [radix tree][12] to store the state - `opts.modules` **[Array][13]** an array of modules to register - `opts.drivers` **[Array][13]** an array of drivers to install - `opts.meter` **[boolean][14]** whether to meter gas or not (optional, default `true`) ## send sends a message(s). If an array of message is given the all the messages will be sent at once **Parameters** - `messages` - `message` **[Object][11]** the [message][15] to send Returns **[Promise][16]** a promise that resolves once the receiving module is loaded ## loadActor loads an actor from the tree given its id **Parameters** - `id` **ID** Returns **[Promise][16]<Actor>** ## newActor creates an actor from a module and code **Parameters** - `mod` **[Module][17]** the module - `code` **[Buffer][18]** the code Returns **ActorRef** ## createModule creates a modref from a module and code **Parameters** - `mod` **[Module][17]** the module - `code` **[Buffer][18]** the code - `id` **id** the id for the module (optional, default `{nonce:this.nonce++,parent:null}`) Returns **ModuleRef** ## createActor creates an instance of an Actor **Parameters** - `modRef` - `id` **[Object][11]** the id for the actor (optional, default `{nonce:this.nonce++,parent:null}`) - `type` **ModuleRef** the modref Returns **ActorRef** ## createStateRoot creates a state root when scheduler is idle Returns **[Promise][16]** ## setStateRoot set the state root. The promise must resolve before creating or sending any more messages to the hypervisor **Parameters** - `stateRoot` **[Buffer][18]** Returns **[Promise][16]** ## registerModule registers a module with the hypervisor **Parameters** - `Constructor` **[Function][19]** the module's constructor ## registerDriver register a driver with the hypervisor **Parameters** - `driver` **Driver** [1]: #constructor [2]: #send [3]: #loadactor [4]: #newactor [5]: #createmodule [6]: #createactor [7]: #createstateroot [8]: #setstateroot [9]: #registermodule [10]: #registerdriver [11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object [12]: https://github.com/dfinity/js-dfinity-radix-tree [13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array [14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean [15]: https://github.com/primea/js-primea-message [16]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise [17]: https://nodejs.org/api/modules.html [18]: https://nodejs.org/api/buffer.html [19]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function