capsManager.jsView |
---|
1 | 1 | module.exports = class CapsManager { |
2 | 2 | |
3 | | - * The caps manager manages perstantly stores the capabilities |
| 3 | + * The port manager manages the the ports. This inculdes creation, deletion |
4 | 4 | * fetching and waiting on ports |
5 | | - * @param {Object} caps |
| 5 | + * @param {Object} opts |
| 6 | + * @param {Object} opts.state |
| 7 | + * @param {Object} opts.hypervisor |
| 8 | + * @param {Object} opts.exoInterface |
6 | 9 | */ |
7 | 10 | constructor (caps) { |
8 | 11 | this._storedCaps = caps |
9 | | - this.clist = new Set() |
10 | 12 | } |
11 | 13 | |
12 | 14 | |
13 | | - * Stores a capability persistantly |
14 | | - * @param {String} key |
15 | | - * @param {Object} cap |
| 15 | + * binds a port to a name |
| 16 | + * @param {Object} port - the port to bind |
| 17 | + * @param {String} name - the name of the port |
16 | 18 | */ |
17 | | - store (key, cap) { |
18 | | - this._storedCaps[key] = cap |
| 19 | + store (name, cap) { |
| 20 | + |
| 21 | + this._storedCaps[name] = cap |
19 | 22 | } |
20 | 23 | |
21 | 24 | |
22 | | - * gets a cap given it's key |
23 | | - * @param {String} key |
| 25 | + * gets a port given it's name |
| 26 | + * @param {String} name |
24 | 27 | * @return {Object} |
25 | 28 | */ |
26 | | - get (key) { |
27 | | - const cap = this._storedCaps[key] |
| 29 | + get (name) { |
| 30 | + const cap = this._storedCaps[name] |
28 | 31 | return cap |
29 | 32 | } |
30 | 33 | |
31 | 34 | |
32 | | - * delete an cap given its key |
33 | | - * @param {string} key |
| 35 | + * delete an port given the name it is bound to |
| 36 | + * @param {string} name |
34 | 37 | */ |
35 | | - delete (key) { |
36 | | - delete this._storedCaps[key] |
| 38 | + delete (name) { |
| 39 | + delete this._storedCaps[name] |
37 | 40 | } |
38 | 41 | } |