Module: RSMP::SupervisorProxy::Modules::AggregatedStatus

Included in:
RSMP::SupervisorProxy
Defined in:
lib/rsmp/proxy/supervisor/modules/aggregated_status.rb

Overview

Handles aggregated status messages

Instance Method Summary collapse

Instance Method Details

#process_aggregated_status_request(message) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/rsmp/proxy/supervisor/modules/aggregated_status.rb', line 37

def process_aggregated_status_request(message)
  log "Received #{message.type}", message: message, level: :log
  component_id = message.attributes['cId']
  component = @site.find_component component_id
  acknowledge message
  send_aggregated_status component
end

#send_aggregated_status(component, options = {}) ⇒ Object

Send aggregated status for a component



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rsmp/proxy/supervisor/modules/aggregated_status.rb', line 13

def send_aggregated_status(component, options = {})
  m_id = options[:m_id] || RSMP::Message.make_m_id

  se = if Proxy.version_meets_requirement?(core_version, '<=3.1.2')
         component.aggregated_status_bools.map { |bool| bool ? 'true' : 'false' }
       else
         component.aggregated_status_bools
       end

  message = RSMP::AggregatedStatus.new({
                                         'aSTS' => clock.to_s,
                                         'cId' => component.c_id,
                                         'fP' => nil,
                                         'fS' => nil,
                                         'se' => se,
                                         'mId' => m_id
                                       })

  apply_nts_message_attributes message
  send_and_optionally_collect message, options do |collect_options|
    Collector.new self, collect_options.merge(task: @task, type: 'MessageAck')
  end
end

#send_all_aggregated_statusObject



6
7
8
9
10
# File 'lib/rsmp/proxy/supervisor/modules/aggregated_status.rb', line 6

def send_all_aggregated_status
  @site.components.each_pair do |_c_id, component|
    send_aggregated_status component if component.grouped
  end
end