lib/openc3/models/cvt_model.rb in openc3-5.0.7 vs lib/openc3/models/cvt_model.rb in openc3-5.0.8
- old
+ new
@@ -38,16 +38,16 @@
json_hash
end
# Delete the current value table for a target
def self.del(target_name:, packet_name:, scope:)
- EphemeralStore.hdel("#{scope}__tlm__#{target_name}", packet_name)
+ Store.hdel("#{scope}__tlm__#{target_name}", packet_name)
end
# Set the current value table for a target, packet
def self.set(hash, target_name:, packet_name:, scope:)
- EphemeralStore.hset("#{scope}__tlm__#{target_name}", packet_name, JSON.generate(hash.as_json(:allow_nan => true)))
+ Store.hset("#{scope}__tlm__#{target_name}", packet_name, JSON.generate(hash.as_json(:allow_nan => true)))
end
# Set an item in the current value table
def self.set_item(target_name, packet_name, item_name, value, type:, scope:)
case type
@@ -60,13 +60,13 @@
when :RAW
field = item_name
else
raise "Unknown type '#{type}' for #{target_name} #{packet_name} #{item_name}"
end
- hash = JSON.parse(EphemeralStore.hget("#{scope}__tlm__#{target_name}", packet_name), :allow_nan => true, :create_additions => true)
+ hash = JSON.parse(Store.hget("#{scope}__tlm__#{target_name}", packet_name), :allow_nan => true, :create_additions => true)
hash[field] = value
- EphemeralStore.hset("#{scope}__tlm__#{target_name}", packet_name, JSON.generate(hash.as_json(:allow_nan => true)))
+ Store.hset("#{scope}__tlm__#{target_name}", packet_name, JSON.generate(hash.as_json(:allow_nan => true)))
end
# Get an item from the current value table
def self.get_item(target_name, packet_name, item_name, type:, scope:)
if @overrides["#{target_name}__#{packet_name}__#{item_name}__#{type}"]
@@ -84,11 +84,11 @@
when :RAW
types = [item_name]
else
raise "Unknown type '#{type}' for #{target_name} #{packet_name} #{item_name}"
end
- hash = JSON.parse(EphemeralStore.hget("#{scope}__tlm__#{target_name}", packet_name), :allow_nan => true, :create_additions => true)
+ hash = JSON.parse(Store.hget("#{scope}__tlm__#{target_name}", packet_name), :allow_nan => true, :create_additions => true)
hash.values_at(*types).each do |result|
return result if result
end
return nil
end
@@ -104,10 +104,10 @@
# First generate a lookup hash of all the items represented so we can query the CVT
items.each { |item| _parse_item(lookups, item) }
lookups.each do |target_packet_key, target_name, packet_name, packet_values|
unless packet_lookup[target_packet_key]
- packet = EphemeralStore.hget("#{scope}__tlm__#{target_name}", packet_name)
+ packet = Store.hget("#{scope}__tlm__#{target_name}", packet_name)
raise "Packet '#{target_name} #{packet_name}' does not exist" unless packet
packet_lookup[target_packet_key] = JSON.parse(packet, :allow_nan => true, :create_additions => true)
end
hash = packet_lookup[target_packet_key]
item_result = []