Module: RSMP::SiteProxy::Modules::AggregatedStatus
- Included in:
- RSMP::SiteProxy
- Defined in:
- lib/rsmp/proxy/site/modules/aggregated_status.rb
Overview
Handles aggregated status requests and responses
Instance Method Summary collapse
- #aggregated_status_changed(component, _options = {}) ⇒ Object
- #process_aggregated_status(message) ⇒ Object
- #request_aggregated_status(component, options = {}) ⇒ Object
- #validate_aggregated_status(message, status_elements) ⇒ Object
Instance Method Details
#aggregated_status_changed(component, _options = {}) ⇒ Object
46 47 48 |
# File 'lib/rsmp/proxy/site/modules/aggregated_status.rb', line 46 def aggregated_status_changed(component, = {}) @supervisor.aggregated_status_changed self, component end |
#process_aggregated_status(message) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rsmp/proxy/site/modules/aggregated_status.rb', line 29 def process_aggregated_status() status_elements = .attribute('se') validate_aggregated_status(, status_elements) c_id = .attributes['cId'] component = find_component c_id unless component reason = "component #{c_id} not found" dont_acknowledge , "Ignoring #{.type}:", reason return end component.aggregated_status_bools = status_elements log "Received #{.type} status for component #{c_id} [#{component.aggregated_status.join(', ')}]", message: acknowledge end |
#request_aggregated_status(component, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rsmp/proxy/site/modules/aggregated_status.rb', line 6 def request_aggregated_status(component, = {}) validate_ready 'request aggregated status' m_id = [:m_id] || RSMP::Message.make_m_id = RSMP::AggregatedStatusRequest.new({ 'cId' => component, 'mId' => m_id }) send_and_optionally_collect , do || AggregatedStatusCollector.new( self, .merge(task: @task, m_id: m_id, num: 1) ) end end |
#validate_aggregated_status(message, status_elements) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/rsmp/proxy/site/modules/aggregated_status.rb', line 22 def validate_aggregated_status(, status_elements) return if status_elements.is_a?(Array) && status_elements.size == 8 dont_acknowledge , 'Received', reaons raise InvalidMessage end |