git ssb

0+

wanderer🌟 / js-primea-hypervisor



Tree: 5a462dae8e421e6271dd15faf3802048e0f23596

Files: 5a462dae8e421e6271dd15faf3802048e0f23596 / capsManager.js

889 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 }
13
14 /**
15 * binds a port to a name
16 * @param {Object} port - the port to bind
17 * @param {String} name - the name of the port
18 */
19 store (name, cap) {
20 // save the port instance
21 this._storedCaps[name] = cap
22 }
23
24 /**
25 * gets a port given it's name
26 * @param {String} name
27 * @return {Object}
28 */
29 get (name) {
30 const cap = this._storedCaps[name]
31 return cap
32 }
33
34 /**
35 * delete an port given the name it is bound to
36 * @param {string} name
37 */
38 delete (name) {
39 delete this._storedCaps[name]
40 }
41}
42

Built with git-ssb-web