Commit 1aa22ba2b0c933edd5df2a76889d2cd6751baca0
exInterface -> kernel
wanderer committed on 7/5/2017, 3:51:58 AMParent: 2fc16a021c1f62dcf54b542adfdc06d6ace480e9
Files changed
tests/index.js | changed |
tests/index.js | ||
---|---|---|
@@ -7,16 +7,16 @@ | ||
7 | 7 | start: false |
8 | 8 | }) |
9 | 9 | |
10 | 10 | class BaseContainer { |
11 | - constructor (exInterface) { | |
12 | - this.exInterface = exInterface | |
11 | + constructor (kernel) { | |
12 | + this.kernel = kernel | |
13 | 13 | } |
14 | 14 | |
15 | 15 | initialize (message) { |
16 | 16 | const port = message.ports[0] |
17 | 17 | if (port) { |
18 | - this.exInterface.ports.bind('root', port) | |
18 | + this.kernel.ports.bind('root', port) | |
19 | 19 | } |
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
@@ -94,15 +94,15 @@ | ||
94 | 94 | } |
95 | 95 | |
96 | 96 | class testVMContainer extends BaseContainer { |
97 | 97 | 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({ | |
100 | 100 | ports: [portRef2] |
101 | 101 | })) |
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) | |
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | 108 | const hypervisor = new Hypervisor(node.dag) |
@@ -137,9 +137,9 @@ | ||
137 | 137 | run (m) { |
138 | 138 | t.true(m === message, 'should recive a message') |
139 | 139 | return new Promise((resolve, reject) => { |
140 | 140 | setTimeout(() => { |
141 | - this.exInterface.incrementTicks(1) | |
141 | + this.kernel.incrementTicks(1) | |
142 | 142 | hasResolved = true |
143 | 143 | resolve() |
144 | 144 | }, 200) |
145 | 145 | }) |
@@ -147,15 +147,15 @@ | ||
147 | 147 | } |
148 | 148 | |
149 | 149 | class testVMContainer extends BaseContainer { |
150 | 150 | 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({ | |
153 | 153 | ports: [portRef2] |
154 | 154 | })) |
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) | |
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
161 | 161 | const hypervisor = new Hypervisor(node.dag) |
@@ -179,11 +179,11 @@ | ||
179 | 179 | |
180 | 180 | // test reviving the state |
181 | 181 | class testVMContainer3 extends BaseContainer { |
182 | 182 | 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) | |
186 | 186 | } |
187 | 187 | } |
188 | 188 | |
189 | 189 | hypervisor.registerContainer('test', testVMContainer3) |
@@ -195,29 +195,29 @@ | ||
195 | 195 | tape('traps', async t => { |
196 | 196 | t.plan(1) |
197 | 197 | class Root extends BaseContainer { |
198 | 198 | 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() | |
202 | 202 | |
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) | |
206 | 206 | |
207 | - const message1 = this.exInterface.createMessage({ | |
207 | + const message1 = this.kernel.createMessage({ | |
208 | 208 | ports: [portRef2] |
209 | 209 | }) |
210 | - const message2 = this.exInterface.createMessage({ | |
210 | + const message2 = this.kernel.createMessage({ | |
211 | 211 | ports: [portRef4] |
212 | 212 | }) |
213 | - const message3 = this.exInterface.createMessage({ | |
213 | + const message3 = this.kernel.createMessage({ | |
214 | 214 | ports: [portRef6] |
215 | 215 | }) |
216 | 216 | |
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) | |
220 | 220 | |
221 | 221 | throw new Error('it is a trap!!!') |
222 | 222 | } |
223 | 223 | } |
@@ -242,26 +242,26 @@ | ||
242 | 242 | run (m) { |
243 | 243 | if (!runs) { |
244 | 244 | runs++ |
245 | 245 | |
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() | |
248 | 248 | |
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) | |
251 | 251 | |
252 | - const message1 = this.exInterface.createMessage({ | |
252 | + const message1 = this.kernel.createMessage({ | |
253 | 253 | ports: [portRef2] |
254 | 254 | }) |
255 | - const message2 = this.exInterface.createMessage({ | |
255 | + const message2 = this.kernel.createMessage({ | |
256 | 256 | ports: [portRef4] |
257 | 257 | }) |
258 | 258 | |
259 | - this.exInterface.createInstance('first', message1) | |
260 | - this.exInterface.createInstance('second', message2) | |
259 | + this.kernel.createInstance('first', message1) | |
260 | + this.kernel.createInstance('second', message2) | |
261 | 261 | |
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()) | |
264 | 264 | } else if (runs === 1) { |
265 | 265 | runs++ |
266 | 266 | t.equals(m.data, 'first', 'should recive the first message') |
267 | 267 | } else if (runs === 2) { |
@@ -271,19 +271,19 @@ | ||
271 | 271 | } |
272 | 272 | |
273 | 273 | class First extends BaseContainer { |
274 | 274 | 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({ | |
277 | 277 | data: 'first' |
278 | 278 | })) |
279 | 279 | } |
280 | 280 | } |
281 | 281 | |
282 | 282 | class Second extends BaseContainer { |
283 | 283 | 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({ | |
286 | 286 | data: 'second' |
287 | 287 | })) |
288 | 288 | } |
289 | 289 | } |
@@ -314,26 +314,26 @@ | ||
314 | 314 | run (m) { |
315 | 315 | if (!runs) { |
316 | 316 | runs++ |
317 | 317 | |
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() | |
320 | 320 | |
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) | |
323 | 323 | |
324 | - const message1 = this.exInterface.createMessage({ | |
324 | + const message1 = this.kernel.createMessage({ | |
325 | 325 | ports: [portRef2] |
326 | 326 | }) |
327 | - const message2 = this.exInterface.createMessage({ | |
327 | + const message2 = this.kernel.createMessage({ | |
328 | 328 | ports: [portRef4] |
329 | 329 | }) |
330 | 330 | |
331 | - this.exInterface.createInstance('first', message1) | |
332 | - this.exInterface.createInstance('second', message2) | |
331 | + this.kernel.createInstance('first', message1) | |
332 | + this.kernel.createInstance('second', message2) | |
333 | 333 | |
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()) | |
336 | 336 | } else if (runs === 1) { |
337 | 337 | runs++ |
338 | 338 | t.equals(m.data, 'second', 'should recived the second message') |
339 | 339 | } else if (runs === 2) { |
@@ -343,19 +343,19 @@ | ||
343 | 343 | } |
344 | 344 | |
345 | 345 | class First extends BaseContainer { |
346 | 346 | 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({ | |
349 | 349 | data: 'first' |
350 | 350 | })) |
351 | 351 | } |
352 | 352 | } |
353 | 353 | |
354 | 354 | class Second extends BaseContainer { |
355 | 355 | 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({ | |
358 | 358 | data: 'second' |
359 | 359 | })) |
360 | 360 | } |
361 | 361 | } |
@@ -385,28 +385,28 @@ | ||
385 | 385 | class Root extends BaseContainer { |
386 | 386 | run (m) { |
387 | 387 | if (!runs) { |
388 | 388 | 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() | |
391 | 391 | |
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) | |
394 | 394 | |
395 | - const message1 = this.exInterface.createMessage({ | |
395 | + const message1 = this.kernel.createMessage({ | |
396 | 396 | ports: [portRef2] |
397 | 397 | }) |
398 | - const message2 = this.exInterface.createMessage({ | |
398 | + const message2 = this.kernel.createMessage({ | |
399 | 399 | ports: [portRef4] |
400 | 400 | }) |
401 | 401 | |
402 | - this.exInterface.createInstance('first', message1) | |
403 | - this.exInterface.createInstance('second', message2) | |
402 | + this.kernel.createInstance('first', message1) | |
403 | + this.kernel.createInstance('second', message2) | |
404 | 404 | |
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()) | |
407 | 407 | |
408 | - this.exInterface.incrementTicks(6) | |
408 | + this.kernel.incrementTicks(6) | |
409 | 409 | } else if (runs === 1) { |
410 | 410 | runs++ |
411 | 411 | t.equals(m.data, 'first', 'should recive the first message') |
412 | 412 | } else if (runs === 2) { |
@@ -416,19 +416,19 @@ | ||
416 | 416 | } |
417 | 417 | |
418 | 418 | class First extends BaseContainer { |
419 | 419 | 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({ | |
422 | 422 | data: 'first' |
423 | 423 | })) |
424 | 424 | } |
425 | 425 | } |
426 | 426 | |
427 | 427 | class Second extends BaseContainer { |
428 | 428 | 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({ | |
431 | 431 | data: 'second' |
432 | 432 | })) |
433 | 433 | } |
434 | 434 | } |
@@ -457,28 +457,28 @@ | ||
457 | 457 | class Root extends BaseContainer { |
458 | 458 | run (m) { |
459 | 459 | if (!runs) { |
460 | 460 | 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() | |
463 | 463 | |
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) | |
466 | 466 | |
467 | - const message1 = this.exInterface.createMessage({ | |
467 | + const message1 = this.kernel.createMessage({ | |
468 | 468 | ports: [portRef2] |
469 | 469 | }) |
470 | - const message2 = this.exInterface.createMessage({ | |
470 | + const message2 = this.kernel.createMessage({ | |
471 | 471 | ports: [portRef4] |
472 | 472 | }) |
473 | 473 | |
474 | - this.exInterface.createInstance('first', message1) | |
475 | - this.exInterface.createInstance('second', message2) | |
474 | + this.kernel.createInstance('first', message1) | |
475 | + this.kernel.createInstance('second', message2) | |
476 | 476 | |
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()) | |
479 | 479 | |
480 | - this.exInterface.incrementTicks(6) | |
480 | + this.kernel.incrementTicks(6) | |
481 | 481 | } else if (runs === 1) { |
482 | 482 | runs++ |
483 | 483 | t.equals(m.data, 'first', 'should recive the first message') |
484 | 484 | } else if (runs === 2) { |
@@ -489,19 +489,19 @@ | ||
489 | 489 | } |
490 | 490 | |
491 | 491 | class First extends BaseContainer { |
492 | 492 | 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({ | |
495 | 495 | data: 'first' |
496 | 496 | })) |
497 | 497 | } |
498 | 498 | } |
499 | 499 | |
500 | 500 | class Second extends BaseContainer { |
501 | 501 | 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({ | |
504 | 504 | data: 'second' |
505 | 505 | })) |
506 | 506 | } |
507 | 507 | } |
@@ -552,28 +552,28 @@ | ||
552 | 552 | class Root extends BaseContainer { |
553 | 553 | run (m) { |
554 | 554 | if (!runs) { |
555 | 555 | 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() | |
558 | 558 | |
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) | |
561 | 561 | |
562 | - const message1 = this.exInterface.createMessage({ | |
562 | + const message1 = this.kernel.createMessage({ | |
563 | 563 | ports: [portRef2] |
564 | 564 | }) |
565 | - const message2 = this.exInterface.createMessage({ | |
565 | + const message2 = this.kernel.createMessage({ | |
566 | 566 | ports: [portRef4] |
567 | 567 | }) |
568 | 568 | |
569 | - this.exInterface.createInstance('first', message1) | |
570 | - this.exInterface.createInstance('second', message2) | |
569 | + this.kernel.createInstance('first', message1) | |
570 | + this.kernel.createInstance('second', message2) | |
571 | 571 | |
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()) | |
574 | 574 | |
575 | - this.exInterface.incrementTicks(6) | |
575 | + this.kernel.incrementTicks(6) | |
576 | 576 | } else if (runs === 1) { |
577 | 577 | runs++ |
578 | 578 | t.equals(m.data, 'second', 'should recived the second message') |
579 | 579 | } else if (runs === 2) { |
@@ -583,19 +583,19 @@ | ||
583 | 583 | } |
584 | 584 | |
585 | 585 | class First extends BaseContainer { |
586 | 586 | 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({ | |
589 | 589 | data: 'first' |
590 | 590 | })) |
591 | 591 | } |
592 | 592 | } |
593 | 593 | |
594 | 594 | class Second extends BaseContainer { |
595 | 595 | 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({ | |
598 | 598 | data: 'second' |
599 | 599 | })) |
600 | 600 | } |
601 | 601 | } |
@@ -625,28 +625,28 @@ | ||
625 | 625 | class Root extends BaseContainer { |
626 | 626 | run (m) { |
627 | 627 | if (!runs) { |
628 | 628 | 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() | |
631 | 631 | |
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) | |
634 | 634 | |
635 | - const message1 = this.exInterface.createMessage({ | |
635 | + const message1 = this.kernel.createMessage({ | |
636 | 636 | ports: [portRef2] |
637 | 637 | }) |
638 | - const message2 = this.exInterface.createMessage({ | |
638 | + const message2 = this.kernel.createMessage({ | |
639 | 639 | ports: [portRef4] |
640 | 640 | }) |
641 | 641 | |
642 | - this.exInterface.createInstance('first', message1) | |
643 | - this.exInterface.createInstance('second', message2) | |
642 | + this.kernel.createInstance('first', message1) | |
643 | + this.kernel.createInstance('second', message2) | |
644 | 644 | |
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()) | |
647 | 647 | |
648 | - this.exInterface.incrementTicks(6) | |
648 | + this.kernel.incrementTicks(6) | |
649 | 649 | } else if (runs === 1) { |
650 | 650 | runs++ |
651 | 651 | t.equals(m.data, 'first', 'should recive the first message') |
652 | 652 | } else if (runs === 2) { |
@@ -656,19 +656,19 @@ | ||
656 | 656 | } |
657 | 657 | |
658 | 658 | class First extends BaseContainer { |
659 | 659 | 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({ | |
662 | 662 | data: 'first' |
663 | 663 | })) |
664 | 664 | } |
665 | 665 | } |
666 | 666 | |
667 | 667 | class Second extends BaseContainer { |
668 | 668 | 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({ | |
671 | 671 | data: 'second' |
672 | 672 | })) |
673 | 673 | } |
674 | 674 | } |
@@ -697,19 +697,19 @@ | ||
697 | 697 | let instance |
698 | 698 | |
699 | 699 | class Root extends BaseContainer { |
700 | 700 | run (m) { |
701 | - let one = this.exInterface.ports.get('one') | |
701 | + let one = this.kernel.ports.get('one') | |
702 | 702 | 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({ | |
706 | 706 | ports: [portRef2] |
707 | 707 | }) |
708 | - this.exInterface.createInstance('first', message1) | |
708 | + this.kernel.createInstance('first', message1) | |
709 | 709 | } 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()) | |
712 | 712 | } |
713 | 713 | } |
714 | 714 | } |
715 | 715 | |
@@ -790,24 +790,24 @@ | ||
790 | 790 | '/': 'zdpuB2QXxn1KQtLFfBqaritTRoe5BuKP5sNFSrPtRT6sxkY7Z' |
791 | 791 | } |
792 | 792 | class Root extends BaseContainer { |
793 | 793 | 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({ | |
797 | 797 | ports: [portRef2] |
798 | 798 | }) |
799 | 799 | |
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) | |
803 | 803 | } |
804 | 804 | } |
805 | 805 | |
806 | 806 | class First extends BaseContainer { |
807 | 807 | run (m) { |
808 | - this.exInterface.incrementTicks(2) | |
809 | - this.exInterface.ports.delete('root') | |
808 | + this.kernel.incrementTicks(2) | |
809 | + this.kernel.ports.delete('root') | |
810 | 810 | } |
811 | 811 | } |
812 | 812 | |
813 | 813 | const hypervisor = new Hypervisor(node.dag) |
@@ -836,9 +836,9 @@ | ||
836 | 836 | '/': 'zdpuB2QXxn1KQtLFfBqaritTRoe5BuKP5sNFSrPtRT6sxkY7Z' |
837 | 837 | } |
838 | 838 | class Root extends BaseContainer { |
839 | 839 | run (m) { |
840 | - this.exInterface.createInstance('root') | |
840 | + this.kernel.createInstance('root') | |
841 | 841 | } |
842 | 842 | } |
843 | 843 | |
844 | 844 | const hypervisor = new Hypervisor(node.dag) |
@@ -865,18 +865,18 @@ | ||
865 | 865 | '/': 'zdpuB2QXxn1KQtLFfBqaritTRoe5BuKP5sNFSrPtRT6sxkY7Z' |
866 | 866 | } |
867 | 867 | class Root extends BaseContainer { |
868 | 868 | 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({ | |
871 | 871 | ports: [portRef2] |
872 | 872 | })) |
873 | 873 | } |
874 | 874 | } |
875 | 875 | |
876 | 876 | class Sub extends BaseContainer { |
877 | 877 | initailize (message) { |
878 | - this.exInterface.ports.bind('root', message.ports[0]) | |
878 | + this.kernel.ports.bind('root', message.ports[0]) | |
879 | 879 | const [portRef1, portRef2] = root.ports.createChannel() |
880 | 880 | root.ports.bind('child', portRef1) |
881 | 881 | root.createInstance('root', root.createMessage({ |
882 | 882 | ports: [portRef2] |
@@ -909,24 +909,24 @@ | ||
909 | 909 | } |
910 | 910 | class Root extends BaseContainer { |
911 | 911 | run (m) { |
912 | 912 | 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') | |
916 | 916 | } 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({ | |
919 | 919 | ports: [portRef2] |
920 | 920 | })) |
921 | - this.exInterface.ports.bind('test1', portRef1) | |
921 | + this.kernel.ports.bind('test1', portRef1) | |
922 | 922 | |
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({ | |
925 | 925 | ports: [portRef4] |
926 | 926 | })) |
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({ | |
929 | 929 | data: 'getChannel' |
930 | 930 | })) |
931 | 931 | } |
932 | 932 | } |
@@ -934,16 +934,16 @@ | ||
934 | 934 | |
935 | 935 | class Sub extends BaseContainer { |
936 | 936 | run (message) { |
937 | 937 | 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({ | |
941 | 941 | data: 'bindPort', |
942 | 942 | ports: [ports[1]] |
943 | 943 | })) |
944 | 944 | } else if (message.data === 'bindPort') { |
945 | - this.exInterface.ports.bind('channel', message.ports[0]) | |
945 | + this.kernel.ports.bind('channel', message.ports[0]) | |
946 | 946 | } |
947 | 947 | } |
948 | 948 | } |
949 | 949 | |
@@ -973,25 +973,25 @@ | ||
973 | 973 | } |
974 | 974 | class Root extends BaseContainer { |
975 | 975 | run (m) { |
976 | 976 | 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') | |
981 | 981 | } 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({ | |
984 | 984 | ports: [portRef2] |
985 | 985 | })) |
986 | - this.exInterface.ports.bind('test1', portRef1) | |
986 | + this.kernel.ports.bind('test1', portRef1) | |
987 | 987 | |
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({ | |
990 | 990 | ports: [portRef4] |
991 | 991 | })) |
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({ | |
994 | 994 | data: 'getChannel' |
995 | 995 | })) |
996 | 996 | } |
997 | 997 | } |
@@ -999,16 +999,16 @@ | ||
999 | 999 | |
1000 | 1000 | class Sub extends BaseContainer { |
1001 | 1001 | run (message) { |
1002 | 1002 | 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({ | |
1006 | 1006 | data: 'bindPort', |
1007 | 1007 | ports: [ports[1]] |
1008 | 1008 | })) |
1009 | 1009 | } else if (message.data === 'bindPort') { |
1010 | - this.exInterface.ports.bind('channel', message.ports[0]) | |
1010 | + this.kernel.ports.bind('channel', message.ports[0]) | |
1011 | 1011 | } |
1012 | 1012 | } |
1013 | 1013 | } |
1014 | 1014 |
Built with git-ssb-web