Class: OpenC3::TelemetryTopic
- Defined in:
- lib/openc3/topics/telemetry_topic.rb
Class Method Summary collapse
Methods inherited from Topic
all_same_db_shard?, clear_topics, del, get_cnt, get_last_offset, get_newest_message, get_oldest_message, group_topics_by_db_shard, method_missing, read_topics, trim_topic, update_topic_offsets, write_ack, write_topic
Class Method Details
.write_packet(packet, queued: false, scope:) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/openc3/topics/telemetry_topic.rb', line 23 def self.write_packet(packet, queued: false, scope:) msg_hash = { :time => packet.packet_time.to_nsec_from_epoch, :received_time => packet.received_time.to_nsec_from_epoch, :stored => packet.stored.to_s, :target_name => packet.target_name, :packet_name => packet.packet_name, :received_count => packet.received_count, :buffer => packet.buffer(false) } msg_hash[:extra] = JSON.generate(packet.extra.as_json, allow_nan: true) if packet.extra topic = "#{scope}__TELEMETRY__{#{packet.target_name}}__#{packet.packet_name}" db_shard = Store.db_shard_for_target(packet.target_name, scope: scope) if queued EphemeralStoreQueued.instance(db_shard: db_shard).write_topic(topic, msg_hash) else Topic.write_topic(topic, msg_hash, db_shard: db_shard) end end |