### Table of Contents - [constructor](#constructor) - [getInstanceByPath](#getinstancebypath) - [getInstanceByPort](#getinstancebyport) - [wait](#wait) - [createInstance](#createinstance) - [createStateRoot](#createstateroot) - [registerContainer](#registercontainer) ## constructor [index.js:10-14](https://github.com/primea/js-primea-hypervisor/blob/9b7a855ce9b773c9162179ef6cdb3c70739711f0/index.js#L10-L14 "Source code on GitHub") The Hypervisor manages the container instances by instantiating them and destorying them when possible. It also facilitates localating Containers **Parameters** - `dag` **Graph** an instance of [ipfs.dag](https://github.com/ipfs/interface-ipfs-core/tree/master/API/dag#dag-api) ## getInstanceByPath [index.js:21-28](https://github.com/primea/js-primea-hypervisor/blob/9b7a855ce9b773c9162179ef6cdb3c70739711f0/index.js#L21-L28 "Source code on GitHub") get a container by its path **Parameters** - `root` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the root container to start searching from - `path` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the path to travers ## getInstanceByPort [index.js:35-46](https://github.com/primea/js-primea-hypervisor/blob/9b7a855ce9b773c9162179ef6cdb3c70739711f0/index.js#L35-L46 "Source code on GitHub") get a contrainer instance given its entry port and its mounting port **Parameters** - `port` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the entry port for the container - `parentPort` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the entry port of the parent container ## wait [index.js:56-63](https://github.com/primea/js-primea-hypervisor/blob/9b7a855ce9b773c9162179ef6cdb3c70739711f0/index.js#L56-L63 "Source code on GitHub") given a port, wait untill its source contract has reached the threshold tick count **Parameters** - `port` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the port to wait on - `threshold` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the number of ticks to wait before resolving - `fromPort` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the entryPort of the container requesting the wait. Used internally so that waits don't become cyclic ## createInstance [index.js:73-95](https://github.com/primea/js-primea-hypervisor/blob/9b7a855ce9b773c9162179ef6cdb3c70739711f0/index.js#L73-L95 "Source code on GitHub") creates an instance given the container type, starting state, entry port and the parentPort **Parameters** - `type` - `state` - `entryPort` (optional, default `null`) - `parentPort` - `the` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** type of VM to load - `the` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** starting state of the VM - `the` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** entry port - `the` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** parent port ## createStateRoot [index.js:104-107](https://github.com/primea/js-primea-hypervisor/blob/9b7a855ce9b773c9162179ef6cdb3c70739711f0/index.js#L104-L107 "Source code on GitHub") creates a state root starting from a given container and a given number of ticks **Parameters** - `container` **Container** an container instance - `ticks` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the number of ticks at which to create the state root Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** ## registerContainer [index.js:114-116](https://github.com/primea/js-primea-hypervisor/blob/9b7a855ce9b773c9162179ef6cdb3c70739711f0/index.js#L114-L116 "Source code on GitHub") regirsters a container with the hypervisor **Parameters** - `type` - `vm` - `the` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the type - `a` **Class** Class for instantiating the container