git ssb

0+

wanderer🌟 / js-primea-hypervisor



Tree: db06b3c2442cea31e0706a4c186e8cc21b06d368

Files: db06b3c2442cea31e0706a4c186e8cc21b06d368 / capsManager.js

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

Built with git-ssb-web