Commit 10adf36ec054d54b267d35d30b82d0a5c0ba049f
change interal api to be the same as abstract container
Signed-off-by: wanderer <mjbecze@gmail.com>wanderer committed on 7/28/2017, 3:02:13 AM
Parent: 7f083b2d6862e1386c0b25817fd1e1442bd8577a
Files changed
index.js | changed |
kernel.js | changed |
tests/index.js | changed |
index.js | ||
---|---|---|
@@ -138,9 +138,9 @@ | ||
138 | 138 | // create the container instance |
139 | 139 | const instance = await this._loadInstance(idHash) |
140 | 140 | resolve(instance) |
141 | 141 | // send the intialization message |
142 | - await instance.initialize(message) | |
142 | + await instance.create(message) | |
143 | 143 | |
144 | 144 | if (state.code && state.code.length > this.MAX_DATA_BYTES) { |
145 | 145 | state.code = chunk(state.code, this.MAX_DATA_BYTES).map(chk => { |
146 | 146 | return { |
kernel.js | ||
---|---|---|
@@ -39,10 +39,10 @@ | ||
39 | 39 | this.ports.queue(portName, message) |
40 | 40 | return this._startMessageLoop() |
41 | 41 | } |
42 | 42 | |
43 | - async initialize (message) { | |
44 | - await this.run(message, 'onCreation') | |
43 | + async create (message) { | |
44 | + await this.message(message, 'onCreation') | |
45 | 45 | return this._startMessageLoop() |
46 | 46 | } |
47 | 47 | |
48 | 48 | // waits for the next message |
@@ -63,9 +63,9 @@ | ||
63 | 63 | this.ticks = message._fromTicks |
64 | 64 | this.hypervisor.scheduler.update(this) |
65 | 65 | } |
66 | 66 | // run the next message |
67 | - await this.run(message) | |
67 | + await this.message(message) | |
68 | 68 | } |
69 | 69 | |
70 | 70 | this.containerState = 'idle' |
71 | 71 | this.container.onIdle() |
@@ -85,9 +85,9 @@ | ||
85 | 85 | * @param {object} message - the message to run |
86 | 86 | * @param {boolean} init - whether or not to run the intialization routine |
87 | 87 | * @returns {Promise} |
88 | 88 | */ |
89 | - async run (message, method = 'onMessage') { | |
89 | + async message (message, method = 'onMessage') { | |
90 | 90 | if (message.constructor === DeleteMessage) { |
91 | 91 | this.ports._delete(message.fromName) |
92 | 92 | } else { |
93 | 93 | const responsePort = message.responsePort |
tests/index.js | ||
---|---|---|
@@ -225,9 +225,9 @@ | ||
225 | 225 | const hypervisor = new Hypervisor(node.dag) |
226 | 226 | |
227 | 227 | hypervisor.registerContainer('root', Root) |
228 | 228 | const root = await hypervisor.createInstance('root') |
229 | - await root.run(root.createMessage()) | |
229 | + await root.message(root.createMessage()) | |
230 | 230 | const stateRoot = await hypervisor.createStateRoot() |
231 | 231 | |
232 | 232 | t.deepEquals(stateRoot, { |
233 | 233 | '/': 'zdpuAwrMmQXqFusve7zcRYxVUuji4NVzZR5GyjwyStsjteCoW' |
Built with git-ssb-web