rsmp 0.16.7 → 0.16.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/config/tlc.yaml +1 -1
- data/lib/rsmp/proxy.rb +13 -15
- data/lib/rsmp/site.rb +2 -2
- data/lib/rsmp/site_proxy.rb +2 -2
- data/lib/rsmp/supervisor.rb +5 -5
- data/lib/rsmp/supervisor_proxy.rb +16 -6
- data/lib/rsmp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4060389b1398d8bf006419c7536bced8d46dfdb2d6852fe1ce625d08f913eda
|
4
|
+
data.tar.gz: 4623b52e36898a400f82a7b9807c1437010e39509c91d3a693165a6766d75a84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8422abc49a3db9d5d9239612ff81af6cb741945e16231b96292c80bc1a6d2e072a62ddc204373a67efc3afbfb7eb9cafcbc3c060c292a589335ba6a13ed8f490
|
7
|
+
data.tar.gz: 5f8a271d7e76d0c0e710c457861a36260bfdd26fdbc69b66ea1035c6c6927512c1a5a8191f8e2ae0b87b763393e178fb0f72228a9d7574719bf2d6c411cff7c3
|
data/Gemfile.lock
CHANGED
data/config/tlc.yaml
CHANGED
data/lib/rsmp/proxy.rb
CHANGED
@@ -13,8 +13,7 @@ module RSMP
|
|
13
13
|
include Inspect
|
14
14
|
include Task
|
15
15
|
|
16
|
-
attr_reader :state, :archive, :connection_info, :sxl, :collector, :ip, :port, :node, :
|
17
|
-
|
16
|
+
attr_reader :state, :archive, :connection_info, :sxl, :collector, :ip, :port, :node, :core_version
|
18
17
|
def initialize options
|
19
18
|
@node = options[:node]
|
20
19
|
initialize_logging options
|
@@ -316,7 +315,7 @@ module RSMP
|
|
316
315
|
|
317
316
|
def get_schemas
|
318
317
|
schemas = { core: RSMP::Schema.latest_core_version } # use latest core
|
319
|
-
schemas[:core] =
|
318
|
+
schemas[:core] = core_version if core_version
|
320
319
|
schemas[sxl] = RSMP::Schema.sanitize_version(sxl_version.to_s) if sxl && sxl_version
|
321
320
|
schemas
|
322
321
|
end
|
@@ -455,18 +454,18 @@ module RSMP
|
|
455
454
|
dont_acknowledge message, "Received", "extraneous Version message"
|
456
455
|
end
|
457
456
|
|
458
|
-
def
|
459
|
-
return [RSMP::Schema.latest_core_version] if @site_settings["
|
460
|
-
return RSMP::Schema.core_versions if @site_settings["
|
461
|
-
[@site_settings["
|
457
|
+
def core_versions
|
458
|
+
return [RSMP::Schema.latest_core_version] if @site_settings["core_versions"] == 'latest'
|
459
|
+
return RSMP::Schema.core_versions if @site_settings["core_versions"] == 'all'
|
460
|
+
[@site_settings["core_versions"]].flatten
|
462
461
|
end
|
463
462
|
|
464
|
-
def
|
465
|
-
versions =
|
463
|
+
def check_core_version message
|
464
|
+
versions = core_versions
|
466
465
|
# find versions that both we and the client support
|
467
466
|
candidates = message.versions & versions
|
468
467
|
if candidates.any?
|
469
|
-
@
|
468
|
+
@core_version = candidates.sort_by { |v| Gem::Version.new(v) }.last # pick latest version
|
470
469
|
else
|
471
470
|
raise HandshakeError.new "RSMP versions [#{message.versions.join(',')}] requested, but only [#{versions.join(',')}] supported."
|
472
471
|
end
|
@@ -506,13 +505,13 @@ module RSMP
|
|
506
505
|
raise RSMP::TimeoutError.new "Did not reach state #{state} within #{timeout}s"
|
507
506
|
end
|
508
507
|
|
509
|
-
def send_version site_id,
|
510
|
-
if
|
508
|
+
def send_version site_id, core_versions
|
509
|
+
if core_versions=='latest'
|
511
510
|
versions = [RSMP::Schema.latest_core_version]
|
512
|
-
elsif
|
511
|
+
elsif core_versions=='all'
|
513
512
|
versions = RSMP::Schema.core_versions
|
514
513
|
else
|
515
|
-
versions = [
|
514
|
+
versions = [core_versions].flatten
|
516
515
|
end
|
517
516
|
versions_array = versions.map {|v| {"vers" => v} }
|
518
517
|
|
@@ -662,6 +661,5 @@ module RSMP
|
|
662
661
|
log "StatusSubscribe #{short} acknowledged, allowing repeated status values for #{subscribe_list}", level: :info
|
663
662
|
component.allow_repeat_updates subscribe_list
|
664
663
|
end
|
665
|
-
|
666
664
|
end
|
667
665
|
end
|
data/lib/rsmp/site.rb
CHANGED
@@ -6,7 +6,7 @@ module RSMP
|
|
6
6
|
class Site < Node
|
7
7
|
include Components
|
8
8
|
|
9
|
-
attr_reader :
|
9
|
+
attr_reader :core_versions, :site_settings, :logger, :proxies
|
10
10
|
|
11
11
|
def initialize options={}
|
12
12
|
super options
|
@@ -32,7 +32,7 @@ module RSMP
|
|
32
32
|
'supervisors' => [
|
33
33
|
{ 'ip' => '127.0.0.1', 'port' => 12111 }
|
34
34
|
],
|
35
|
-
'
|
35
|
+
'core_versions' => 'all',
|
36
36
|
'sxl' => 'tlc',
|
37
37
|
'sxl_version' => RSMP::Schema.latest_version(:tlc),
|
38
38
|
'intervals' => {
|
data/lib/rsmp/site_proxy.rb
CHANGED
@@ -48,7 +48,7 @@ module RSMP
|
|
48
48
|
def handshake_complete
|
49
49
|
super
|
50
50
|
sanitized_sxl_version = RSMP::Schema.sanitize_version(@site_sxl_version)
|
51
|
-
log "Connection to site #{@site_id} established, using core #{@
|
51
|
+
log "Connection to site #{@site_id} established, using core #{@core_version}, #{@sxl} #{sanitized_sxl_version}", level: :info
|
52
52
|
start_watchdog
|
53
53
|
end
|
54
54
|
|
@@ -89,7 +89,7 @@ module RSMP
|
|
89
89
|
log "Received Version message for site #{@site_id}", message: message, level: :log
|
90
90
|
start_timer
|
91
91
|
acknowledge message
|
92
|
-
send_version @site_id,
|
92
|
+
send_version @site_id, core_versions
|
93
93
|
@version_determined = true
|
94
94
|
end
|
95
95
|
|
data/lib/rsmp/supervisor.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
module RSMP
|
6
6
|
class Supervisor < Node
|
7
|
-
attr_reader :
|
7
|
+
attr_reader :core_versions, :site_id, :supervisor_settings, :proxies, :logger
|
8
8
|
|
9
9
|
def initialize options={}
|
10
10
|
handle_supervisor_settings( options[:supervisor_settings] || {} )
|
@@ -22,7 +22,7 @@ module RSMP
|
|
22
22
|
'port' => 12111,
|
23
23
|
'ips' => 'all',
|
24
24
|
'guest' => {
|
25
|
-
'
|
25
|
+
'core_versions' => 'all',
|
26
26
|
'sxl' => 'tlc',
|
27
27
|
'intervals' => {
|
28
28
|
'timer' => 1,
|
@@ -37,7 +37,7 @@ module RSMP
|
|
37
37
|
|
38
38
|
# merge options into defaults
|
39
39
|
@supervisor_settings = defaults.deep_merge(supervisor_settings)
|
40
|
-
@
|
40
|
+
@core_versions = @supervisor_settings["guest"]["core_versions"]
|
41
41
|
check_site_sxl_types
|
42
42
|
end
|
43
43
|
|
@@ -185,8 +185,8 @@ module RSMP
|
|
185
185
|
end
|
186
186
|
|
187
187
|
proxy.setup_site_settings
|
188
|
-
proxy.
|
189
|
-
log "Validating using core version #{proxy.
|
188
|
+
proxy.check_core_version version_message
|
189
|
+
log "Validating using core version #{proxy.core_version}", level: :debug
|
190
190
|
|
191
191
|
proxy.start # will run until the site disconnects
|
192
192
|
proxy.wait
|
@@ -43,7 +43,7 @@ module RSMP
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def start_handshake
|
46
|
-
send_version @site_settings['site_id'], @site_settings["
|
46
|
+
send_version @site_settings['site_id'], @site_settings["core_versions"]
|
47
47
|
end
|
48
48
|
|
49
49
|
# connect to the supervisor and initiate handshake supervisor
|
@@ -83,7 +83,7 @@ module RSMP
|
|
83
83
|
|
84
84
|
def handshake_complete
|
85
85
|
sanitized_sxl_version = RSMP::Schema.sanitize_version(sxl_version)
|
86
|
-
log "Connection to supervisor established, using core #{@
|
86
|
+
log "Connection to supervisor established, using core #{@core_version}, #{sxl} #{sanitized_sxl_version}", level: :info
|
87
87
|
set_state :ready
|
88
88
|
start_watchdog
|
89
89
|
if @site_settings['send_after_connect']
|
@@ -155,7 +155,7 @@ module RSMP
|
|
155
155
|
end
|
156
156
|
|
157
157
|
def version_accepted message
|
158
|
-
log "Received Version message, using RSMP #{@
|
158
|
+
log "Received Version message, using RSMP #{@core_version}", message: message, level: :log
|
159
159
|
start_timer
|
160
160
|
acknowledge message
|
161
161
|
@version_determined = true
|
@@ -276,13 +276,23 @@ module RSMP
|
|
276
276
|
v.to_s
|
277
277
|
end
|
278
278
|
|
279
|
+
# get name of q field, depending on the core version we're using
|
280
|
+
# it changed from 'ageState' to 'q' in version 3.1.3
|
281
|
+
def q_key
|
282
|
+
if Proxy.version_requirement_met? '>=3.1.3', core_version
|
283
|
+
q_key = 'q'
|
284
|
+
else
|
285
|
+
q_key = 'ageState'
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
279
289
|
def process_status_request message, options={}
|
280
290
|
component_id = message.attributes["cId"]
|
281
291
|
component = @site.find_component component_id
|
282
292
|
log "Received #{message.type}", message: message, level: :log
|
283
293
|
sS = message.attributes["sS"].map do |arg|
|
284
294
|
value, quality = component.get_status arg['sCI'], arg['n'], {sxl_version: sxl_version}
|
285
|
-
{ "s" => rsmpify_value(value),
|
295
|
+
{ "s" => rsmpify_value(value), q_key => quality.to_s }.merge arg
|
286
296
|
end
|
287
297
|
response = StatusResponse.new({
|
288
298
|
"cId"=>component_id,
|
@@ -420,7 +430,7 @@ module RSMP
|
|
420
430
|
sS << { "sCI" => code,
|
421
431
|
"n" => status_name,
|
422
432
|
"s" => rsmpify_value(value),
|
423
|
-
|
433
|
+
q_key => quality }
|
424
434
|
end
|
425
435
|
end
|
426
436
|
update = StatusUpdate.new({
|
@@ -440,7 +450,7 @@ module RSMP
|
|
440
450
|
|
441
451
|
def process_version message
|
442
452
|
return extraneous_version message if @version_determined
|
443
|
-
|
453
|
+
check_core_version message
|
444
454
|
check_sxl_version message
|
445
455
|
@site_id = Supervisor.build_id_from_ip_port @ip, @port
|
446
456
|
version_accepted message
|
data/lib/rsmp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsmp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emil Tin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|