Skip to content

Commit

Permalink
removed creation methods
Browse files Browse the repository at this point in the history
Signed-off-by: wanderer <mjbecze@gmail.com>
  • Loading branch information
wanderer committed Sep 7, 2017
1 parent e103271 commit 67f1798
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 143 deletions.
7 changes: 5 additions & 2 deletions creationService.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ module.exports = class CreationService {

queue (port, message) {
if (message.data.type) {
const creator = this.scheduler.getInstance(message.fromId)
const id = creator.generateNextId()
let id
if (message.fromId) {
const creator = this.scheduler.getInstance(message.fromId)
id = creator.generateNextId()
}
return this.createInstance(message, id)
}
}
Expand Down
4 changes: 0 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ module.exports = class Hypervisor {
}
}

createInstance (message, id) {
return this.creationService.createInstance(message, id)
}

createChannel () {
const port1 = {
messages: []
Expand Down
12 changes: 0 additions & 12 deletions kernel.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,6 @@ module.exports = class Kernel {
return message
}

/**
* creates a new container. Returning a port to it.
* @param {String} type
* @param {*} data - the data to populate the initail state with
* @returns {Object}
*/
createInstance (message) {
this.ports.removeSentPorts(message)
const id = this.generateNextId()
return this.hypervisor.createInstance(message, id)
}

generateNextId () {
let nonce = this.state.nonce

Expand Down
2 changes: 1 addition & 1 deletion portManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ module.exports = class PortManager {
// save the port instance
this.ports[name] = port

// console.log(name, port)
// update the dest port
const destPort = await this.hypervisor.getDestPort(port)
port.messages.forEach(message => {
Expand Down Expand Up @@ -117,6 +116,7 @@ module.exports = class PortManager {
this._unboundPorts.forEach(port => {
waits.push(this.kernel.send(port, new DeleteMessage()))
})

this._unboundPorts.clear()
return Promise.all(waits)
}
Expand Down

0 comments on commit 67f1798

Please sign in to comment.