Commit 4a1f9a53b0854ec031013d473ac2f51e826d4dc5
created root
wanderer committed on 4/29/2017, 3:53:12 PMParent: 93764459c5a9d26427a8995f181e763cee8ace32
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -1,17 +1,24 @@ | ||
1 | 1 | const Graph = require('ipld-graph-builder') |
2 | 2 | const multibase = require('multibase') |
3 | 3 | const Kernel = require('./kernel.js') |
4 | 4 | |
5 | +class Root { | |
6 | + queue () { | |
7 | + console.log('root queued!') | |
8 | + } | |
9 | +} | |
10 | + | |
5 | 11 | module.exports = class Hypervisor { |
6 | 12 | constructor (opts) { |
7 | 13 | this._opts = { |
8 | 14 | VMs: {} |
9 | 15 | } |
10 | 16 | |
11 | 17 | this.graph = new Graph(opts.dag) |
12 | 18 | delete opts.dag |
13 | - this._vmInstances = new Map() | |
19 | + this.root = new Root() | |
20 | + this._vmInstances = new Map([[null, new Root()]]) | |
14 | 21 | Object.assign(this._opts, opts) |
15 | 22 | } |
16 | 23 | |
17 | 24 | async getInstance (port) { |
@@ -72,8 +79,13 @@ | ||
72 | 79 | return this.graph.flush(port) |
73 | 80 | } |
74 | 81 | |
75 | 82 | async generateID (port) { |
83 | + // root id | |
84 | + if (!port) { | |
85 | + return null | |
86 | + } | |
87 | + | |
76 | 88 | let id = await this.graph.flush(port.id) |
77 | 89 | id = id['/'] |
78 | 90 | if (Buffer.isBuffer(id)) { |
79 | 91 | id = multibase.encode('base58btc', id).toString() |
Built with git-ssb-web