Class: OpenC3::SystemEventsTopic

Inherits:
Topic show all
Defined in:
lib/openc3/topics/system_events_topic.rb

Constant Summary collapse

PRIMARY_KEY =
"OPENC3__SYSTEM__EVENTS".freeze

Class Method Summary collapse

Methods inherited from Topic

clear_topics, get_cnt, method_missing

Class Method Details

.readObject



34
35
36
37
38
# File 'lib/openc3/topics/system_events_topic.rb', line 34

def self.read()
  Topic.read_topics([PRIMARY_KEY]) do |_topic, _msg_id, msg_hash, _redis|
    yield JSON.parse(msg_hash['event'])
  end
end

.update_topic_offsetsObject



25
26
27
# File 'lib/openc3/topics/system_events_topic.rb', line 25

def self.update_topic_offsets()
  Topic.update_topic_offsets([PRIMARY_KEY])
end

.write(type, event) ⇒ Object



29
30
31
32
# File 'lib/openc3/topics/system_events_topic.rb', line 29

def self.write(type, event)
  event['type'] = type
  Topic.write_topic(PRIMARY_KEY, {event: JSON.generate(event)}, '*', 1000)
end