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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4baee11578e53d9753cb5db4401ceae4c7917956f016d15a1891e1024faf70bb
4
- data.tar.gz: 3094c40ca669254cbeb1a496c64e07fecd9b45bd838bd8e447c734ab034b864a
3
+ metadata.gz: f4060389b1398d8bf006419c7536bced8d46dfdb2d6852fe1ce625d08f913eda
4
+ data.tar.gz: 4623b52e36898a400f82a7b9807c1437010e39509c91d3a693165a6766d75a84
5
5
  SHA512:
6
- metadata.gz: e6900bed1e040dec7894fa8ead1f06a07f6a907f5010d5d68c9d263265c49bf3bb3464541790be27e9855c899d43dd57c05ac72a889c5d84efcce17038921606
7
- data.tar.gz: c34670fd8da9f253bc5a1ba44b1cf20265612f35f50a7d37d64e98d80d63a697980bea5b962315e04a2cda26a2f81ff0993fb5eef21850a932372b7a732afbb4
6
+ metadata.gz: 8422abc49a3db9d5d9239612ff81af6cb741945e16231b96292c80bc1a6d2e072a62ddc204373a67efc3afbfb7eb9cafcbc3c060c292a589335ba6a13ed8f490
7
+ data.tar.gz: 5f8a271d7e76d0c0e710c457861a36260bfdd26fdbc69b66ea1035c6c6927512c1a5a8191f8e2ae0b87b763393e178fb0f72228a9d7574719bf2d6c411cff7c3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp (0.16.7)
4
+ rsmp (0.16.8)
5
5
  async (~> 1.30.3)
6
6
  async-io (~> 1.33.0)
7
7
  colorize (~> 0.8.1)
data/config/tlc.yaml CHANGED
@@ -2,7 +2,7 @@ site_id: RN+SI0001
2
2
  supervisors:
3
3
  - ip: 127.0.0.1
4
4
  port: 12111
5
- rsmp_versions: '3.2'
5
+ core_versions: '3.2'
6
6
  sxl: tlc
7
7
  sxl_version: '1.1'
8
8
  components:
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, :rsmp_version
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] = rsmp_version if rsmp_version
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 rsmp_versions
459
- return [RSMP::Schema.latest_core_version] if @site_settings["rsmp_versions"] == 'latest'
460
- return RSMP::Schema.core_versions if @site_settings["rsmp_versions"] == 'all'
461
- [@site_settings["rsmp_versions"]].flatten
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 check_rsmp_version message
465
- versions = rsmp_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
- @rsmp_version = candidates.sort_by { |v| Gem::Version.new(v) }.last # pick latest version
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, rsmp_versions
510
- if rsmp_versions=='latest'
508
+ def send_version site_id, core_versions
509
+ if core_versions=='latest'
511
510
  versions = [RSMP::Schema.latest_core_version]
512
- elsif rsmp_versions=='all'
511
+ elsif core_versions=='all'
513
512
  versions = RSMP::Schema.core_versions
514
513
  else
515
- versions = [rsmp_versions].flatten
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 :rsmp_versions, :site_settings, :logger, :proxies
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
- 'rsmp_versions' => 'all',
35
+ 'core_versions' => 'all',
36
36
  'sxl' => 'tlc',
37
37
  'sxl_version' => RSMP::Schema.latest_version(:tlc),
38
38
  'intervals' => {
@@ -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 #{@rsmp_version}, #{@sxl} #{sanitized_sxl_version}", level: :info
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, rsmp_versions
92
+ send_version @site_id, core_versions
93
93
  @version_determined = true
94
94
  end
95
95
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  module RSMP
6
6
  class Supervisor < Node
7
- attr_reader :rsmp_versions, :site_id, :supervisor_settings, :proxies, :logger
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
- 'rsmp_versions' => 'all',
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
- @rsmp_versions = @supervisor_settings["guest"]["rsmp_versions"]
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.check_rsmp_version version_message
189
- log "Validating using core version #{proxy.rsmp_version}", level: :debug
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["rsmp_versions"]
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 #{@rsmp_version}, #{sxl} #{sanitized_sxl_version}", level: :info
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 #{@rsmp_version}", message: message, level: :log
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), "q" => quality.to_s }.merge arg
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
- "q" => quality }
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
- check_rsmp_version message
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
@@ -1,3 +1,3 @@
1
1
  module RSMP
2
- VERSION = "0.16.7"
2
+ VERSION = "0.16.8"
3
3
  end
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.7
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-22 00:00:00.000000000 Z
11
+ date: 2022-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async