git ssb

0+

wanderer🌟 / js-primea-hypervisor



Tree: 841228acfa1dad00f990ebe18290a46130f85d5d

Files: 841228acfa1dad00f990ebe18290a46130f85d5d / hypervisor.js

815 bytesRaw
1const Kernel = require('./index.js')
2const Vertex = require('merkle-trie')
3// const Block = require('./deps/block.js')
4// const blockchain = require('./fakeBlockChain.js')
5const codeHandlers = require('./codeHandler.js')
6
7module.exports = class Hypervisor {
8 constructor (state = new Vertex()) {
9 this.state = state
10 // if (state.isEmpty) {
11 // state.set('block', new Vertex({
12 // value: new Block()
13 // }))
14 // state.set('blockchain', new Vertex({
15 // value: blockchain
16 // }))
17 // }
18 this.root = new Kernel({
19 state: state
20 })
21 }
22
23 set (path, kernel) {
24 this.state.set(path, new Vertex({
25 value: kernel
26 }))
27 }
28
29 send (message) {
30 return this.root.send(message)
31 }
32
33 addVM (type, handler) {
34 codeHandlers.handlers.type = handler
35 }
36}
37

Built with git-ssb-web