git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 1aa22ba2b0c933edd5df2a76889d2cd6751baca0

exInterface -> kernel

wanderer committed on 7/5/2017, 3:51:58 AM
Parent: 2fc16a021c1f62dcf54b542adfdc06d6ace480e9

Files changed

tests/index.jschanged
tests/index.jsView
@@ -7,16 +7,16 @@
77 start: false
88 })
99
1010 class BaseContainer {
11- constructor (exInterface) {
12- this.exInterface = exInterface
11+ constructor (kernel) {
12+ this.kernel = kernel
1313 }
1414
1515 initialize (message) {
1616 const port = message.ports[0]
1717 if (port) {
18- this.exInterface.ports.bind('root', port)
18+ this.kernel.ports.bind('root', port)
1919 }
2020 }
2121 }
2222
@@ -94,15 +94,15 @@
9494 }
9595
9696 class testVMContainer extends BaseContainer {
9797 run (m) {
98- const [portRef1, portRef2] = this.exInterface.ports.createChannel()
99- this.exInterface.createInstance('test2', this.exInterface.createMessage({
98+ const [portRef1, portRef2] = this.kernel.ports.createChannel()
99+ this.kernel.createInstance('test2', this.kernel.createMessage({
100100 ports: [portRef2]
101101 }))
102- this.exInterface.ports.bind('child', portRef1)
103- this.exInterface.incrementTicks(2)
104- this.exInterface.send(portRef1, m)
102+ this.kernel.ports.bind('child', portRef1)
103+ this.kernel.incrementTicks(2)
104+ this.kernel.send(portRef1, m)
105105 }
106106 }
107107
108108 const hypervisor = new Hypervisor(node.dag)
@@ -137,9 +137,9 @@
137137 run (m) {
138138 t.true(m === message, 'should recive a message')
139139 return new Promise((resolve, reject) => {
140140 setTimeout(() => {
141- this.exInterface.incrementTicks(1)
141+ this.kernel.incrementTicks(1)
142142 hasResolved = true
143143 resolve()
144144 }, 200)
145145 })
@@ -147,15 +147,15 @@
147147 }
148148
149149 class testVMContainer extends BaseContainer {
150150 run (m) {
151- const [portRef1, portRef2] = this.exInterface.ports.createChannel()
152- this.exInterface.createInstance('test2', this.exInterface.createMessage({
151+ const [portRef1, portRef2] = this.kernel.ports.createChannel()
152+ this.kernel.createInstance('test2', this.kernel.createMessage({
153153 ports: [portRef2]
154154 }))
155- this.exInterface.ports.bind('child', portRef1)
156- this.exInterface.send(portRef1, m)
157- this.exInterface.incrementTicks(1)
155+ this.kernel.ports.bind('child', portRef1)
156+ this.kernel.send(portRef1, m)
157+ this.kernel.incrementTicks(1)
158158 }
159159 }
160160
161161 const hypervisor = new Hypervisor(node.dag)
@@ -179,11 +179,11 @@
179179
180180 // test reviving the state
181181 class testVMContainer3 extends BaseContainer {
182182 run (m) {
183- const port = this.exInterface.ports.get('child')
184- this.exInterface.send(port, m)
185- this.exInterface.incrementTicks(1)
183+ const port = this.kernel.ports.get('child')
184+ this.kernel.send(port, m)
185+ this.kernel.incrementTicks(1)
186186 }
187187 }
188188
189189 hypervisor.registerContainer('test', testVMContainer3)
@@ -195,29 +195,29 @@
195195 tape('traps', async t => {
196196 t.plan(1)
197197 class Root extends BaseContainer {
198198 async run (m) {
199- const [portRef1, portRef2] = this.exInterface.ports.createChannel()
200- const [portRef3, portRef4] = this.exInterface.ports.createChannel()
201- const [portRef5, portRef6] = this.exInterface.ports.createChannel()
199+ const [portRef1, portRef2] = this.kernel.ports.createChannel()
200+ const [portRef3, portRef4] = this.kernel.ports.createChannel()
201+ const [portRef5, portRef6] = this.kernel.ports.createChannel()
202202
203- this.exInterface.ports.bind('one', portRef1)
204- this.exInterface.ports.bind('two', portRef3)
205- this.exInterface.ports.bind('three', portRef5)
203+ this.kernel.ports.bind('one', portRef1)
204+ this.kernel.ports.bind('two', portRef3)
205+ this.kernel.ports.bind('three', portRef5)
206206
207- const message1 = this.exInterface.createMessage({
207+ const message1 = this.kernel.createMessage({
208208 ports: [portRef2]
209209 })
210- const message2 = this.exInterface.createMessage({
210+ const message2 = this.kernel.createMessage({
211211 ports: [portRef4]
212212 })
213- const message3 = this.exInterface.createMessage({
213+ const message3 = this.kernel.createMessage({
214214 ports: [portRef6]
215215 })
216216
217- this.exInterface.createInstance('root', message1)
218- this.exInterface.createInstance('root', message2)
219- this.exInterface.createInstance('root', message3)
217+ this.kernel.createInstance('root', message1)
218+ this.kernel.createInstance('root', message2)
219+ this.kernel.createInstance('root', message3)
220220
221221 throw new Error('it is a trap!!!')
222222 }
223223 }
@@ -242,26 +242,26 @@
242242 run (m) {
243243 if (!runs) {
244244 runs++
245245
246- const [portRef1, portRef2] = this.exInterface.ports.createChannel()
247- const [portRef3, portRef4] = this.exInterface.ports.createChannel()
246+ const [portRef1, portRef2] = this.kernel.ports.createChannel()
247+ const [portRef3, portRef4] = this.kernel.ports.createChannel()
248248
249- this.exInterface.ports.bind('two', portRef3)
250- this.exInterface.ports.bind('one', portRef1)
249+ this.kernel.ports.bind('two', portRef3)
250+ this.kernel.ports.bind('one', portRef1)
251251
252- const message1 = this.exInterface.createMessage({
252+ const message1 = this.kernel.createMessage({
253253 ports: [portRef2]
254254 })
255- const message2 = this.exInterface.createMessage({
255+ const message2 = this.kernel.createMessage({
256256 ports: [portRef4]
257257 })
258258
259- this.exInterface.createInstance('first', message1)
260- this.exInterface.createInstance('second', message2)
259+ this.kernel.createInstance('first', message1)
260+ this.kernel.createInstance('second', message2)
261261
262- this.exInterface.send(portRef1, this.exInterface.createMessage())
263- this.exInterface.send(portRef3, this.exInterface.createMessage())
262+ this.kernel.send(portRef1, this.kernel.createMessage())
263+ this.kernel.send(portRef3, this.kernel.createMessage())
264264 } else if (runs === 1) {
265265 runs++
266266 t.equals(m.data, 'first', 'should recive the first message')
267267 } else if (runs === 2) {
@@ -271,19 +271,19 @@
271271 }
272272
273273 class First extends BaseContainer {
274274 run (m) {
275- this.exInterface.incrementTicks(2)
276- return this.exInterface.send(m.fromPort, this.exInterface.createMessage({
275+ this.kernel.incrementTicks(2)
276+ return this.kernel.send(m.fromPort, this.kernel.createMessage({
277277 data: 'first'
278278 }))
279279 }
280280 }
281281
282282 class Second extends BaseContainer {
283283 run (m) {
284- this.exInterface.incrementTicks(3)
285- return this.exInterface.send(m.fromPort, this.exInterface.createMessage({
284+ this.kernel.incrementTicks(3)
285+ return this.kernel.send(m.fromPort, this.kernel.createMessage({
286286 data: 'second'
287287 }))
288288 }
289289 }
@@ -314,26 +314,26 @@
314314 run (m) {
315315 if (!runs) {
316316 runs++
317317
318- const [portRef1, portRef2] = this.exInterface.ports.createChannel()
319- const [portRef3, portRef4] = this.exInterface.ports.createChannel()
318+ const [portRef1, portRef2] = this.kernel.ports.createChannel()
319+ const [portRef3, portRef4] = this.kernel.ports.createChannel()
320320
321- this.exInterface.ports.bind('one', portRef1)
322- this.exInterface.ports.bind('two', portRef3)
321+ this.kernel.ports.bind('one', portRef1)
322+ this.kernel.ports.bind('two', portRef3)
323323
324- const message1 = this.exInterface.createMessage({
324+ const message1 = this.kernel.createMessage({
325325 ports: [portRef2]
326326 })
327- const message2 = this.exInterface.createMessage({
327+ const message2 = this.kernel.createMessage({
328328 ports: [portRef4]
329329 })
330330
331- this.exInterface.createInstance('first', message1)
332- this.exInterface.createInstance('second', message2)
331+ this.kernel.createInstance('first', message1)
332+ this.kernel.createInstance('second', message2)
333333
334- this.exInterface.send(portRef1, this.exInterface.createMessage())
335- this.exInterface.send(portRef3, this.exInterface.createMessage())
334+ this.kernel.send(portRef1, this.kernel.createMessage())
335+ this.kernel.send(portRef3, this.kernel.createMessage())
336336 } else if (runs === 1) {
337337 runs++
338338 t.equals(m.data, 'second', 'should recived the second message')
339339 } else if (runs === 2) {
@@ -343,19 +343,19 @@
343343 }
344344
345345 class First extends BaseContainer {
346346 run (m) {
347- this.exInterface.incrementTicks(2)
348- return this.exInterface.send(m.fromPort, this.exInterface.createMessage({
347+ this.kernel.incrementTicks(2)
348+ return this.kernel.send(m.fromPort, this.kernel.createMessage({
349349 data: 'first'
350350 }))
351351 }
352352 }
353353
354354 class Second extends BaseContainer {
355355 run (m) {
356- this.exInterface.incrementTicks(1)
357- return this.exInterface.send(m.fromPort, this.exInterface.createMessage({
356+ this.kernel.incrementTicks(1)
357+ return this.kernel.send(m.fromPort, this.kernel.createMessage({
358358 data: 'second'
359359 }))
360360 }
361361 }
@@ -385,28 +385,28 @@
385385 class Root extends BaseContainer {
386386 run (m) {
387387 if (!runs) {
388388 runs++
389- const [portRef1, portRef2] = this.exInterface.ports.createChannel()
390- const [portRef3, portRef4] = this.exInterface.ports.createChannel()
389+ const [portRef1, portRef2] = this.kernel.ports.createChannel()
390+ const [portRef3, portRef4] = this.kernel.ports.createChannel()
391391
392- this.exInterface.ports.bind('one', portRef1)
393- this.exInterface.ports.bind('two', portRef3)
392+ this.kernel.ports.bind('one', portRef1)
393+ this.kernel.ports.bind('two', portRef3)
394394
395- const message1 = this.exInterface.createMessage({
395+ const message1 = this.kernel.createMessage({
396396 ports: [portRef2]
397397 })
398- const message2 = this.exInterface.createMessage({
398+ const message2 = this.kernel.createMessage({
399399 ports: [portRef4]
400400 })
401401
402- this.exInterface.createInstance('first', message1)
403- this.exInterface.createInstance('second', message2)
402+ this.kernel.createInstance('first', message1)
403+ this.kernel.createInstance('second', message2)
404404
405- this.exInterface.send(portRef1, this.exInterface.createMessage())
406- this.exInterface.send(portRef3, this.exInterface.createMessage())
405+ this.kernel.send(portRef1, this.kernel.createMessage())
406+ this.kernel.send(portRef3, this.kernel.createMessage())
407407
408- this.exInterface.incrementTicks(6)
408+ this.kernel.incrementTicks(6)
409409 } else if (runs === 1) {
410410 runs++
411411 t.equals(m.data, 'first', 'should recive the first message')
412412 } else if (runs === 2) {
@@ -416,19 +416,19 @@
416416 }
417417
418418 class First extends BaseContainer {
419419 run (m) {
420- this.exInterface.incrementTicks(1)
421- this.exInterface.send(m.fromPort, this.exInterface.createMessage({
420+ this.kernel.incrementTicks(1)
421+ this.kernel.send(m.fromPort, this.kernel.createMessage({
422422 data: 'first'
423423 }))
424424 }
425425 }
426426
427427 class Second extends BaseContainer {
428428 run (m) {
429- this.exInterface.incrementTicks(2)
430- this.exInterface.send(m.fromPort, this.exInterface.createMessage({
429+ this.kernel.incrementTicks(2)
430+ this.kernel.send(m.fromPort, this.kernel.createMessage({
431431 data: 'second'
432432 }))
433433 }
434434 }
@@ -457,28 +457,28 @@
457457 class Root extends BaseContainer {
458458 run (m) {
459459 if (!runs) {
460460 runs++
461- const [portRef1, portRef2] = this.exInterface.ports.createChannel()
462- const [portRef3, portRef4] = this.exInterface.ports.createChannel()
461+ const [portRef1, portRef2] = this.kernel.ports.createChannel()
462+ const [portRef3, portRef4] = this.kernel.ports.createChannel()
463463
464- this.exInterface.ports.bind('one', portRef1)
465- this.exInterface.ports.bind('two', portRef3)
464+ this.kernel.ports.bind('one', portRef1)
465+ this.kernel.ports.bind('two', portRef3)
466466
467- const message1 = this.exInterface.createMessage({
467+ const message1 = this.kernel.createMessage({
468468 ports: [portRef2]
469469 })
470- const message2 = this.exInterface.createMessage({
470+ const message2 = this.kernel.createMessage({
471471 ports: [portRef4]
472472 })
473473
474- this.exInterface.createInstance('first', message1)
475- this.exInterface.createInstance('second', message2)
474+ this.kernel.createInstance('first', message1)
475+ this.kernel.createInstance('second', message2)
476476
477- this.exInterface.send(portRef1, this.exInterface.createMessage())
478- this.exInterface.send(portRef3, this.exInterface.createMessage())
477+ this.kernel.send(portRef1, this.kernel.createMessage())
478+ this.kernel.send(portRef3, this.kernel.createMessage())
479479
480- this.exInterface.incrementTicks(6)
480+ this.kernel.incrementTicks(6)
481481 } else if (runs === 1) {
482482 runs++
483483 t.equals(m.data, 'first', 'should recive the first message')
484484 } else if (runs === 2) {
@@ -489,19 +489,19 @@
489489 }
490490
491491 class First extends BaseContainer {
492492 run (m) {
493- this.exInterface.incrementTicks(2)
494- this.exInterface.send(m.fromPort, this.exInterface.createMessage({
493+ this.kernel.incrementTicks(2)
494+ this.kernel.send(m.fromPort, this.kernel.createMessage({
495495 data: 'first'
496496 }))
497497 }
498498 }
499499
500500 class Second extends BaseContainer {
501501 run (m) {
502- this.exInterface.incrementTicks(3)
503- this.exInterface.send(m.fromPort, this.exInterface.createMessage({
502+ this.kernel.incrementTicks(3)
503+ this.kernel.send(m.fromPort, this.kernel.createMessage({
504504 data: 'second'
505505 }))
506506 }
507507 }
@@ -552,28 +552,28 @@
552552 class Root extends BaseContainer {
553553 run (m) {
554554 if (!runs) {
555555 runs++
556- const [portRef1, portRef2] = this.exInterface.ports.createChannel()
557- const [portRef3, portRef4] = this.exInterface.ports.createChannel()
556+ const [portRef1, portRef2] = this.kernel.ports.createChannel()
557+ const [portRef3, portRef4] = this.kernel.ports.createChannel()
558558
559- this.exInterface.ports.bind('two', portRef3)
560- this.exInterface.ports.bind('one', portRef1)
559+ this.kernel.ports.bind('two', portRef3)
560+ this.kernel.ports.bind('one', portRef1)
561561
562- const message1 = this.exInterface.createMessage({
562+ const message1 = this.kernel.createMessage({
563563 ports: [portRef2]
564564 })
565- const message2 = this.exInterface.createMessage({
565+ const message2 = this.kernel.createMessage({
566566 ports: [portRef4]
567567 })
568568
569- this.exInterface.createInstance('first', message1)
570- this.exInterface.createInstance('second', message2)
569+ this.kernel.createInstance('first', message1)
570+ this.kernel.createInstance('second', message2)
571571
572- this.exInterface.send(portRef1, this.exInterface.createMessage())
573- this.exInterface.send(portRef3, this.exInterface.createMessage())
572+ this.kernel.send(portRef1, this.kernel.createMessage())
573+ this.kernel.send(portRef3, this.kernel.createMessage())
574574
575- this.exInterface.incrementTicks(6)
575+ this.kernel.incrementTicks(6)
576576 } else if (runs === 1) {
577577 runs++
578578 t.equals(m.data, 'second', 'should recived the second message')
579579 } else if (runs === 2) {
@@ -583,19 +583,19 @@
583583 }
584584
585585 class First extends BaseContainer {
586586 run (m) {
587- this.exInterface.incrementTicks(2)
588- return this.exInterface.send(m.fromPort, this.exInterface.createMessage({
587+ this.kernel.incrementTicks(2)
588+ return this.kernel.send(m.fromPort, this.kernel.createMessage({
589589 data: 'first'
590590 }))
591591 }
592592 }
593593
594594 class Second extends BaseContainer {
595595 run (m) {
596- this.exInterface.incrementTicks(2)
597- return this.exInterface.send(m.fromPort, this.exInterface.createMessage({
596+ this.kernel.incrementTicks(2)
597+ return this.kernel.send(m.fromPort, this.kernel.createMessage({
598598 data: 'second'
599599 }))
600600 }
601601 }
@@ -625,28 +625,28 @@
625625 class Root extends BaseContainer {
626626 run (m) {
627627 if (!runs) {
628628 runs++
629- const [portRef1, portRef2] = this.exInterface.ports.createChannel()
630- const [portRef3, portRef4] = this.exInterface.ports.createChannel()
629+ const [portRef1, portRef2] = this.kernel.ports.createChannel()
630+ const [portRef3, portRef4] = this.kernel.ports.createChannel()
631631
632- this.exInterface.ports.bind('one', portRef1)
633- this.exInterface.ports.bind('two', portRef3)
632+ this.kernel.ports.bind('one', portRef1)
633+ this.kernel.ports.bind('two', portRef3)
634634
635- const message1 = this.exInterface.createMessage({
635+ const message1 = this.kernel.createMessage({
636636 ports: [portRef2]
637637 })
638- const message2 = this.exInterface.createMessage({
638+ const message2 = this.kernel.createMessage({
639639 ports: [portRef4]
640640 })
641641
642- this.exInterface.createInstance('first', message1)
643- this.exInterface.createInstance('second', message2)
642+ this.kernel.createInstance('first', message1)
643+ this.kernel.createInstance('second', message2)
644644
645- this.exInterface.send(portRef1, this.exInterface.createMessage())
646- this.exInterface.send(portRef3, this.exInterface.createMessage())
645+ this.kernel.send(portRef1, this.kernel.createMessage())
646+ this.kernel.send(portRef3, this.kernel.createMessage())
647647
648- this.exInterface.incrementTicks(6)
648+ this.kernel.incrementTicks(6)
649649 } else if (runs === 1) {
650650 runs++
651651 t.equals(m.data, 'first', 'should recive the first message')
652652 } else if (runs === 2) {
@@ -656,19 +656,19 @@
656656 }
657657
658658 class First extends BaseContainer {
659659 run (m) {
660- this.exInterface.incrementTicks(2)
661- return this.exInterface.send(m.fromPort, this.exInterface.createMessage({
660+ this.kernel.incrementTicks(2)
661+ return this.kernel.send(m.fromPort, this.kernel.createMessage({
662662 data: 'first'
663663 }))
664664 }
665665 }
666666
667667 class Second extends BaseContainer {
668668 run (m) {
669- this.exInterface.incrementTicks(2)
670- return this.exInterface.send(m.fromPort, this.exInterface.createMessage({
669+ this.kernel.incrementTicks(2)
670+ return this.kernel.send(m.fromPort, this.kernel.createMessage({
671671 data: 'second'
672672 }))
673673 }
674674 }
@@ -697,19 +697,19 @@
697697 let instance
698698
699699 class Root extends BaseContainer {
700700 run (m) {
701- let one = this.exInterface.ports.get('one')
701+ let one = this.kernel.ports.get('one')
702702 if (!one) {
703- const [portRef1, portRef2] = this.exInterface.ports.createChannel()
704- this.exInterface.ports.bind('one', portRef1)
705- const message1 = this.exInterface.createMessage({
703+ const [portRef1, portRef2] = this.kernel.ports.createChannel()
704+ this.kernel.ports.bind('one', portRef1)
705+ const message1 = this.kernel.createMessage({
706706 ports: [portRef2]
707707 })
708- this.exInterface.createInstance('first', message1)
708+ this.kernel.createInstance('first', message1)
709709 } else {
710- this.exInterface.send(one, this.exInterface.createMessage())
711- this.exInterface.send(one, this.exInterface.createMessage())
710+ this.kernel.send(one, this.kernel.createMessage())
711+ this.kernel.send(one, this.kernel.createMessage())
712712 }
713713 }
714714 }
715715
@@ -790,24 +790,24 @@
790790 '/': 'zdpuB2QXxn1KQtLFfBqaritTRoe5BuKP5sNFSrPtRT6sxkY7Z'
791791 }
792792 class Root extends BaseContainer {
793793 run (m) {
794- const [portRef1, portRef2] = this.exInterface.ports.createChannel()
795- this.exInterface.ports.bind('one', portRef1)
796- const message1 = this.exInterface.createMessage({
794+ const [portRef1, portRef2] = this.kernel.ports.createChannel()
795+ this.kernel.ports.bind('one', portRef1)
796+ const message1 = this.kernel.createMessage({
797797 ports: [portRef2]
798798 })
799799
800- this.exInterface.createInstance('first', message1)
801- this.exInterface.send(portRef1, this.exInterface.createMessage())
802- this.exInterface.incrementTicks(6)
800+ this.kernel.createInstance('first', message1)
801+ this.kernel.send(portRef1, this.kernel.createMessage())
802+ this.kernel.incrementTicks(6)
803803 }
804804 }
805805
806806 class First extends BaseContainer {
807807 run (m) {
808- this.exInterface.incrementTicks(2)
809- this.exInterface.ports.delete('root')
808+ this.kernel.incrementTicks(2)
809+ this.kernel.ports.delete('root')
810810 }
811811 }
812812
813813 const hypervisor = new Hypervisor(node.dag)
@@ -836,9 +836,9 @@
836836 '/': 'zdpuB2QXxn1KQtLFfBqaritTRoe5BuKP5sNFSrPtRT6sxkY7Z'
837837 }
838838 class Root extends BaseContainer {
839839 run (m) {
840- this.exInterface.createInstance('root')
840+ this.kernel.createInstance('root')
841841 }
842842 }
843843
844844 const hypervisor = new Hypervisor(node.dag)
@@ -865,18 +865,18 @@
865865 '/': 'zdpuB2QXxn1KQtLFfBqaritTRoe5BuKP5sNFSrPtRT6sxkY7Z'
866866 }
867867 class Root extends BaseContainer {
868868 run (m) {
869- const [, portRef2] = this.exInterface.ports.createChannel()
870- this.exInterface.createInstance('sub', this.exInterface.createMessage({
869+ const [, portRef2] = this.kernel.ports.createChannel()
870+ this.kernel.createInstance('sub', this.kernel.createMessage({
871871 ports: [portRef2]
872872 }))
873873 }
874874 }
875875
876876 class Sub extends BaseContainer {
877877 initailize (message) {
878- this.exInterface.ports.bind('root', message.ports[0])
878+ this.kernel.ports.bind('root', message.ports[0])
879879 const [portRef1, portRef2] = root.ports.createChannel()
880880 root.ports.bind('child', portRef1)
881881 root.createInstance('root', root.createMessage({
882882 ports: [portRef2]
@@ -909,24 +909,24 @@
909909 }
910910 class Root extends BaseContainer {
911911 run (m) {
912912 if (m.ports.length) {
913- const port = this.exInterface.ports.get('test1')
914- this.exInterface.send(port, m)
915- this.exInterface.ports.unbind('test1')
913+ const port = this.kernel.ports.get('test1')
914+ this.kernel.send(port, m)
915+ this.kernel.ports.unbind('test1')
916916 } else {
917- const [portRef1, portRef2] = this.exInterface.ports.createChannel()
918- this.exInterface.createInstance('sub', this.exInterface.createMessage({
917+ const [portRef1, portRef2] = this.kernel.ports.createChannel()
918+ this.kernel.createInstance('sub', this.kernel.createMessage({
919919 ports: [portRef2]
920920 }))
921- this.exInterface.ports.bind('test1', portRef1)
921+ this.kernel.ports.bind('test1', portRef1)
922922
923- const [portRef3, portRef4] = this.exInterface.ports.createChannel()
924- this.exInterface.createInstance('sub', this.exInterface.createMessage({
923+ const [portRef3, portRef4] = this.kernel.ports.createChannel()
924+ this.kernel.createInstance('sub', this.kernel.createMessage({
925925 ports: [portRef4]
926926 }))
927- this.exInterface.ports.bind('test2', portRef3)
928- this.exInterface.send(portRef3, this.exInterface.createMessage({
927+ this.kernel.ports.bind('test2', portRef3)
928+ this.kernel.send(portRef3, this.kernel.createMessage({
929929 data: 'getChannel'
930930 }))
931931 }
932932 }
@@ -934,16 +934,16 @@
934934
935935 class Sub extends BaseContainer {
936936 run (message) {
937937 if (message.data === 'getChannel') {
938- const ports = this.exInterface.ports.createChannel()
939- this.exInterface.ports.bind('channel', ports[0])
940- this.exInterface.send(message.fromPort, this.exInterface.createMessage({
938+ const ports = this.kernel.ports.createChannel()
939+ this.kernel.ports.bind('channel', ports[0])
940+ this.kernel.send(message.fromPort, this.kernel.createMessage({
941941 data: 'bindPort',
942942 ports: [ports[1]]
943943 }))
944944 } else if (message.data === 'bindPort') {
945- this.exInterface.ports.bind('channel', message.ports[0])
945+ this.kernel.ports.bind('channel', message.ports[0])
946946 }
947947 }
948948 }
949949
@@ -973,25 +973,25 @@
973973 }
974974 class Root extends BaseContainer {
975975 run (m) {
976976 if (m.ports.length) {
977- const port = this.exInterface.ports.get('test1')
978- this.exInterface.send(port, m)
979- this.exInterface.ports.unbind('test1')
980- this.exInterface.ports.unbind('test2')
977+ const port = this.kernel.ports.get('test1')
978+ this.kernel.send(port, m)
979+ this.kernel.ports.unbind('test1')
980+ this.kernel.ports.unbind('test2')
981981 } else {
982- const [portRef1, portRef2] = this.exInterface.ports.createChannel()
983- this.exInterface.createInstance('sub', this.exInterface.createMessage({
982+ const [portRef1, portRef2] = this.kernel.ports.createChannel()
983+ this.kernel.createInstance('sub', this.kernel.createMessage({
984984 ports: [portRef2]
985985 }))
986- this.exInterface.ports.bind('test1', portRef1)
986+ this.kernel.ports.bind('test1', portRef1)
987987
988- const [portRef3, portRef4] = this.exInterface.ports.createChannel()
989- this.exInterface.createInstance('sub', this.exInterface.createMessage({
988+ const [portRef3, portRef4] = this.kernel.ports.createChannel()
989+ this.kernel.createInstance('sub', this.kernel.createMessage({
990990 ports: [portRef4]
991991 }))
992- this.exInterface.ports.bind('test2', portRef3)
993- this.exInterface.send(portRef3, this.exInterface.createMessage({
992+ this.kernel.ports.bind('test2', portRef3)
993+ this.kernel.send(portRef3, this.kernel.createMessage({
994994 data: 'getChannel'
995995 }))
996996 }
997997 }
@@ -999,16 +999,16 @@
999999
10001000 class Sub extends BaseContainer {
10011001 run (message) {
10021002 if (message.data === 'getChannel') {
1003- const ports = this.exInterface.ports.createChannel()
1004- this.exInterface.ports.bind('channel', ports[0])
1005- this.exInterface.send(message.fromPort, this.exInterface.createMessage({
1003+ const ports = this.kernel.ports.createChannel()
1004+ this.kernel.ports.bind('channel', ports[0])
1005+ this.kernel.send(message.fromPort, this.kernel.createMessage({
10061006 data: 'bindPort',
10071007 ports: [ports[1]]
10081008 }))
10091009 } else if (message.data === 'bindPort') {
1010- this.exInterface.ports.bind('channel', message.ports[0])
1010+ this.kernel.ports.bind('channel', message.ports[0])
10111011 }
10121012 }
10131013 }
10141014

Built with git-ssb-web