git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 186843b537fb56c4bd7ddada96ebc089fcc3bde1

Merge pull request #123 from primea/responses

added scheduler docs
wanderer authored on 7/5/2017, 3:50:29 AM
GitHub committed on 7/5/2017, 3:50:29 AM
Parent: 9a0bad1da1b9cc9d1325ef5969e55d9e5bbe3602
Parent: 5ffd9fccb98bf042c2c2cce718f598e7708efcf4

Files changed

docs/scheduler.mdadded
tests/index.jschanged
docs/scheduler.mdView
@@ -1,0 +1,84 @@
1+<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
2+
3+### Table of Contents
4+
5+- [constructor](#constructor)
6+- [getLock](#getlock)
7+- [update](#update)
8+- [getInstance](#getinstance)
9+- [done](#done)
10+- [wait](#wait)
11+- [oldest](#oldest)
12+
13+## constructor
14+
15+[scheduler.js:8-13](https://github.com/primea/js-primea-hypervisor/blob/317d79e49cb56dd81cb9c94072cd24ad6a825757/scheduler.js#L8-L13 "Source code on GitHub")
16+
17+The Sceduler manages the run cycle of the containes and figures out which
18+order they should run in
19+
20+## getLock
21+
22+[scheduler.js:20-30](https://github.com/primea/js-primea-hypervisor/blob/317d79e49cb56dd81cb9c94072cd24ad6a825757/scheduler.js#L20-L30 "Source code on GitHub")
23+
24+locks the scheduler from clearing waits untill the lock is resolved
25+
26+**Parameters**
27+
28+- `id` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
29+
30+Returns **[function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** the resolve function to call once it to unlock
31+
32+## update
33+
34+[scheduler.js:36-39](https://github.com/primea/js-primea-hypervisor/blob/317d79e49cb56dd81cb9c94072cd24ad6a825757/scheduler.js#L36-L39 "Source code on GitHub")
35+
36+updates an instance with a new tick count
37+
38+**Parameters**
39+
40+- `instance` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** a container instance
41+
42+## getInstance
43+
44+[scheduler.js:59-61](https://github.com/primea/js-primea-hypervisor/blob/317d79e49cb56dd81cb9c94072cd24ad6a825757/scheduler.js#L59-L61 "Source code on GitHub")
45+
46+returns a container
47+
48+**Parameters**
49+
50+- `id` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
51+
52+Returns **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
53+
54+## done
55+
56+[scheduler.js:67-71](https://github.com/primea/js-primea-hypervisor/blob/317d79e49cb56dd81cb9c94072cd24ad6a825757/scheduler.js#L67-L71 "Source code on GitHub")
57+
58+deletes an instance from the scheduler
59+
60+**Parameters**
61+
62+- `id` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the containers id
63+
64+## wait
65+
66+[scheduler.js:80-93](https://github.com/primea/js-primea-hypervisor/blob/317d79e49cb56dd81cb9c94072cd24ad6a825757/scheduler.js#L80-L93 "Source code on GitHub")
67+
68+returns a promise that resolves once all containers have reached the given
69+number of ticks
70+
71+**Parameters**
72+
73+- `ticks` **interger** the number of ticks to wait (optional, default `Infinity`)
74+- `id` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** optional id of the container that is waiting
75+
76+Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
77+
78+## oldest
79+
80+[scheduler.js:99-102](https://github.com/primea/js-primea-hypervisor/blob/317d79e49cb56dd81cb9c94072cd24ad6a825757/scheduler.js#L99-L102 "Source code on GitHub")
81+
82+returns the oldest container's ticks
83+
84+Returns **integer**
tests/index.jsView
@@ -499,9 +499,8 @@
499499
500500 class Second extends BaseContainer {
501501 run (m) {
502502 this.exInterface.incrementTicks(3)
503- console.log('sending second', this.exInterface.ticks)
504503 this.exInterface.send(m.fromPort, this.exInterface.createMessage({
505504 data: 'second'
506505 }))
507506 }

Built with git-ssb-web