git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit aeb0bcd3609c8af0b967edfd16aee39e7566aa0d

rename type -> typeId

wanderer committed on 8/2/2017, 7:20:38 PM
Parent: 98afd2ab38292eecc1f7dcb1974fc926ceb7c467

Files changed

index.jschanged
tests/index.jschanged
index.jsView
@@ -15,9 +15,9 @@
1515 constructor (dag, state = {}) {
1616 this.graph = new Graph(dag)
1717 this.scheduler = new Scheduler()
1818 this.state = state
19- this._containerTypes = []
19 + this._containerTypes = {}
2020 this._nodesToCheck = new Set()
2121
2222 this.ROOT_ID = 'zdpuAm6aTdLVMUuiZypxkwtA7sKm7BWERy8MPbaCrFsmiyzxr'
2323 this.MAX_DATA_BYTES = 65533
@@ -172,9 +172,9 @@
172172 * @param {Class} Constructor - a Class for instantiating the container
173173 * @param {*} args - any args that the contructor takes
174174 */
175175 registerContainer (Constructor, args) {
176- this._containerTypes[Constructor.type] = {
176 + this._containerTypes[Constructor.typeId] = {
177177 Constructor: Constructor,
178178 args: args
179179 }
180180 }
tests/index.jsView
@@ -16,9 +16,9 @@
1616 if (port) {
1717 this.kernel.ports.bind('root', port)
1818 }
1919 }
20- static get type () {
20 + static get typeId () {
2121 return 9
2222 }
2323 }
2424
@@ -38,17 +38,17 @@
3838
3939 const hypervisor = new Hypervisor(node.dag)
4040 hypervisor.registerContainer(testVMContainer)
4141
42- const rootContainer = await hypervisor.createInstance(testVMContainer.type)
42 + const rootContainer = await hypervisor.createInstance(testVMContainer.typeId)
4343
4444 const [portRef1, portRef2] = rootContainer.ports.createChannel()
4545 const initMessage = rootContainer.createMessage({
4646 data: Buffer.from('test code'),
4747 ports: [portRef2]
4848 })
4949
50- rootContainer.createInstance(testVMContainer.type, initMessage)
50 + rootContainer.createInstance(testVMContainer.typeId, initMessage)
5151
5252 rootContainer.ports.bind('first', portRef1)
5353 message = rootContainer.createMessage()
5454 rootContainer.send(portRef1, message)
@@ -70,13 +70,13 @@
7070
7171 const hypervisor = new Hypervisor(node.dag)
7272 hypervisor.registerContainer(testVMContainer)
7373
74- const root = await hypervisor.createInstance(testVMContainer.type)
74 + const root = await hypervisor.createInstance(testVMContainer.typeId)
7575 const [portRef1, portRef2] = root.ports.createChannel()
7676
7777 root.ports.bind('one', portRef1)
78- root.createInstance(testVMContainer.type, root.createMessage({
78 + root.createInstance(testVMContainer.typeId, root.createMessage({
7979 ports: [portRef2]
8080 }))
8181
8282 const stateRoot = await hypervisor.createStateRoot(Infinity)
@@ -93,17 +93,17 @@
9393 class testVMContainer2 extends BaseContainer {
9494 onMessage (m) {
9595 t.true(m === message, 'should recive a message')
9696 }
97- static get type () {
97 + static get typeId () {
9898 return 99
9999 }
100100 }
101101
102102 class testVMContainer extends BaseContainer {
103103 onMessage (m) {
104104 const [portRef1, portRef2] = this.kernel.ports.createChannel()
105- this.kernel.createInstance(testVMContainer2.type, this.kernel.createMessage({
105 + this.kernel.createInstance(testVMContainer2.typeId, this.kernel.createMessage({
106106 ports: [portRef2]
107107 }))
108108 this.kernel.ports.bind('child', portRef1)
109109 this.kernel.incrementTicks(2)
@@ -114,11 +114,11 @@
114114 const hypervisor = new Hypervisor(node.dag)
115115 hypervisor.registerContainer(testVMContainer)
116116 hypervisor.registerContainer(testVMContainer2)
117117
118- const root = await hypervisor.createInstance(testVMContainer.type)
118 + const root = await hypervisor.createInstance(testVMContainer.typeId)
119119 const [portRef1, portRef2] = root.ports.createChannel()
120- root.createInstance(testVMContainer.type, root.createMessage({
120 + root.createInstance(testVMContainer.typeId, root.createMessage({
121121 ports: [portRef2]
122122 }))
123123
124124 root.ports.bind('first', portRef1)
@@ -150,17 +150,17 @@
150150 }, 200)
151151 })
152152 }
153153
154- static get type () {
154 + static get typeId () {
155155 return 99
156156 }
157157 }
158158
159159 class testVMContainer extends BaseContainer {
160160 onMessage (m) {
161161 const [portRef1, portRef2] = this.kernel.ports.createChannel()
162- this.kernel.createInstance(testVMContainer2.type, this.kernel.createMessage({
162 + this.kernel.createInstance(testVMContainer2.typeId, this.kernel.createMessage({
163163 ports: [portRef2]
164164 }))
165165 this.kernel.ports.bind('child', portRef1)
166166 this.kernel.send(portRef1, m)
@@ -171,12 +171,12 @@
171171 const hypervisor = new Hypervisor(node.dag)
172172 hypervisor.registerContainer(testVMContainer)
173173 hypervisor.registerContainer(testVMContainer2)
174174
175- let root = await hypervisor.createInstance(testVMContainer.type)
175 + let root = await hypervisor.createInstance(testVMContainer.typeId)
176176 const rootId = root.id
177177 const [portRef1, portRef2] = root.ports.createChannel()
178- root.createInstance(testVMContainer.type, root.createMessage({
178 + root.createInstance(testVMContainer.typeId, root.createMessage({
179179 ports: [portRef2]
180180 }))
181181
182182 root.ports.bind('first', portRef1)
@@ -223,20 +223,20 @@
223223 const message3 = this.kernel.createMessage({
224224 ports: [portRef6]
225225 })
226226
227- this.kernel.createInstance(Root.type, message1)
228- this.kernel.createInstance(Root.type, message2)
229- this.kernel.createInstance(Root.type, message3)
227 + this.kernel.createInstance(Root.typeId, message1)
228 + this.kernel.createInstance(Root.typeId, message2)
229 + this.kernel.createInstance(Root.typeId, message3)
230230
231231 throw new Error('it is a trap!!!')
232232 }
233233 }
234234
235235 const hypervisor = new Hypervisor(node.dag)
236236
237237 hypervisor.registerContainer(Root)
238- const root = await hypervisor.createInstance(Root.type)
238 + const root = await hypervisor.createInstance(Root.typeId)
239239 await root.message(root.createMessage())
240240 const stateRoot = await hypervisor.createStateRoot()
241241
242242 t.deepEquals(stateRoot, {
@@ -265,10 +265,10 @@
265265 const message2 = this.kernel.createMessage({
266266 ports: [portRef4]
267267 })
268268
269- this.kernel.createInstance(First.type, message1)
270- this.kernel.createInstance(Second.type, message2)
269 + this.kernel.createInstance(First.typeId, message1)
270 + this.kernel.createInstance(Second.typeId, message2)
271271
272272 this.kernel.send(portRef1, this.kernel.createMessage())
273273 this.kernel.send(portRef3, this.kernel.createMessage())
274274 } else if (runs === 1) {
@@ -287,9 +287,9 @@
287287 data: 'first'
288288 }))
289289 }
290290
291- static get type () {
291 + static get typeId () {
292292 return 99
293293 }
294294 }
295295
@@ -300,9 +300,9 @@
300300 data: 'second'
301301 }))
302302 }
303303
304- static get type () {
304 + static get typeId () {
305305 return 299
306306 }
307307 }
308308
@@ -311,12 +311,12 @@
311311 hypervisor.registerContainer(Root)
312312 hypervisor.registerContainer(First)
313313 hypervisor.registerContainer(Second)
314314
315- const root = await hypervisor.createInstance(Root.type)
315 + const root = await hypervisor.createInstance(Root.typeId)
316316
317317 const [portRef1, portRef2] = root.ports.createChannel()
318- root.createInstance(Root.type, root.createMessage({
318 + root.createInstance(Root.typeId, root.createMessage({
319319 ports: [portRef2]
320320 }))
321321
322322 root.ports.bind('first', portRef1)
@@ -345,10 +345,10 @@
345345 const message2 = this.kernel.createMessage({
346346 ports: [portRef4]
347347 })
348348
349- this.kernel.createInstance(First.type, message1)
350- this.kernel.createInstance(Second.type, message2)
349 + this.kernel.createInstance(First.typeId, message1)
350 + this.kernel.createInstance(Second.typeId, message2)
351351
352352 this.kernel.send(portRef1, this.kernel.createMessage())
353353 this.kernel.send(portRef3, this.kernel.createMessage())
354354 } else if (runs === 1) {
@@ -358,9 +358,9 @@
358358 t.equals(m.data, 'first', 'should recive the first message')
359359 }
360360 }
361361
362- static get type () {
362 + static get typeId () {
363363 return 99
364364 }
365365 }
366366
@@ -371,9 +371,9 @@
371371 data: 'first'
372372 }))
373373 }
374374
375- static get type () {
375 + static get typeId () {
376376 return 299
377377 }
378378 }
379379
@@ -391,12 +391,12 @@
391391 hypervisor.registerContainer(Root)
392392 hypervisor.registerContainer(First)
393393 hypervisor.registerContainer(Second)
394394
395- const root = await hypervisor.createInstance(Root.type)
395 + const root = await hypervisor.createInstance(Root.typeId)
396396
397397 const [portRef1, portRef2] = root.ports.createChannel()
398- root.createInstance(Root.type, root.createMessage({
398 + root.createInstance(Root.typeId, root.createMessage({
399399 ports: [portRef2]
400400 }))
401401
402402 root.ports.bind('first', portRef1)
@@ -424,10 +424,10 @@
424424 const message2 = this.kernel.createMessage({
425425 ports: [portRef4]
426426 })
427427
428- this.kernel.createInstance(First.type, message1)
429- this.kernel.createInstance(Second.type, message2)
428 + this.kernel.createInstance(First.typeId, message1)
429 + this.kernel.createInstance(Second.typeId, message2)
430430
431431 this.kernel.send(portRef1, this.kernel.createMessage())
432432 this.kernel.send(portRef3, this.kernel.createMessage())
433433
@@ -438,9 +438,9 @@
438438 } else if (runs === 2) {
439439 t.equals(m.data, 'second', 'should recived the second message')
440440 }
441441 }
442- static get type () {
442 + static get typeId () {
443443 return 299
444444 }
445445 }
446446
@@ -450,9 +450,9 @@
450450 this.kernel.send(m.fromPort, this.kernel.createMessage({
451451 data: 'first'
452452 }))
453453 }
454- static get type () {
454 + static get typeId () {
455455 return 2
456456 }
457457 }
458458
@@ -470,11 +470,11 @@
470470 hypervisor.registerContainer(Root)
471471 hypervisor.registerContainer(First)
472472 hypervisor.registerContainer(Second)
473473
474- const root = await hypervisor.createInstance(Root.type)
474 + const root = await hypervisor.createInstance(Root.typeId)
475475 const [portRef1, portRef2] = root.ports.createChannel()
476- root.createInstance(Root.type, root.createMessage({
476 + root.createInstance(Root.typeId, root.createMessage({
477477 ports: [portRef2]
478478 }))
479479
480480 root.ports.bind('first', portRef1)
@@ -502,10 +502,10 @@
502502 const message2 = this.kernel.createMessage({
503503 ports: [portRef4]
504504 })
505505
506- this.kernel.createInstance(First.type, message1)
507- this.kernel.createInstance(Second.type, message2)
506 + this.kernel.createInstance(First.typeId, message1)
507 + this.kernel.createInstance(Second.typeId, message2)
508508
509509 this.kernel.send(portRef1, this.kernel.createMessage())
510510 this.kernel.send(portRef3, this.kernel.createMessage())
511511
@@ -517,9 +517,9 @@
517517 runs++
518518 t.equals(m.data, 'second', 'should recived the second message')
519519 }
520520 }
521- static get type () {
521 + static get typeId () {
522522 return 299
523523 }
524524 }
525525
@@ -529,9 +529,9 @@
529529 this.kernel.send(m.fromPort, this.kernel.createMessage({
530530 data: 'first'
531531 }))
532532 }
533- static get type () {
533 + static get typeId () {
534534 return 29
535535 }
536536 }
537537
@@ -541,9 +541,9 @@
541541 this.kernel.send(m.fromPort, this.kernel.createMessage({
542542 data: 'second'
543543 }))
544544 }
545- static get type () {
545 + static get typeId () {
546546 return 2
547547 }
548548 }
549549
@@ -563,21 +563,21 @@
563563 hypervisor.registerContainer(First)
564564 hypervisor.registerContainer(Second)
565565 hypervisor.registerContainer(Waiter)
566566
567- const root = await hypervisor.createInstance(Root.type)
567 + const root = await hypervisor.createInstance(Root.typeId)
568568 const [portRef1, portRef2] = root.ports.createChannel()
569569
570570 const message = root.createMessage()
571571 root.send(portRef1, message)
572572 root.ports.bind('first', portRef1)
573- root.createInstance(Root.type, root.createMessage({
573 + root.createInstance(Root.typeId, root.createMessage({
574574 ports: [portRef2]
575575 }))
576576
577577 const [portRef3, portRef4] = root.ports.createChannel()
578578 root.ports.bind('sencond', portRef3)
579- root.createInstance(Waiter.type, root.createMessage({
579 + root.createInstance(Waiter.typeId, root.createMessage({
580580 ports: [portRef4]
581581 }))
582582
583583 root.incrementTicks(100)
@@ -606,10 +606,10 @@
606606 const message2 = this.kernel.createMessage({
607607 ports: [portRef4]
608608 })
609609
610- this.kernel.createInstance(First.type, message1)
611- this.kernel.createInstance(Second.type, message2)
610 + this.kernel.createInstance(First.typeId, message1)
611 + this.kernel.createInstance(Second.typeId, message2)
612612
613613 this.kernel.send(portRef1, this.kernel.createMessage())
614614 this.kernel.send(portRef3, this.kernel.createMessage())
615615
@@ -620,9 +620,9 @@
620620 } else if (runs === 2) {
621621 t.equals(m.data, 'first', 'should recive the first message')
622622 }
623623 }
624- static get type () {
624 + static get typeId () {
625625 return 299
626626 }
627627 }
628628
@@ -632,9 +632,9 @@
632632 this.kernel.send(m.fromPort, this.kernel.createMessage({
633633 data: 'first'
634634 }))
635635 }
636- static get type () {
636 + static get typeId () {
637637 return 29
638638 }
639639 }
640640
@@ -644,9 +644,9 @@
644644 this.kernel.send(m.fromPort, this.kernel.createMessage({
645645 data: 'second'
646646 }))
647647 }
648- static get type () {
648 + static get typeId () {
649649 return 2
650650 }
651651 }
652652
@@ -655,15 +655,15 @@
655655 hypervisor.registerContainer(Root)
656656 hypervisor.registerContainer(First)
657657 hypervisor.registerContainer(Second)
658658
659- const root = await hypervisor.createInstance(Root.type)
659 + const root = await hypervisor.createInstance(Root.typeId)
660660 const [portRef1, portRef2] = root.ports.createChannel()
661661 const message = root.createMessage()
662662
663663 root.send(portRef1, message)
664664 root.ports.bind('first', portRef1)
665- root.createInstance(Root.type, root.createMessage({
665 + root.createInstance(Root.typeId, root.createMessage({
666666 ports: [portRef2]
667667 }))
668668 })
669669
@@ -688,10 +688,10 @@
688688 const message2 = this.kernel.createMessage({
689689 ports: [portRef4]
690690 })
691691
692- this.kernel.createInstance(First.type, message1)
693- this.kernel.createInstance(Second.type, message2)
692 + this.kernel.createInstance(First.typeId, message1)
693 + this.kernel.createInstance(Second.typeId, message2)
694694
695695 this.kernel.send(portRef1, this.kernel.createMessage())
696696 this.kernel.send(portRef3, this.kernel.createMessage())
697697
@@ -702,9 +702,9 @@
702702 } else if (runs === 2) {
703703 t.equals(m.data, 'second', 'should recived the second message')
704704 }
705705 }
706- static get type () {
706 + static get typeId () {
707707 return 299
708708 }
709709 }
710710
@@ -714,9 +714,9 @@
714714 this.kernel.send(m.fromPort, this.kernel.createMessage({
715715 data: 'first'
716716 }))
717717 }
718- static get type () {
718 + static get typeId () {
719719 return 29
720720 }
721721 }
722722
@@ -734,15 +734,15 @@
734734 hypervisor.registerContainer(Root)
735735 hypervisor.registerContainer(First)
736736 hypervisor.registerContainer(Second)
737737
738- const root = await hypervisor.createInstance(Root.type)
738 + const root = await hypervisor.createInstance(Root.typeId)
739739 const [portRef1, portRef2] = root.ports.createChannel()
740740 const message = root.createMessage()
741741
742742 root.send(portRef1, message)
743743 root.ports.bind('first', portRef1)
744- root.createInstance(Root.type, root.createMessage({
744 + root.createInstance(Root.typeId, root.createMessage({
745745 ports: [portRef2]
746746 }))
747747 })
748748
@@ -760,15 +760,15 @@
760760 this.kernel.ports.bind('one', portRef1)
761761 const message1 = this.kernel.createMessage({
762762 ports: [portRef2]
763763 })
764- this.kernel.createInstance(First.type, message1)
764 + this.kernel.createInstance(First.typeId, message1)
765765 } else {
766766 this.kernel.send(one, this.kernel.createMessage())
767767 this.kernel.send(one, this.kernel.createMessage())
768768 }
769769 }
770- static get type () {
770 + static get typeId () {
771771 return 299
772772 }
773773 }
774774
@@ -787,12 +787,12 @@
787787
788788 hypervisor.registerContainer(Root)
789789 hypervisor.registerContainer(First)
790790
791- const root = await hypervisor.createInstance(Root.type)
791 + const root = await hypervisor.createInstance(Root.typeId)
792792 const [portRef1, portRef2] = root.ports.createChannel()
793793 root.ports.bind('first', portRef1)
794- root.createInstance(Root.type, root.createMessage({
794 + root.createInstance(Root.typeId, root.createMessage({
795795 ports: [portRef2]
796796 }))
797797
798798 const message = root.createMessage()
@@ -807,12 +807,12 @@
807807 t.plan(4)
808808 const hypervisor = new Hypervisor(node.dag)
809809 hypervisor.registerContainer(BaseContainer)
810810
811- const root = await hypervisor.createInstance(BaseContainer.type)
811 + const root = await hypervisor.createInstance(BaseContainer.typeId)
812812
813813 const [portRef1, portRef2] = root.ports.createChannel()
814- root.createInstance(BaseContainer.type, root.createMessage({
814 + root.createInstance(BaseContainer.typeId, root.createMessage({
815815 ports: [portRef2]
816816 }))
817817 root.ports.bind('test', portRef1)
818818
@@ -855,9 +855,9 @@
855855 const message1 = this.kernel.createMessage({
856856 ports: [portRef2]
857857 })
858858
859- this.kernel.createInstance(First.type, message1)
859 + this.kernel.createInstance(First.typeId, message1)
860860 this.kernel.send(portRef1, this.kernel.createMessage())
861861 this.kernel.incrementTicks(6)
862862 }
863863 }
@@ -866,9 +866,9 @@
866866 onMessage (m) {
867867 this.kernel.incrementTicks(2)
868868 this.kernel.ports.delete('root')
869869 }
870- static get type () {
870 + static get typeId () {
871871 return 299
872872 }
873873 }
874874
@@ -876,12 +876,12 @@
876876
877877 hypervisor.registerContainer(Root)
878878 hypervisor.registerContainer(First)
879879
880- const root = await hypervisor.createInstance(Root.type)
880 + const root = await hypervisor.createInstance(Root.typeId)
881881 const [portRef1, portRef2] = root.ports.createChannel()
882882 root.ports.bind('first', portRef1)
883- root.createInstance(Root.type, root.createMessage({
883 + root.createInstance(Root.typeId, root.createMessage({
884884 ports: [portRef2]
885885 }))
886886
887887 const message = root.createMessage()
@@ -898,20 +898,20 @@
898898 '/': 'zdpuAqFMWKsATaU1gJwMTegcw18GFQ7szZix3QNgMN2sYm2vh'
899899 }
900900 class Root extends BaseContainer {
901901 onMessage (m) {
902- this.kernel.createInstance(Root.type)
902 + this.kernel.createInstance(Root.typeId)
903903 }
904904 }
905905
906906 const hypervisor = new Hypervisor(node.dag)
907907
908908 hypervisor.registerContainer(Root)
909909
910- const root = await hypervisor.createInstance(Root.type)
910 + const root = await hypervisor.createInstance(Root.typeId)
911911 const [portRef1, portRef2] = root.ports.createChannel()
912912 root.ports.bind('first', portRef1)
913- root.createInstance(Root.type, root.createMessage({
913 + root.createInstance(Root.typeId, root.createMessage({
914914 ports: [portRef2]
915915 }))
916916
917917 const message = root.createMessage()
@@ -928,9 +928,9 @@
928928 }
929929 class Root extends BaseContainer {
930930 onMessage (m) {
931931 const [, portRef2] = this.kernel.ports.createChannel()
932- this.kernel.createInstance(Sub.type, this.kernel.createMessage({
932 + this.kernel.createInstance(Sub.typeId, this.kernel.createMessage({
933933 ports: [portRef2]
934934 }))
935935 }
936936 }
@@ -939,13 +939,13 @@
939939 onInitailize (message) {
940940 this.kernel.ports.bind('root', message.ports[0])
941941 const [portRef1, portRef2] = root.ports.createChannel()
942942 root.ports.bind('child', portRef1)
943- root.createInstance(Root.type, root.createMessage({
943 + root.createInstance(Root.typeId, root.createMessage({
944944 ports: [portRef2]
945945 }))
946946 }
947- static get type () {
947 + static get typeId () {
948948 return 299
949949 }
950950 }
951951
@@ -953,12 +953,12 @@
953953
954954 hypervisor.registerContainer(Root)
955955 hypervisor.registerContainer(Sub)
956956
957- const root = await hypervisor.createInstance(Root.type)
957 + const root = await hypervisor.createInstance(Root.typeId)
958958 const [portRef1, portRef2] = root.ports.createChannel()
959959 root.ports.bind('first', portRef1)
960- root.createInstance(Root.type, root.createMessage({
960 + root.createInstance(Root.typeId, root.createMessage({
961961 ports: [portRef2]
962962 }))
963963
964964 root.send(portRef1, root.createMessage())
@@ -979,15 +979,15 @@
979979 this.kernel.send(port, m)
980980 this.kernel.ports.unbind('test1')
981981 } else {
982982 const [portRef1, portRef2] = this.kernel.ports.createChannel()
983- this.kernel.createInstance(Sub.type, this.kernel.createMessage({
983 + this.kernel.createInstance(Sub.typeId, this.kernel.createMessage({
984984 ports: [portRef2]
985985 }))
986986 this.kernel.ports.bind('test1', portRef1)
987987
988988 const [portRef3, portRef4] = this.kernel.ports.createChannel()
989- this.kernel.createInstance(Sub.type, this.kernel.createMessage({
989 + this.kernel.createInstance(Sub.typeId, this.kernel.createMessage({
990990 ports: [portRef4]
991991 }))
992992 this.kernel.ports.bind('test2', portRef3)
993993 this.kernel.send(portRef3, this.kernel.createMessage({
@@ -1009,9 +1009,9 @@
10091009 } else if (message.data === 'bindPort') {
10101010 this.kernel.ports.bind('channel', message.ports[0])
10111011 }
10121012 }
1013- static get type () {
1013 + static get typeId () {
10141014 return 299
10151015 }
10161016 }
10171017
@@ -1019,12 +1019,12 @@
10191019
10201020 hypervisor.registerContainer(Root)
10211021 hypervisor.registerContainer(Sub)
10221022
1023- const root = await hypervisor.createInstance(Root.type)
1023 + const root = await hypervisor.createInstance(Root.typeId)
10241024 const [portRef1, portRef2] = root.ports.createChannel()
10251025 root.ports.bind('first', portRef1)
1026- root.createInstance(Root.type, root.createMessage({
1026 + root.createInstance(Root.typeId, root.createMessage({
10271027 ports: [portRef2]
10281028 }))
10291029
10301030 root.send(portRef1, root.createMessage())
@@ -1047,15 +1047,15 @@
10471047 this.kernel.ports.unbind('test1')
10481048 this.kernel.ports.unbind('test2')
10491049 } else {
10501050 const [portRef1, portRef2] = this.kernel.ports.createChannel()
1051- this.kernel.createInstance(Sub.type, this.kernel.createMessage({
1051 + this.kernel.createInstance(Sub.typeId, this.kernel.createMessage({
10521052 ports: [portRef2]
10531053 }))
10541054 this.kernel.ports.bind('test1', portRef1)
10551055
10561056 const [portRef3, portRef4] = this.kernel.ports.createChannel()
1057- this.kernel.createInstance(Sub.type, this.kernel.createMessage({
1057 + this.kernel.createInstance(Sub.typeId, this.kernel.createMessage({
10581058 ports: [portRef4]
10591059 }))
10601060 this.kernel.ports.bind('test2', portRef3)
10611061 this.kernel.send(portRef3, this.kernel.createMessage({
@@ -1077,9 +1077,9 @@
10771077 } else if (message.data === 'bindPort') {
10781078 this.kernel.ports.bind('channel', message.ports[0])
10791079 }
10801080 }
1081- static get type () {
1081 + static get typeId () {
10821082 return 299
10831083 }
10841084 }
10851085
@@ -1087,13 +1087,13 @@
10871087
10881088 hypervisor.registerContainer(Root)
10891089 hypervisor.registerContainer(Sub)
10901090
1091- const root = await hypervisor.createInstance(Root.type)
1091 + const root = await hypervisor.createInstance(Root.typeId)
10921092
10931093 const [portRef1, portRef2] = root.ports.createChannel()
10941094 root.ports.bind('first', portRef1)
1095- root.createInstance(Root.type, root.createMessage({
1095 + root.createInstance(Root.typeId, root.createMessage({
10961096 ports: [portRef2]
10971097 }))
10981098
10991099 root.send(portRef1, root.createMessage())
@@ -1123,16 +1123,16 @@
11231123 const hypervisor = new Hypervisor(node.dag)
11241124
11251125 hypervisor.registerContainer(testVMContainer)
11261126
1127- const rootContainer = await hypervisor.createInstance(testVMContainer.type)
1127 + const rootContainer = await hypervisor.createInstance(testVMContainer.typeId)
11281128
11291129 const [portRef1, portRef2] = rootContainer.ports.createChannel()
11301130 const initMessage = rootContainer.createMessage({
11311131 ports: [portRef2]
11321132 })
11331133
1134- rootContainer.createInstance(testVMContainer.type, initMessage)
1134 + rootContainer.createInstance(testVMContainer.typeId, initMessage)
11351135
11361136 rootContainer.ports.bind('first', portRef1)
11371137 const message = rootContainer.createMessage()
11381138 const rPort = rootContainer.getResponsePort(message)
@@ -1154,9 +1154,9 @@
11541154 }
11551155
11561156 const hypervisor = new Hypervisor(node.dag)
11571157 hypervisor.registerContainer(testVMContainer)
1158- await hypervisor.createInstance(testVMContainer.type)
1158 + await hypervisor.createInstance(testVMContainer.typeId)
11591159 hypervisor.getInstance(hypervisor.ROOT_ID)
11601160 })
11611161
11621162 tape('large code size', async t => {
@@ -1167,9 +1167,9 @@
11671167 }
11681168
11691169 const hypervisor = new Hypervisor(node.dag)
11701170 hypervisor.registerContainer(testVMContainer)
1171- await hypervisor.createInstance(testVMContainer.type, new Message({data: content}))
1171 + await hypervisor.createInstance(testVMContainer.typeId, new Message({data: content}))
11721172 const instance = await hypervisor.getInstance(hypervisor.ROOT_ID)
11731173 t.equals(content.length, instance.code.length)
11741174 })
11751175 })

Built with git-ssb-web