-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wanderer
committed
Nov 21, 2017
1 parent
ad6bbae
commit f6890c6
Showing
2 changed files
with
19 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,7 +126,6 @@ module.exports = class Actor { | |
data: result | ||
})) | ||
} | ||
this.caps.clist.clear() | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,41 @@ | ||
module.exports = class CapsManager { | ||
/** | ||
* The caps manager manages perstantly stores the capabilities | ||
* The port manager manages the the ports. This inculdes creation, deletion | ||
* fetching and waiting on ports | ||
* @param {Object} caps | ||
* @param {Object} opts | ||
* @param {Object} opts.state | ||
* @param {Object} opts.hypervisor | ||
* @param {Object} opts.exoInterface | ||
*/ | ||
constructor (caps) { | ||
this._storedCaps = caps | ||
this.clist = new Set() | ||
} | ||
|
||
/** | ||
* Stores a capability persistantly | ||
* @param {String} key | ||
* @param {Object} cap | ||
* binds a port to a name | ||
* @param {Object} port - the port to bind | ||
* @param {String} name - the name of the port | ||
*/ | ||
store (key, cap) { | ||
this._storedCaps[key] = cap | ||
store (name, cap) { | ||
// save the port instance | ||
this._storedCaps[name] = cap | ||
} | ||
|
||
/** | ||
* gets a cap given it's key | ||
* @param {String} key | ||
* gets a port given it's name | ||
* @param {String} name | ||
* @return {Object} | ||
*/ | ||
get (key) { | ||
const cap = this._storedCaps[key] | ||
get (name) { | ||
const cap = this._storedCaps[name] | ||
return cap | ||
} | ||
|
||
/** | ||
* delete an cap given its key | ||
* @param {string} key | ||
* delete an port given the name it is bound to | ||
* @param {string} name | ||
*/ | ||
delete (key) { | ||
delete this._storedCaps[key] | ||
delete (name) { | ||
delete this._storedCaps[name] | ||
} | ||
} |