Skip to content

Latest commit

 

History

History
153 lines (87 loc) · 3.21 KB

hypervisor.md

File metadata and controls

153 lines (87 loc) · 3.21 KB

Table of Contents

constructor

The Hypervisor manages module instances by instantiating them and destroying them when possible. It also facilitates locating Containers

Parameters

  • opts Object
    • opts.tree Object a radix tree to store the state
    • opts.modules Array an array of modules to register
    • opts.drivers Array an array of drivers to install
    • opts.meter boolean 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

Returns Promise 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<Actor>

newActor

creates an actor from a module and code

Parameters

Returns ActorRef

createModule

creates a modref from a module and code

Parameters

  • mod Module the module
  • code Buffer 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 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

setStateRoot

set the state root. The promise must resolve before creating or sending any more messages to the hypervisor

Parameters

Returns Promise

registerModule

registers a module with the hypervisor

Parameters

  • Constructor Function the module's constructor

registerDriver

register a driver with the hypervisor

Parameters

  • driver Driver