tests/index.jsView |
---|
47 | 47 | |
48 | 48 | const hypervisor = new Hypervisor(tree) |
49 | 49 | hypervisor.registerContainer(testVMContainer) |
50 | 50 | |
51 | | - const {exports} = await hypervisor.createActor(testVMContainer.typeId) |
| 51 | + const {module} = await hypervisor.createActor(testVMContainer.typeId) |
52 | 52 | |
53 | 53 | const message = new Message({ |
54 | | - funcRef: exports.main, |
| 54 | + funcRef: module.main, |
55 | 55 | funcArguments: [1] |
56 | 56 | }) |
57 | 57 | hypervisor.send(message) |
58 | 58 | |
93 | 93 | const hypervisor = new Hypervisor(tree) |
94 | 94 | hypervisor.registerContainer(testVMContainerA) |
95 | 95 | hypervisor.registerContainer(testVMContainerB) |
96 | 96 | |
97 | | - const {exports: exportsB} = await hypervisor.createActor(testVMContainerB.typeId) |
98 | | - const {exports: exportsA} = await hypervisor.createActor(testVMContainerA.typeId) |
| 97 | + const {module: moduleB} = await hypervisor.createActor(testVMContainerB.typeId) |
| 98 | + const {module: moduleA} = await hypervisor.createActor(testVMContainerA.typeId) |
99 | 99 | |
100 | 100 | const message = new Message({ |
101 | | - funcRef: exportsA.main, |
102 | | - funcArguments: [exportsB.main] |
| 101 | + funcRef: moduleA.main, |
| 102 | + funcArguments: [moduleB.main] |
103 | 103 | }) |
104 | 104 | |
105 | 105 | hypervisor.send(message) |
106 | 106 | |
141 | 141 | const hypervisor = new Hypervisor(tree) |
142 | 142 | hypervisor.registerContainer(testVMContainerA) |
143 | 143 | hypervisor.registerContainer(testVMContainerB) |
144 | 144 | |
145 | | - let {exports: exportsB} = await hypervisor.createActor(testVMContainerB.typeId) |
146 | | - let {exports: exportsA0} = await hypervisor.createActor(testVMContainerA.typeId) |
147 | | - let {exports: exportsA1} = await hypervisor.createActor(testVMContainerA.typeId) |
| 145 | + let {module: moduleB} = await hypervisor.createActor(testVMContainerB.typeId) |
| 146 | + let {module: moduleA0} = await hypervisor.createActor(testVMContainerA.typeId) |
| 147 | + let {module: moduleA1} = await hypervisor.createActor(testVMContainerA.typeId) |
148 | 148 | |
149 | 149 | const message0 = new Message({ |
150 | | - funcRef: exportsA0.main, |
151 | | - funcArguments: [exportsB.main] |
| 150 | + funcRef: moduleA0.main, |
| 151 | + funcArguments: [moduleB.main] |
152 | 152 | }) |
153 | 153 | |
154 | 154 | const message1 = new Message({ |
155 | | - funcRef: exportsA1.main, |
156 | | - funcArguments: [exportsB.main] |
| 155 | + funcRef: moduleA1.main, |
| 156 | + funcArguments: [moduleB.main] |
157 | 157 | }) |
158 | 158 | |
159 | 159 | await hypervisor.send(message0) |
160 | 160 | await hypervisor.send(message1) |
202 | 202 | let actorA0 = await hypervisor.createActor(testVMContainerA.typeId) |
203 | 203 | let actorA1 = await hypervisor.createActor(testVMContainerA.typeId) |
204 | 204 | |
205 | 205 | const message0 = new Message({ |
206 | | - funcRef: actorA0.exports.main, |
207 | | - funcArguments: [actorB.exports.main] |
| 206 | + funcRef: actorA0.module.main, |
| 207 | + funcArguments: [actorB.module.main] |
208 | 208 | }) |
209 | 209 | const message1 = new Message({ |
210 | | - funcRef: actorA1.exports.main, |
211 | | - funcArguments: [actorB.exports.main] |
| 210 | + funcRef: actorA1.module.main, |
| 211 | + funcArguments: [actorB.module.main] |
212 | 212 | }) |
213 | 213 | |
214 | 214 | hypervisor.send(message0) |
215 | 215 | hypervisor.send(message1) |
254 | 254 | const hypervisor = new Hypervisor(tree) |
255 | 255 | hypervisor.registerContainer(testVMContainerA) |
256 | 256 | hypervisor.registerContainer(testVMContainerB) |
257 | 257 | |
258 | | - let {exports: exportsB} = await hypervisor.createActor(testVMContainerB.typeId) |
259 | | - let {exports: exportsA} = await hypervisor.createActor(testVMContainerA.typeId) |
| 258 | + let {module: moduleB} = await hypervisor.createActor(testVMContainerB.typeId) |
| 259 | + let {module: moduleA} = await hypervisor.createActor(testVMContainerA.typeId) |
260 | 260 | const message = new Message({ |
261 | | - funcRef: exportsA.main, |
262 | | - funcArguments: [exportsB.main] |
| 261 | + funcRef: moduleA.main, |
| 262 | + funcArguments: [moduleB.main] |
263 | 263 | }) |
264 | 264 | hypervisor.send(message) |
265 | 265 | const stateRoot = await hypervisor.createStateRoot() |
266 | 266 | t.deepEquals(stateRoot, expectedState, 'expected root!') |
277 | 277 | }) |
278 | 278 | |
279 | 279 | class testVMContainerA extends BaseContainer { |
280 | 280 | async start (funcRef) { |
281 | | - const {exports} = await this.actor.createActor(testVMContainerB.typeId) |
| 281 | + const {module} = await this.actor.createActor(testVMContainerB.typeId) |
282 | 282 | const message = new Message({ |
283 | | - funcRef: exports.main, |
| 283 | + funcRef: module.main, |
284 | 284 | funcArguments: [this.actor.getFuncRef('main')] |
285 | 285 | }) |
286 | 286 | this.actor.send(message) |
287 | 287 | } |
303 | 303 | const hypervisor = new Hypervisor(tree) |
304 | 304 | hypervisor.registerContainer(testVMContainerA) |
305 | 305 | hypervisor.registerContainer(testVMContainerB) |
306 | 306 | |
307 | | - const {exports} = await hypervisor.createActor(testVMContainerA.typeId) |
308 | | - await hypervisor.send(new Message({funcRef: exports.start})) |
| 307 | + const {module} = await hypervisor.createActor(testVMContainerA.typeId) |
| 308 | + await hypervisor.send(new Message({funcRef: module.start})) |
309 | 309 | |
310 | 310 | const stateRoot = await hypervisor.createStateRoot() |
311 | 311 | t.deepEquals(stateRoot, expectedState, 'expected root!') |
312 | 312 | }) |
366 | 366 | const hypervisor = new Hypervisor(tree) |
367 | 367 | hypervisor.registerContainer(testVMContainerA) |
368 | 368 | hypervisor.registerContainer(testVMContainerB) |
369 | 369 | |
370 | | - const {exports: exportsB} = await hypervisor.createActor(testVMContainerB.typeId) |
371 | | - const {exports: exportsA} = await hypervisor.createActor(testVMContainerA.typeId) |
| 370 | + const {module: moduleB} = await hypervisor.createActor(testVMContainerB.typeId) |
| 371 | + const {module: moduleA} = await hypervisor.createActor(testVMContainerA.typeId) |
372 | 372 | const message = new Message({ |
373 | | - funcRef: exportsA.main, |
374 | | - funcArguments: [exportsB.main] |
| 373 | + funcRef: moduleA.main, |
| 374 | + funcArguments: [moduleB.main] |
375 | 375 | }) |
376 | 376 | hypervisor.send(message) |
377 | 377 | |
378 | 378 | const stateRoot = await hypervisor.createStateRoot() |
423 | 423 | const hypervisor = new Hypervisor(tree) |
424 | 424 | hypervisor.registerContainer(testVMContainerA) |
425 | 425 | hypervisor.registerContainer(testVMContainerB) |
426 | 426 | |
427 | | - let {exports: exportsB} = await hypervisor.createActor(testVMContainerB.typeId) |
| 427 | + let {module: moduleB} = await hypervisor.createActor(testVMContainerB.typeId) |
428 | 428 | hypervisor.send(new Message({ |
429 | | - funcRef: exportsB.main, |
| 429 | + funcRef: moduleB.main, |
430 | 430 | funcArguments: ['first'] |
431 | 431 | })) |
432 | 432 | |
433 | | - const {exports: exportsA0} = await hypervisor.createActor(testVMContainerA.typeId) |
| 433 | + const {module: moduleA0} = await hypervisor.createActor(testVMContainerA.typeId) |
434 | 434 | |
435 | 435 | hypervisor.send(new Message({ |
436 | | - funcRef: exportsA0.main, |
437 | | - funcArguments: [exportsB.main, 'second'] |
| 436 | + funcRef: moduleA0.main, |
| 437 | + funcArguments: [moduleB.main, 'second'] |
438 | 438 | })) |
439 | 439 | |
440 | | - const {exports: exportsA1} = await hypervisor.createActor(testVMContainerA.typeId) |
| 440 | + const {module: moduleA1} = await hypervisor.createActor(testVMContainerA.typeId) |
441 | 441 | hypervisor.send(new Message({ |
442 | | - funcRef: exportsA1.main, |
443 | | - funcArguments: [exportsB.main, 'third'] |
| 442 | + funcRef: moduleA1.main, |
| 443 | + funcArguments: [moduleB.main, 'third'] |
444 | 444 | })) |
445 | 445 | |
446 | 446 | const stateRoot = await hypervisor.createStateRoot() |
447 | 447 | t.deepEquals(stateRoot, expectedState, 'expected root!') |
493 | 493 | const hypervisor = new Hypervisor(tree) |
494 | 494 | hypervisor.registerContainer(testVMContainerA) |
495 | 495 | hypervisor.registerContainer(testVMContainerB) |
496 | 496 | |
497 | | - const {exports: exportsB} = await hypervisor.createActor(testVMContainerB.typeId) |
498 | | - const {exports: exportsA} = await hypervisor.createActor(testVMContainerA.typeId) |
| 497 | + const {module: moduleB} = await hypervisor.createActor(testVMContainerB.typeId) |
| 498 | + const {module: moduleA} = await hypervisor.createActor(testVMContainerA.typeId) |
499 | 499 | |
500 | 500 | const message = new Message({ |
501 | | - funcRef: exportsA.main, |
502 | | - funcArguments: [exportsB.main] |
| 501 | + funcRef: moduleA.main, |
| 502 | + funcArguments: [moduleB.main] |
503 | 503 | }) |
504 | 504 | |
505 | 505 | hypervisor.send(message) |
506 | 506 | |
543 | 543 | |
544 | 544 | const refernces = [] |
545 | 545 | let _numOfActors = numOfActors |
546 | 546 | while (_numOfActors--) { |
547 | | - const {exports} = await hypervisor.createActor(BenchmarkContainer.typeId) |
548 | | - refernces.push(exports.main) |
| 547 | + const {module} = await hypervisor.createActor(BenchmarkContainer.typeId) |
| 548 | + refernces.push(module.main) |
549 | 549 | } |
550 | 550 | _numOfActors = numOfActors |
551 | 551 | let msgs = [] |
552 | 552 | while (_numOfActors--) { |