git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 317d79e49cb56dd81cb9c94072cd24ad6a825757

added the kernel docs

wanderer committed on 6/29/2017, 3:59:58 AM
Parent: b96d34ff7c58dbdbb3daa45e4639df438f669891

Files changed

docs/kernel.mdadded
index.jschanged
docs/kernel.mdView
@@ -1,0 +1,84 @@
1+<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
2+
3+### Table of Contents
4+
5+- [constructor](#constructor)
6+- [queue](#queue)
7+- [run](#run)
8+- [incrementTicks](#incrementticks)
9+- [createMessage](#createmessage)
10+- [send](#send)
11+
12+## constructor
13+
14+[kernel.js:15-28](https://github.com/primea/js-primea-hypervisor/blob/b507f49239a73767abbee979b4e637a6ca469764/kernel.js#L15-L28 "Source code on GitHub")
15+
16+the ExoInterface manages the varous message passing functions and provides
17+an interface for the containers to use
18+
19+**Parameters**
20+
21+- `opts` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
22+ - `opts.id` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
23+ - `opts.state` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
24+ - `opts.hypervisor` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
25+ - `opts.Container` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
26+
27+## queue
28+
29+[kernel.js:35-48](https://github.com/primea/js-primea-hypervisor/blob/b507f49239a73767abbee979b4e637a6ca469764/kernel.js#L35-L48 "Source code on GitHub")
30+
31+adds a message to this containers message queue
32+
33+**Parameters**
34+
35+- `portName` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
36+- `message` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
37+
38+## run
39+
40+[kernel.js:78-98](https://github.com/primea/js-primea-hypervisor/blob/b507f49239a73767abbee979b4e637a6ca469764/kernel.js#L78-L98 "Source code on GitHub")
41+
42+run the kernels code with a given enviroment
43+The Kernel Stores all of its state in the Environment. The Interface is used
44+to by the VM to retrive infromation from the Environment.
45+
46+**Parameters**
47+
48+- `message`
49+- `init` (optional, default `false`)
50+
51+Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
52+
53+## incrementTicks
54+
55+[kernel.js:104-107](https://github.com/primea/js-primea-hypervisor/blob/b507f49239a73767abbee979b4e637a6ca469764/kernel.js#L104-L107 "Source code on GitHub")
56+
57+updates the number of ticks that the container has run
58+
59+**Parameters**
60+
61+- `count` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the number of ticks to add
62+
63+## createMessage
64+
65+[kernel.js:113-121](https://github.com/primea/js-primea-hypervisor/blob/b507f49239a73767abbee979b4e637a6ca469764/kernel.js#L113-L121 "Source code on GitHub")
66+
67+creates a new message
68+
69+**Parameters**
70+
71+- `opts`
72+- `data` **any**
73+
74+## send
75+
76+[kernel.js:128-145](https://github.com/primea/js-primea-hypervisor/blob/b507f49239a73767abbee979b4e637a6ca469764/kernel.js#L128-L145 "Source code on GitHub")
77+
78+sends a message to a given port
79+
80+**Parameters**
81+
82+- `port`
83+- `message` **Message** the message
84+- `portRef` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the port
index.jsView
@@ -59,8 +59,13 @@
5959 this.scheduler.update(kernel)
6060 return kernel
6161 }
6262
63+ // get a hash from a POJO
64+ async _getHashFromObj (obj) {
65+ return (await this.graph.flush(obj))['/']
66+ }
67+
6368 /**
6469 * gets an existsing container instances
6570 * @param {string} id - the containers ID
6671 * @returns {Promise}
@@ -90,9 +95,9 @@
9095 async createInstance (type, code, entryPorts = [], id = {nonce: 0, parent: null}) {
9196 // create a lock to prevent the scheduler from reloving waits before the
9297 // new container is loaded
9398 const resolve = this.scheduler.getLock(id)
94- const idHash = await this.getHashFromObj(id)
99+ const idHash = await this._getHashFromObj(id)
95100 const state = {
96101 nonce: [0],
97102 ports: {},
98103 type: type,
@@ -139,14 +144,5 @@
139144 Constructor: Constructor,
140145 args: args
141146 }
142147 }
143-
144- /**
145- * get a hash from a POJO
146- * @param {object} obj
147- * @return {Promise}
148- */
149- async getHashFromObj (obj) {
150- return (await this.graph.flush(obj))['/']
151- }
152148 }

Built with git-ssb-web