git ssb

0+

wanderer🌟 / js-primea-hypervisor



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.jschanged
kernel.jschanged
tests/index.jschanged
index.jsView
@@ -138,9 +138,9 @@
138138 // create the container instance
139139 const instance = await this._loadInstance(idHash)
140140 resolve(instance)
141141 // send the intialization message
142- await instance.initialize(message)
142+ await instance.create(message)
143143
144144 if (state.code && state.code.length > this.MAX_DATA_BYTES) {
145145 state.code = chunk(state.code, this.MAX_DATA_BYTES).map(chk => {
146146 return {
kernel.jsView
@@ -39,10 +39,10 @@
3939 this.ports.queue(portName, message)
4040 return this._startMessageLoop()
4141 }
4242
43- async initialize (message) {
44- await this.run(message, 'onCreation')
43+ async create (message) {
44+ await this.message(message, 'onCreation')
4545 return this._startMessageLoop()
4646 }
4747
4848 // waits for the next message
@@ -63,9 +63,9 @@
6363 this.ticks = message._fromTicks
6464 this.hypervisor.scheduler.update(this)
6565 }
6666 // run the next message
67- await this.run(message)
67+ await this.message(message)
6868 }
6969
7070 this.containerState = 'idle'
7171 this.container.onIdle()
@@ -85,9 +85,9 @@
8585 * @param {object} message - the message to run
8686 * @param {boolean} init - whether or not to run the intialization routine
8787 * @returns {Promise}
8888 */
89- async run (message, method = 'onMessage') {
89+ async message (message, method = 'onMessage') {
9090 if (message.constructor === DeleteMessage) {
9191 this.ports._delete(message.fromName)
9292 } else {
9393 const responsePort = message.responsePort
tests/index.jsView
@@ -225,9 +225,9 @@
225225 const hypervisor = new Hypervisor(node.dag)
226226
227227 hypervisor.registerContainer('root', Root)
228228 const root = await hypervisor.createInstance('root')
229- await root.run(root.createMessage())
229+ await root.message(root.createMessage())
230230 const stateRoot = await hypervisor.createStateRoot()
231231
232232 t.deepEquals(stateRoot, {
233233 '/': 'zdpuAwrMmQXqFusve7zcRYxVUuji4NVzZR5GyjwyStsjteCoW'

Built with git-ssb-web