tests/index.jsView |
---|
34 | 34 | |
35 | 35 | const hypervisor = new Hypervisor(tree) |
36 | 36 | hypervisor.registerContainer(testVMContainer) |
37 | 37 | |
38 | | - let rootCap = await hypervisor.createInstance(testVMContainer.typeId, new Message()) |
| 38 | + let rootCap = await hypervisor.createActor(testVMContainer.typeId, new Message()) |
39 | 39 | |
40 | 40 | message = new Message() |
41 | 41 | hypervisor.send(rootCap, message) |
42 | 42 | |
87 | 87 | const hypervisor = new Hypervisor(tree) |
88 | 88 | hypervisor.registerContainer(testVMContainerA) |
89 | 89 | hypervisor.registerContainer(testVMContainerB) |
90 | 90 | |
91 | | - let capB = await hypervisor.createInstance(testVMContainerB.typeId, new Message()) |
92 | | - await hypervisor.createInstance(testVMContainerA.typeId, new Message({ |
| 91 | + let capB = await hypervisor.createActor(testVMContainerB.typeId, new Message()) |
| 92 | + await hypervisor.createActor(testVMContainerA.typeId, new Message({ |
93 | 93 | caps: [capB] |
94 | 94 | })) |
95 | 95 | |
96 | 96 | const stateRoot = await hypervisor.createStateRoot(Infinity) |
129 | 129 | const hypervisor = new Hypervisor(tree) |
130 | 130 | hypervisor.registerContainer(testVMContainerA) |
131 | 131 | hypervisor.registerContainer(testVMContainerB) |
132 | 132 | |
133 | | - let capB = await hypervisor.createInstance(testVMContainerB.typeId, new Message()) |
134 | | - await hypervisor.createInstance(testVMContainerA.typeId, new Message({ |
| 133 | + let capB = await hypervisor.createActor(testVMContainerB.typeId, new Message()) |
| 134 | + await hypervisor.createActor(testVMContainerA.typeId, new Message({ |
135 | 135 | caps: [capB] |
136 | 136 | })) |
137 | 137 | |
138 | | - await hypervisor.createInstance(testVMContainerA.typeId, new Message({ |
| 138 | + await hypervisor.createActor(testVMContainerA.typeId, new Message({ |
139 | 139 | caps: [capB] |
140 | 140 | })) |
141 | 141 | |
142 | 142 | const stateRoot = await hypervisor.createStateRoot(Infinity) |
182 | 182 | const hypervisor = new Hypervisor(tree) |
183 | 183 | hypervisor.registerContainer(testVMContainerA) |
184 | 184 | hypervisor.registerContainer(testVMContainerB) |
185 | 185 | |
186 | | - let capB = await hypervisor.createInstance(testVMContainerB.typeId, new Message()) |
187 | | - hypervisor.createInstance(testVMContainerA.typeId, new Message({ |
| 186 | + let capB = await hypervisor.createActor(testVMContainerB.typeId, new Message()) |
| 187 | + hypervisor.createActor(testVMContainerA.typeId, new Message({ |
188 | 188 | caps: [capB] |
189 | 189 | })) |
190 | 190 | |
191 | | - await hypervisor.createInstance(testVMContainerA.typeId, new Message({ |
| 191 | + await hypervisor.createActor(testVMContainerA.typeId, new Message({ |
192 | 192 | caps: [capB] |
193 | 193 | })) |
194 | 194 | |
195 | 195 | const stateRoot = await hypervisor.createStateRoot(Infinity) |
233 | 233 | const hypervisor = new Hypervisor(tree) |
234 | 234 | hypervisor.registerContainer(testVMContainerA) |
235 | 235 | hypervisor.registerContainer(testVMContainerB) |
236 | 236 | |
237 | | - let capB = await hypervisor.createInstance(testVMContainerB.typeId, new Message()) |
238 | | - await hypervisor.createInstance(testVMContainerA.typeId, new Message({ |
| 237 | + let capB = await hypervisor.createActor(testVMContainerB.typeId, new Message()) |
| 238 | + await hypervisor.createActor(testVMContainerA.typeId, new Message({ |
239 | 239 | caps: [capB] |
240 | 240 | })) |
241 | 241 | |
242 | 242 | const stateRoot = await hypervisor.createStateRoot(Infinity) |
281 | 281 | const hypervisor = new Hypervisor(tree) |
282 | 282 | hypervisor.registerContainer(testVMContainerA) |
283 | 283 | hypervisor.registerContainer(testVMContainerB) |
284 | 284 | |
285 | | - let capB = await hypervisor.createInstance(testVMContainerB.typeId, new Message()) |
286 | | - await hypervisor.createInstance(testVMContainerA.typeId, new Message({ |
| 285 | + let capB = await hypervisor.createActor(testVMContainerB.typeId, new Message()) |
| 286 | + await hypervisor.createActor(testVMContainerA.typeId, new Message({ |
287 | 287 | caps: [capB] |
288 | 288 | })) |
289 | 289 | |
290 | 290 | const stateRoot = await hypervisor.createStateRoot(Infinity) |
307 | 307 | onCreation (m) { |
308 | 308 | message = new Message() |
309 | 309 | const cap = this.kernel.mintCap() |
310 | 310 | message.caps.push(cap) |
311 | | - return this.kernel.createInstance(testVMContainerB.typeId, message) |
| 311 | + return this.kernel.createActor(testVMContainerB.typeId, message) |
312 | 312 | } |
313 | 313 | |
314 | 314 | onMessage (m) { |
315 | 315 | t.true(m, 'should recive a response message') |
330 | 330 | const hypervisor = new Hypervisor(tree) |
331 | 331 | hypervisor.registerContainer(testVMContainerA) |
332 | 332 | hypervisor.registerContainer(testVMContainerB) |
333 | 333 | |
334 | | - await hypervisor.createInstance(testVMContainerA.typeId, new Message()) |
| 334 | + await hypervisor.createActor(testVMContainerA.typeId, new Message()) |
335 | 335 | |
336 | 336 | const stateRoot = await hypervisor.createStateRoot(Infinity) |
337 | 337 | |
338 | 338 | t.deepEquals(stateRoot, expectedState, 'expected root!') |
389 | 389 | const hypervisor = new Hypervisor(tree) |
390 | 390 | hypervisor.registerContainer(testVMContainerA) |
391 | 391 | hypervisor.registerContainer(testVMContainerB) |
392 | 392 | |
393 | | - let capB = await hypervisor.createInstance(testVMContainerB.typeId, new Message()) |
394 | | - await hypervisor.createInstance(testVMContainerA.typeId, new Message({ |
| 393 | + let capB = await hypervisor.createActor(testVMContainerB.typeId, new Message()) |
| 394 | + await hypervisor.createActor(testVMContainerA.typeId, new Message({ |
395 | 395 | caps: [capB] |
396 | 396 | })) |
397 | 397 | |
398 | 398 | const stateRoot = await hypervisor.createStateRoot(Infinity) |
446 | 446 | const hypervisor = new Hypervisor(tree) |
447 | 447 | hypervisor.registerContainer(testVMContainerA) |
448 | 448 | hypervisor.registerContainer(testVMContainerB) |
449 | 449 | |
450 | | - let capB = await hypervisor.createInstance(testVMContainerB.typeId, new Message()) |
| 450 | + let capB = await hypervisor.createActor(testVMContainerB.typeId, new Message()) |
451 | 451 | hypervisor.send(capB, new Message({ |
452 | 452 | data: 'first' |
453 | 453 | })) |
454 | | - await hypervisor.createInstance(testVMContainerA.typeId, new Message({ |
| 454 | + await hypervisor.createActor(testVMContainerA.typeId, new Message({ |
455 | 455 | caps: [capB], |
456 | 456 | data: 'second' |
457 | 457 | })) |
458 | 458 | |
459 | | - await hypervisor.createInstance(testVMContainerA.typeId, new Message({ |
| 459 | + await hypervisor.createActor(testVMContainerA.typeId, new Message({ |
460 | 460 | caps: [capB], |
461 | 461 | data: 'third' |
462 | 462 | })) |
463 | 463 | |
501 | 501 | const hypervisor = new Hypervisor(tree) |
502 | 502 | hypervisor.registerContainer(testVMContainerA) |
503 | 503 | hypervisor.registerContainer(testVMContainerB) |
504 | 504 | |
505 | | - let capA = await hypervisor.createInstance(testVMContainerA.typeId, new Message()) |
506 | | - let capB = await hypervisor.createInstance(testVMContainerB.typeId, new Message()) |
| 505 | + let capA = await hypervisor.createActor(testVMContainerA.typeId, new Message()) |
| 506 | + let capB = await hypervisor.createActor(testVMContainerB.typeId, new Message()) |
507 | 507 | |
508 | 508 | await hypervisor.send(capA, new Message({caps: [capB]})) |
509 | 509 | |
510 | 510 | const stateRoot = await hypervisor.createStateRoot(Infinity) |
552 | 552 | const hypervisor = new Hypervisor(tree) |
553 | 553 | hypervisor.registerContainer(testVMContainerA) |
554 | 554 | hypervisor.registerContainer(testVMContainerB) |
555 | 555 | |
556 | | - let capA = await hypervisor.createInstance(testVMContainerA.typeId, new Message()) |
557 | | - let capB = await hypervisor.createInstance(testVMContainerB.typeId, new Message()) |
| 556 | + let capA = await hypervisor.createActor(testVMContainerA.typeId, new Message()) |
| 557 | + let capB = await hypervisor.createActor(testVMContainerB.typeId, new Message()) |
558 | 558 | |
559 | 559 | await hypervisor.send(capA, new Message({caps: [capB]})) |
560 | 560 | |
561 | 561 | const stateRoot = await hypervisor.createStateRoot(Infinity) |
617 | 617 | const hypervisor = new Hypervisor(tree) |
618 | 618 | hypervisor.registerContainer(testVMContainerA) |
619 | 619 | hypervisor.registerContainer(testVMContainerB) |
620 | 620 | |
621 | | - let capA = await hypervisor.createInstance(testVMContainerA.typeId, new Message()) |
622 | | - let capB1 = await hypervisor.createInstance(testVMContainerB.typeId, new Message()) |
623 | | - let capB2 = await hypervisor.createInstance(testVMContainerB.typeId, new Message()) |
| 621 | + let capA = await hypervisor.createActor(testVMContainerA.typeId, new Message()) |
| 622 | + let capB1 = await hypervisor.createActor(testVMContainerB.typeId, new Message()) |
| 623 | + let capB2 = await hypervisor.createActor(testVMContainerB.typeId, new Message()) |
624 | 624 | |
625 | 625 | await hypervisor.send(capA, new Message({caps: [capB1, capB2]})) |
626 | 626 | |
627 | 627 | const stateRoot = await hypervisor.createStateRoot(Infinity) |
681 | 681 | const hypervisor = new Hypervisor(tree) |
682 | 682 | hypervisor.registerContainer(testVMContainerA) |
683 | 683 | hypervisor.registerContainer(testVMContainerB) |
684 | 684 | |
685 | | - let capA = await hypervisor.createInstance(testVMContainerA.typeId, new Message()) |
686 | | - let capB1 = await hypervisor.createInstance(testVMContainerB.typeId, new Message()) |
687 | | - let capB2 = await hypervisor.createInstance(testVMContainerB.typeId, new Message()) |
| 685 | + let capA = await hypervisor.createActor(testVMContainerA.typeId, new Message()) |
| 686 | + let capB1 = await hypervisor.createActor(testVMContainerB.typeId, new Message()) |
| 687 | + let capB2 = await hypervisor.createActor(testVMContainerB.typeId, new Message()) |
688 | 688 | |
689 | 689 | await hypervisor.send(capA, new Message({caps: [capB1, capB2]})) |
690 | 690 | |
691 | 691 | const stateRoot = await hypervisor.createStateRoot(Infinity) |
745 | 745 | const hypervisor = new Hypervisor(tree) |
746 | 746 | hypervisor.registerContainer(testVMContainerA) |
747 | 747 | hypervisor.registerContainer(testVMContainerB) |
748 | 748 | |
749 | | - let capA = await hypervisor.createInstance(testVMContainerA.typeId, new Message()) |
750 | | - let capB1 = await hypervisor.createInstance(testVMContainerB.typeId, new Message()) |
751 | | - let capB2 = await hypervisor.createInstance(testVMContainerB.typeId, new Message()) |
| 749 | + let capA = await hypervisor.createActor(testVMContainerA.typeId, new Message()) |
| 750 | + let capB1 = await hypervisor.createActor(testVMContainerB.typeId, new Message()) |
| 751 | + let capB2 = await hypervisor.createActor(testVMContainerB.typeId, new Message()) |
752 | 752 | |
753 | 753 | await hypervisor.send(capA, new Message({caps: [capB1, capB2]})) |
754 | 754 | |
755 | 755 | const stateRoot = await hypervisor.createStateRoot(Infinity) |
805 | 805 | hypervisor.registerContainer(testVMContainerA) |
806 | 806 | hypervisor.registerContainer(testVMContainerB) |
807 | 807 | hypervisor.registerContainer(testVMContainerC) |
808 | 808 | |
809 | | - let capA = await hypervisor.createInstance(testVMContainerA.typeId, new Message()) |
810 | | - let capB = await hypervisor.createInstance(testVMContainerB.typeId, new Message()) |
811 | | - let capC = await hypervisor.createInstance(testVMContainerC.typeId, new Message()) |
| 809 | + let capA = await hypervisor.createActor(testVMContainerA.typeId, new Message()) |
| 810 | + let capB = await hypervisor.createActor(testVMContainerB.typeId, new Message()) |
| 811 | + let capC = await hypervisor.createActor(testVMContainerC.typeId, new Message()) |
812 | 812 | |
813 | 813 | await Promise.all([ |
814 | 814 | hypervisor.send(capA, new Message()), |
815 | 815 | hypervisor.send(capB, new Message()), |