docs/kernel.mdView |
---|
| 1 | + |
| 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 |