git ssb

0+

wanderer🌟 / js-primea-hypervisor



Tree: 2ccf9440ac095c4a148a986168ef433353ae2815

Files: 2ccf9440ac095c4a148a986168ef433353ae2815 / 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