polyphony 0.27 → 0.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -1
- data/CHANGELOG.md +13 -0
- data/Gemfile +12 -1
- data/Gemfile.lock +83 -5
- data/Rakefile +4 -0
- data/TODO.md +11 -20
- data/docs/_config.yml +15 -0
- data/docs/_includes/nav.html +47 -0
- data/docs/_sass/custom/custom.scss +5 -0
- data/docs/_sass/overrides.scss +45 -0
- data/docs/assets/img/echo-fibers.svg +1 -0
- data/docs/assets/img/sleeping-fiber.svg +1 -0
- data/docs/faq.md +182 -0
- data/docs/getting-started/installing.md +10 -2
- data/docs/getting-started/tutorial.md +333 -26
- data/docs/getting-started.md +10 -0
- data/docs/index.md +91 -0
- data/docs/technical-overview/concurrency.md +78 -16
- data/docs/technical-overview/design-principles.md +7 -0
- data/docs/technical-overview/exception-handling.md +57 -9
- data/docs/technical-overview/extending.md +7 -0
- data/docs/technical-overview/fiber-scheduling.md +128 -18
- data/docs/technical-overview.md +10 -0
- data/docs/user-guide/web-server.md +7 -0
- data/docs/user-guide.md +10 -0
- data/examples/core/xx-deadlock.rb +8 -0
- data/examples/core/xx-state-machine.rb +51 -0
- data/examples/core/xx-trace.rb +80 -0
- data/examples/interfaces/pg_notify.rb +35 -0
- data/examples/io/xx-httparty.rb +31 -6
- data/examples/io/xx-irb.rb +1 -11
- data/examples/io/xx-switch.rb +15 -0
- data/ext/gyro/gyro.c +77 -38
- data/ext/gyro/gyro.h +15 -5
- data/ext/gyro/gyro_ext.c +3 -0
- data/ext/gyro/thread.c +47 -32
- data/ext/gyro/tracing.c +11 -0
- data/lib/polyphony/core/global_api.rb +11 -4
- data/lib/polyphony/core/supervisor.rb +1 -0
- data/lib/polyphony/core/thread_pool.rb +44 -35
- data/lib/polyphony/extensions/fiber.rb +19 -9
- data/lib/polyphony/extensions/io.rb +14 -14
- data/lib/polyphony/extensions/socket.rb +3 -3
- data/lib/polyphony/irb.rb +13 -0
- data/lib/polyphony/postgres.rb +15 -0
- data/lib/polyphony/trace.rb +98 -0
- data/lib/polyphony/version.rb +1 -1
- data/lib/polyphony.rb +1 -0
- data/polyphony.gemspec +21 -12
- data/test/helper.rb +3 -2
- data/test/test_fiber.rb +53 -3
- data/test/test_global_api.rb +12 -0
- data/test/test_gyro.rb +2 -2
- data/test/test_supervisor.rb +12 -0
- data/test/test_thread.rb +12 -0
- data/test/test_thread_pool.rb +75 -0
- data/test/test_throttler.rb +6 -0
- data/test/test_trace.rb +66 -0
- metadata +99 -9
- data/docs/README.md +0 -36
- data/docs/summary.md +0 -60
- data/docs/technical-overview/faq.md +0 -97
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96b63d0e57950ea2983cfadab521cceaba97180fce4269575715a856d1beebdd
|
4
|
+
data.tar.gz: 42580ebe9a11620cc546474837983ae959aa239fba3a0c926eb62a40d9b66773
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4f4f02373ff3f9f1780a90b5df09bdd8efc95dbe28bed7787915a474961fe1f687baeb6cf46431eda65a6719c9e98a46b44807d71496723d84fbe7b0841a582
|
7
|
+
data.tar.gz: 1582cdfa47593230dc64f1676a514cea09e36db37048e138f41f75a626a91acac0e6dd34d6962597b4016a57afb125a9913c1111474f3470543e75f1b4915b88
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
0.28 2020-01-27
|
2
|
+
---------------
|
3
|
+
|
4
|
+
* Accept block in Supervisor#initialize
|
5
|
+
* Refactor `ThreadPool`
|
6
|
+
* Implement fiber switch events for `TracePoint`
|
7
|
+
* Add optional tag parameter to #spin
|
8
|
+
* Correctly increment ref count for indefinite sleep
|
9
|
+
* Add `irb` adapter
|
10
|
+
* Add support for listen/notify to postgres adapter
|
11
|
+
* Use `:waiting`, `:runnable`, `:running`, `:dead` for fiber states
|
12
|
+
* Move docs to https://digital-fabric.github.io/polyphony/
|
13
|
+
|
1
14
|
0.27 2020-01-19
|
2
15
|
---------------
|
3
16
|
|
data/Gemfile
CHANGED
@@ -1,3 +1,14 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gemspec
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
# gem "jekyll", "~> 3.8.6"
|
6
|
+
# gem "jekyll-remote-theme"
|
7
|
+
# gem "jekyll-seo-tag"
|
8
|
+
# gem "just-the-docs"
|
9
|
+
|
10
|
+
# # gem "github-pages", group: :jekyll_plugins
|
11
|
+
|
12
|
+
# group :jekyll_plugins do
|
13
|
+
# gem "jekyll-feed", "~> 0.6"
|
14
|
+
# end
|
data/Gemfile.lock
CHANGED
@@ -1,26 +1,73 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
polyphony (0.
|
4
|
+
polyphony (0.28)
|
5
5
|
modulation (~> 1.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
+
addressable (2.7.0)
|
11
|
+
public_suffix (>= 2.0.2, < 5.0)
|
10
12
|
ansi (1.5.0)
|
13
|
+
ast (2.4.0)
|
11
14
|
builder (3.2.4)
|
15
|
+
colorator (1.1.0)
|
16
|
+
concurrent-ruby (1.1.5)
|
12
17
|
docile (1.3.2)
|
18
|
+
em-websocket (0.5.1)
|
19
|
+
eventmachine (>= 0.12.9)
|
20
|
+
http_parser.rb (~> 0.6.0)
|
21
|
+
eventmachine (1.2.7)
|
22
|
+
ffi (1.12.1)
|
23
|
+
forwardable-extended (2.6.0)
|
13
24
|
hiredis (0.6.3)
|
14
25
|
http_parser.rb (0.6.0)
|
15
26
|
httparty (0.17.0)
|
16
27
|
mime-types (~> 3.0)
|
17
28
|
multi_xml (>= 0.5.2)
|
18
|
-
|
29
|
+
i18n (0.9.5)
|
30
|
+
concurrent-ruby (~> 1.0)
|
31
|
+
jaro_winkler (1.5.4)
|
32
|
+
jekyll (3.8.6)
|
33
|
+
addressable (~> 2.4)
|
34
|
+
colorator (~> 1.0)
|
35
|
+
em-websocket (~> 0.5)
|
36
|
+
i18n (~> 0.7)
|
37
|
+
jekyll-sass-converter (~> 1.0)
|
38
|
+
jekyll-watch (~> 2.0)
|
39
|
+
kramdown (~> 1.14)
|
40
|
+
liquid (~> 4.0)
|
41
|
+
mercenary (~> 0.3.3)
|
42
|
+
pathutil (~> 0.9)
|
43
|
+
rouge (>= 1.7, < 4)
|
44
|
+
safe_yaml (~> 1.0)
|
45
|
+
jekyll-remote-theme (0.4.1)
|
46
|
+
addressable (~> 2.0)
|
47
|
+
jekyll (>= 3.5, < 5.0)
|
48
|
+
rubyzip (>= 1.3.0)
|
49
|
+
jekyll-sass-converter (1.5.2)
|
50
|
+
sass (~> 3.4)
|
51
|
+
jekyll-seo-tag (2.6.1)
|
52
|
+
jekyll (>= 3.3, < 5.0)
|
53
|
+
jekyll-watch (2.2.1)
|
54
|
+
listen (~> 3.0)
|
55
|
+
json (2.3.0)
|
56
|
+
just-the-docs (0.2.7)
|
57
|
+
jekyll (~> 3.8.5)
|
58
|
+
jekyll-seo-tag (~> 2.0)
|
59
|
+
rake (~> 12.3.1)
|
60
|
+
kramdown (1.17.0)
|
61
|
+
liquid (4.0.3)
|
62
|
+
listen (3.2.1)
|
63
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
64
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
19
65
|
localhost (1.1.4)
|
66
|
+
mercenary (0.3.6)
|
20
67
|
mime-types (3.3.1)
|
21
68
|
mime-types-data (~> 3.2015)
|
22
69
|
mime-types-data (3.2019.1009)
|
23
|
-
minitest (5.
|
70
|
+
minitest (5.13.0)
|
24
71
|
minitest-reporters (1.4.2)
|
25
72
|
ansi
|
26
73
|
builder
|
@@ -28,17 +75,43 @@ GEM
|
|
28
75
|
ruby-progressbar
|
29
76
|
modulation (1.0)
|
30
77
|
multi_xml (0.6.0)
|
78
|
+
parallel (1.19.1)
|
79
|
+
parser (2.7.0.2)
|
80
|
+
ast (~> 2.4.0)
|
81
|
+
pathutil (0.16.2)
|
82
|
+
forwardable-extended (~> 2.6)
|
31
83
|
pg (1.1.3)
|
32
|
-
|
84
|
+
public_suffix (4.0.3)
|
85
|
+
rainbow (3.0.0)
|
86
|
+
rake (12.3.3)
|
33
87
|
rake-compiler (1.0.5)
|
34
88
|
rake
|
89
|
+
rb-fsevent (0.10.3)
|
90
|
+
rb-inotify (0.10.1)
|
91
|
+
ffi (~> 1.0)
|
35
92
|
redis (4.1.0)
|
93
|
+
rouge (3.15.0)
|
94
|
+
rubocop (0.79.0)
|
95
|
+
jaro_winkler (~> 1.5.1)
|
96
|
+
parallel (~> 1.10)
|
97
|
+
parser (>= 2.7.0.1)
|
98
|
+
rainbow (>= 2.2.2, < 4.0)
|
99
|
+
ruby-progressbar (~> 1.7)
|
100
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
36
101
|
ruby-progressbar (1.10.1)
|
102
|
+
rubyzip (2.0.0)
|
103
|
+
safe_yaml (1.0.5)
|
104
|
+
sass (3.7.4)
|
105
|
+
sass-listen (~> 4.0.0)
|
106
|
+
sass-listen (4.0.0)
|
107
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
108
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
37
109
|
simplecov (0.17.1)
|
38
110
|
docile (~> 1.1)
|
39
111
|
json (>= 1.8, < 3)
|
40
112
|
simplecov-html (~> 0.10.0)
|
41
113
|
simplecov-html (0.10.2)
|
114
|
+
unicode-display_width (1.6.1)
|
42
115
|
|
43
116
|
PLATFORMS
|
44
117
|
ruby
|
@@ -47,13 +120,18 @@ DEPENDENCIES
|
|
47
120
|
hiredis (= 0.6.3)
|
48
121
|
http_parser.rb (~> 0.6.0)
|
49
122
|
httparty (= 0.17.0)
|
123
|
+
jekyll (~> 3.8.6)
|
124
|
+
jekyll-remote-theme (~> 0.4.1)
|
125
|
+
jekyll-seo-tag (~> 2.6.1)
|
126
|
+
just-the-docs (~> 0.2.7)
|
50
127
|
localhost (= 1.1.4)
|
51
|
-
minitest (= 5.
|
128
|
+
minitest (= 5.13.0)
|
52
129
|
minitest-reporters (= 1.4.2)
|
53
130
|
pg (= 1.1.3)
|
54
131
|
polyphony!
|
55
132
|
rake-compiler (= 1.0.5)
|
56
133
|
redis (= 4.1.0)
|
134
|
+
rubocop (= 0.79.0)
|
57
135
|
simplecov (= 0.17.1)
|
58
136
|
|
59
137
|
BUNDLED WITH
|
data/Rakefile
CHANGED
data/TODO.md
CHANGED
@@ -1,16 +1,18 @@
|
|
1
|
-
## 0.
|
1
|
+
## 0.29 Multithreaded fiber scheduling - some rough corners
|
2
2
|
|
3
|
+
- Docs: explain difference between `sleep` and `suspend`
|
4
|
+
- Write about threads: scheduling, etc
|
3
5
|
- `Gyro_schedule_fiber` - schedule using fiber's associated thread (store thread
|
4
6
|
ref in fiber), instead of current thread
|
5
7
|
- Check why first call to `#sleep` returns too early in tests. Check the
|
6
8
|
sleep behaviour in a spawned thread.
|
7
9
|
|
8
|
-
## 0.
|
10
|
+
## 0.30 Working Sinatra application
|
9
11
|
|
10
12
|
- app with database access (postgresql)
|
11
13
|
- benchmarks!
|
12
14
|
|
13
|
-
## 0.
|
15
|
+
## 0.31 Sidekick
|
14
16
|
|
15
17
|
Plan of action:
|
16
18
|
|
@@ -18,13 +20,13 @@ Plan of action:
|
|
18
20
|
- test performance
|
19
21
|
- proceed from there
|
20
22
|
|
21
|
-
## 0.
|
23
|
+
## 0.32 Testing && Docs
|
22
24
|
|
23
25
|
- Pull out redis/postgres code, put into new `polyphony-xxx` gems
|
24
26
|
|
25
|
-
## 0.
|
27
|
+
## 0.33 Integration
|
26
28
|
|
27
|
-
## 0.
|
29
|
+
## 0.34 Real IO#gets and IO#read
|
28
30
|
|
29
31
|
- More tests
|
30
32
|
- Implement some basic stuff missing:
|
@@ -34,24 +36,13 @@ Plan of action:
|
|
34
36
|
- `IO.foreach`
|
35
37
|
- `Process.waitpid`
|
36
38
|
|
37
|
-
## 0.
|
38
|
-
|
39
|
-
- Move fiber scheduling to the `Thread` class
|
40
|
-
- Gyro selector conforming to the selector interface:
|
41
|
-
|
42
|
-
```ruby
|
43
|
-
class Selector
|
44
|
-
def wait
|
45
|
-
end
|
46
|
-
```
|
47
|
-
|
48
|
-
- Better separation between
|
39
|
+
## 0.35 Rails
|
49
40
|
|
50
41
|
- Rails?
|
51
42
|
|
52
|
-
|
43
|
+
## 0.36 DNS
|
53
44
|
|
54
|
-
|
45
|
+
### DNS client
|
55
46
|
|
56
47
|
```ruby
|
57
48
|
ip_address = DNS.lookup('google.com', 'A')
|
data/docs/_config.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
title: "Polyphony"
|
2
|
+
|
3
|
+
remote_theme: pmarsceill/just-the-docs
|
4
|
+
color_scheme: nil
|
5
|
+
|
6
|
+
search_enabled: true
|
7
|
+
# Enable support for hyphenated search words:
|
8
|
+
search_tokenizer_separator: /[\s/]+/
|
9
|
+
|
10
|
+
plugins:
|
11
|
+
- jekyll-remote-theme
|
12
|
+
|
13
|
+
aux_links:
|
14
|
+
"Polyphony on GitHub":
|
15
|
+
- "//github.com/digital-fabric/polyphony"
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<nav role="navigation" aria-label="Main navigation">
|
2
|
+
<ul class="navigation-list">
|
3
|
+
{%- assign pages_list = site.html_pages | sort:"nav_order" -%}
|
4
|
+
{%- for node in pages_list -%}
|
5
|
+
{%- unless node.nav_exclude -%}
|
6
|
+
{%- if node.parent == nil -%}
|
7
|
+
<li class="navigation-list-item
|
8
|
+
{% if page.url == node.url %} active{% endif %}
|
9
|
+
{% if node.section %}section-title{% endif %}
|
10
|
+
">
|
11
|
+
{%- if page.parent == node.title or page.grand_parent == node.title -%}
|
12
|
+
{%- assign first_level_url = node.section_link | node.url | absolute_url -%}
|
13
|
+
{%- endif -%}
|
14
|
+
{%- if node.section -%}
|
15
|
+
<span class="section-title">{{ node.title }}</span>
|
16
|
+
{%- else -%}
|
17
|
+
<a href="{{ node.url | absolute_url }}" class="navigation-list-link{% if page.url == node.url %} active{% endif %}">{{ node.title }}</a>
|
18
|
+
{%- endif -%}
|
19
|
+
{%- if node.has_children -%}
|
20
|
+
{%- assign children_list = site.html_pages | where: "parent", node.title | sort:"nav_order" -%}
|
21
|
+
<ul class="navigation-list-child-list ">
|
22
|
+
{%- for child in children_list -%}
|
23
|
+
<li class="navigation-list-item {% if page.url == child.url or page.parent == child.title %} active{% endif %}">
|
24
|
+
{%- if page.url == child.url or page.parent == child.title -%}
|
25
|
+
{%- assign second_level_url = child.url | absolute_url -%}
|
26
|
+
{%- endif -%}
|
27
|
+
<a href="{{ child.url | absolute_url }}" class="navigation-list-link{% if page.url == child.url %} active{% endif %}">{{ child.title }}</a>
|
28
|
+
{%- if child.has_children -%}
|
29
|
+
{%- assign grand_children_list = site.html_pages | where: "parent", child.title | sort:"nav_order" -%}
|
30
|
+
<ul class="navigation-list-child-list">
|
31
|
+
{%- for grand_child in grand_children_list -%}
|
32
|
+
<li class="navigation-list-item {% if page.url == grand_child.url %} active{% endif %}">
|
33
|
+
<a href="{{ grand_child.url | absolute_url }}" class="navigation-list-link{% if page.url == grand_child.url %} active{% endif %}">{{ grand_child.title }}</a>
|
34
|
+
</li>
|
35
|
+
{%- endfor -%}
|
36
|
+
</ul>
|
37
|
+
{%- endif -%}
|
38
|
+
</li>
|
39
|
+
{%- endfor -%}
|
40
|
+
</ul>
|
41
|
+
{%- endif -%}
|
42
|
+
</li>
|
43
|
+
{%- endif -%}
|
44
|
+
{%- endunless -%}
|
45
|
+
{%- endfor -%}
|
46
|
+
</ul>
|
47
|
+
</nav>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
.navigation-list-item.section-title {
|
2
|
+
padding-top: 0.75em;
|
3
|
+
padding-bottom: 0.75em;
|
4
|
+
}
|
5
|
+
|
6
|
+
span.section-title {
|
7
|
+
text-transform: uppercase;
|
8
|
+
font-weight: bold;
|
9
|
+
color: #888;
|
10
|
+
}
|
11
|
+
|
12
|
+
.navigation-list-item .navigation-list-child-list {
|
13
|
+
display: block;
|
14
|
+
}
|
15
|
+
|
16
|
+
.navigation-list-child-list {
|
17
|
+
padding-left: 0;
|
18
|
+
|
19
|
+
.navigation-list-item {
|
20
|
+
position: relative;
|
21
|
+
|
22
|
+
&::before {
|
23
|
+
position: absolute;
|
24
|
+
margin-top: 0.3em;
|
25
|
+
margin-left: -0.8em;
|
26
|
+
color: rgba($body-text-color, 0.3);
|
27
|
+
content: "";
|
28
|
+
}
|
29
|
+
|
30
|
+
&.active {
|
31
|
+
&::before {
|
32
|
+
color: $body-text-color;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
a.navigation-list-link {
|
39
|
+
color: $nav-child-link-color;
|
40
|
+
font-weight: 600;
|
41
|
+
}
|
42
|
+
|
43
|
+
a.navigation-list-link:hover {
|
44
|
+
color: $link-color;
|
45
|
+
}
|