anycable 0.5.2 → 0.6.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE.md +25 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +31 -0
- data/.rubocop.yml +22 -22
- data/.travis.yml +1 -2
- data/CHANGELOG.md +92 -0
- data/README.md +10 -58
- data/anycable.gemspec +10 -7
- data/benchmarks/.gitignore +1 -0
- data/benchmarks/2018-10-27.md +181 -0
- data/benchmarks/assets/2018-10-27-action-cable-rss.png +0 -0
- data/benchmarks/assets/2018-10-27-action-cable-rtt.png +0 -0
- data/benchmarks/assets/2018-10-27-anycable-rss.png +0 -0
- data/benchmarks/assets/2018-10-27-anycable-rtt.png +0 -0
- data/benchmarks/assets/2018-10-27-async-rss.png +0 -0
- data/benchmarks/assets/2018-10-27-async-rtt.png +0 -0
- data/benchmarks/assets/2018-10-27-falcon-cable-rss.png +0 -0
- data/benchmarks/assets/2018-10-27-falcon-cable-rtt.png +0 -0
- data/benchmarks/assets/2018-10-27-iodine-cable-rss.png +0 -0
- data/benchmarks/assets/2018-10-27-iodine-cable-rtt.png +0 -0
- data/benchmarks/assets/2018-10-27-plezi-rss.png +0 -0
- data/benchmarks/assets/2018-10-27-plezi-rtt.png +0 -0
- data/benchmarks/bench.png +0 -0
- data/benchmarks/benchmark.yml +12 -10
- data/benchmarks/hosts +2 -2
- data/benchmarks/rtt_plot.py +74 -0
- data/benchmarks/rtt_plot_test.py +16 -0
- data/benchmarks/servers.yml +25 -3
- data/bin/anycable +13 -0
- data/etc/bug_report_template.rb +1 -1
- data/lib/anycable.rb +53 -16
- data/lib/anycable/broadcast_adapters.rb +33 -0
- data/lib/anycable/broadcast_adapters/redis.rb +42 -0
- data/lib/anycable/cli.rb +323 -0
- data/lib/anycable/config.rb +91 -17
- data/lib/anycable/exceptions_handling.rb +31 -0
- data/lib/anycable/handler/capture_exceptions.rb +39 -0
- data/lib/anycable/health_server.rb +53 -31
- data/lib/anycable/middleware.rb +19 -0
- data/lib/anycable/middleware_chain.rb +58 -0
- data/lib/anycable/rpc/rpc_pb.rb +1 -1
- data/lib/anycable/rpc/rpc_services_pb.rb +1 -1
- data/lib/anycable/rpc_handler.rb +28 -26
- data/lib/anycable/server.rb +114 -39
- data/lib/anycable/socket.rb +1 -1
- data/lib/anycable/version.rb +2 -2
- metadata +45 -26
- data/lib/anycable/handler/exceptions_handling.rb +0 -43
- data/lib/anycable/pubsub.rb +0 -26
data/lib/anycable/socket.rb
CHANGED
data/lib/anycable/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anycable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- palkan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: anyway_config
|
@@ -16,48 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 1.1.1
|
19
|
+
version: 1.4.1
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
30
|
-
- - ">="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 1.1.1
|
26
|
+
version: 1.4.1
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: grpc
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
31
|
- - "~>"
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
version: '1.
|
33
|
+
version: '1.15'
|
40
34
|
type: :runtime
|
41
35
|
prerelease: false
|
42
36
|
version_requirements: !ruby/object:Gem::Requirement
|
43
37
|
requirements:
|
44
38
|
- - "~>"
|
45
39
|
- !ruby/object:Gem::Version
|
46
|
-
version: '1.
|
40
|
+
version: '1.15'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: redis
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
50
44
|
requirements:
|
51
45
|
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
54
|
-
type: :
|
47
|
+
version: '4.0'
|
48
|
+
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
51
|
requirements:
|
58
52
|
- - ">="
|
59
53
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
54
|
+
version: '4.0'
|
61
55
|
- !ruby/object:Gem::Dependency
|
62
56
|
name: bundler
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,14 +114,14 @@ dependencies:
|
|
120
114
|
requirements:
|
121
115
|
- - "~>"
|
122
116
|
- !ruby/object:Gem::Version
|
123
|
-
version: 0.
|
117
|
+
version: 0.60.0
|
124
118
|
type: :development
|
125
119
|
prerelease: false
|
126
120
|
version_requirements: !ruby/object:Gem::Requirement
|
127
121
|
requirements:
|
128
122
|
- - "~>"
|
129
123
|
- !ruby/object:Gem::Version
|
130
|
-
version: 0.
|
124
|
+
version: 0.60.0
|
131
125
|
- !ruby/object:Gem::Dependency
|
132
126
|
name: simplecov
|
133
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,13 +150,16 @@ dependencies:
|
|
156
150
|
- - ">="
|
157
151
|
- !ruby/object:Gem::Version
|
158
152
|
version: '0'
|
159
|
-
description:
|
153
|
+
description: AnyCable is a polyglot replacement for ActionCable-compatible servers
|
160
154
|
email:
|
161
155
|
- dementiev.vm@gmail.com
|
162
|
-
executables:
|
156
|
+
executables:
|
157
|
+
- anycable
|
163
158
|
extensions: []
|
164
159
|
extra_rdoc_files: []
|
165
160
|
files:
|
161
|
+
- ".github/ISSUE_TEMPLATE.md"
|
162
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
166
163
|
- ".gitignore"
|
167
164
|
- ".hound.yml"
|
168
165
|
- ".rubocop.yml"
|
@@ -189,20 +186,42 @@ files:
|
|
189
186
|
- benchmarks/2017-02-12.md
|
190
187
|
- benchmarks/2018-03-04.md
|
191
188
|
- benchmarks/2018-05-27-rpc-bench.md
|
189
|
+
- benchmarks/2018-10-27.md
|
192
190
|
- benchmarks/HowTo.md
|
193
191
|
- benchmarks/ansible.cfg
|
192
|
+
- benchmarks/assets/2018-10-27-action-cable-rss.png
|
193
|
+
- benchmarks/assets/2018-10-27-action-cable-rtt.png
|
194
|
+
- benchmarks/assets/2018-10-27-anycable-rss.png
|
195
|
+
- benchmarks/assets/2018-10-27-anycable-rtt.png
|
196
|
+
- benchmarks/assets/2018-10-27-async-rss.png
|
197
|
+
- benchmarks/assets/2018-10-27-async-rtt.png
|
198
|
+
- benchmarks/assets/2018-10-27-falcon-cable-rss.png
|
199
|
+
- benchmarks/assets/2018-10-27-falcon-cable-rtt.png
|
200
|
+
- benchmarks/assets/2018-10-27-iodine-cable-rss.png
|
201
|
+
- benchmarks/assets/2018-10-27-iodine-cable-rtt.png
|
202
|
+
- benchmarks/assets/2018-10-27-plezi-rss.png
|
203
|
+
- benchmarks/assets/2018-10-27-plezi-rtt.png
|
204
|
+
- benchmarks/bench.png
|
194
205
|
- benchmarks/benchmark.yml
|
195
206
|
- benchmarks/hosts
|
207
|
+
- benchmarks/rtt_plot.py
|
208
|
+
- benchmarks/rtt_plot_test.py
|
196
209
|
- benchmarks/servers.yml
|
210
|
+
- bin/anycable
|
197
211
|
- bin/console
|
198
212
|
- bin/setup
|
199
213
|
- circle.yml
|
200
214
|
- etc/bug_report_template.rb
|
201
215
|
- lib/anycable.rb
|
216
|
+
- lib/anycable/broadcast_adapters.rb
|
217
|
+
- lib/anycable/broadcast_adapters/redis.rb
|
218
|
+
- lib/anycable/cli.rb
|
202
219
|
- lib/anycable/config.rb
|
203
|
-
- lib/anycable/
|
220
|
+
- lib/anycable/exceptions_handling.rb
|
221
|
+
- lib/anycable/handler/capture_exceptions.rb
|
204
222
|
- lib/anycable/health_server.rb
|
205
|
-
- lib/anycable/
|
223
|
+
- lib/anycable/middleware.rb
|
224
|
+
- lib/anycable/middleware_chain.rb
|
206
225
|
- lib/anycable/rpc/rpc_pb.rb
|
207
226
|
- lib/anycable/rpc/rpc_services_pb.rb
|
208
227
|
- lib/anycable/rpc_handler.rb
|
@@ -222,16 +241,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
222
241
|
requirements:
|
223
242
|
- - ">="
|
224
243
|
- !ruby/object:Gem::Version
|
225
|
-
version:
|
244
|
+
version: 2.4.0
|
226
245
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
246
|
requirements:
|
228
|
-
- - "
|
247
|
+
- - ">"
|
229
248
|
- !ruby/object:Gem::Version
|
230
|
-
version:
|
249
|
+
version: 1.3.1
|
231
250
|
requirements: []
|
232
251
|
rubyforge_project:
|
233
|
-
rubygems_version: 2.7.
|
252
|
+
rubygems_version: 2.7.7
|
234
253
|
signing_key:
|
235
254
|
specification_version: 4
|
236
|
-
summary:
|
255
|
+
summary: AnyCable is a polyglot replacement for ActionCable-compatible servers
|
237
256
|
test_files: []
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Anycable
|
4
|
-
module Handler # :nodoc:
|
5
|
-
# Handle app-level errors
|
6
|
-
module ExceptionsHandling
|
7
|
-
def connect(*)
|
8
|
-
super
|
9
|
-
rescue StandardError => ex
|
10
|
-
handle_exception(ex)
|
11
|
-
Anycable::ConnectionResponse.new(status: Anycable::Status::ERROR, error_msg: ex.message)
|
12
|
-
end
|
13
|
-
|
14
|
-
def disconnect(*)
|
15
|
-
super
|
16
|
-
rescue StandardError => ex
|
17
|
-
handle_exception(ex)
|
18
|
-
Anycable::DisconnectResponse.new(status: Anycable::Status::ERROR, error_msg: ex.message)
|
19
|
-
end
|
20
|
-
|
21
|
-
def command(*)
|
22
|
-
super
|
23
|
-
rescue StandardError => ex
|
24
|
-
handle_exception(ex)
|
25
|
-
Anycable::CommandResponse.new(status: Anycable::Status::ERROR, error_msg: ex.message)
|
26
|
-
end
|
27
|
-
|
28
|
-
def handle_exception(ex)
|
29
|
-
Anycable.error_handlers.each do |handler|
|
30
|
-
begin
|
31
|
-
handler.call(ex)
|
32
|
-
rescue StandardError => ex
|
33
|
-
Anycable.logger.error "!!! ERROR HANDLER THREW AN ERROR !!!"
|
34
|
-
Anycable.logger.error ex
|
35
|
-
Anycable.logger.error ex.backtrace.join("\n") unless ex.backtrace.nil?
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
Anycable.error_handlers << proc { |e| Anycable.logger.error(e.message) }
|
42
|
-
end
|
43
|
-
end
|
data/lib/anycable/pubsub.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "redis"
|
4
|
-
require "json"
|
5
|
-
|
6
|
-
module Anycable
|
7
|
-
# PubSub for broadcasting
|
8
|
-
class PubSub
|
9
|
-
attr_reader :redis_conn
|
10
|
-
|
11
|
-
def initialize
|
12
|
-
redis_config = { url: Anycable.config.redis_url }
|
13
|
-
unless Anycable.config.redis_sentinels.empty?
|
14
|
-
redis_config[:sentinels] = Anycable.config.redis_sentinels
|
15
|
-
end
|
16
|
-
@redis_conn = Redis.new(redis_config)
|
17
|
-
end
|
18
|
-
|
19
|
-
def broadcast(channel, payload)
|
20
|
-
redis_conn.publish(
|
21
|
-
Anycable.config.redis_channel,
|
22
|
-
{ stream: channel, data: payload }.to_json
|
23
|
-
)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|