Class: OpenC3::ToolConfigModel

Inherits:
Object
  • Object
show all
Defined in:
lib/openc3/models/tool_config_model.rb

Class Method Summary collapse

Class Method Details

.config_tool_names(scope: $openc3_scope) ⇒ Object



27
28
29
30
31
# File 'lib/openc3/models/tool_config_model.rb', line 27

def self.config_tool_names(scope: $openc3_scope)
  _, keys = Store.scan(0, match: "#{scope}__config__*", type: 'hash', count: 100)
  # Just return the tool name that is used in the other APIs
  return keys.map! { |key| key.split('__')[2] }.sort
end

.delete_config(tool, name, local_mode: true, scope: $openc3_scope) ⇒ Object



46
47
48
49
# File 'lib/openc3/models/tool_config_model.rb', line 46

def self.delete_config(tool, name, local_mode: true, scope: $openc3_scope)
  Store.hdel("#{scope}__config__#{tool}", name)
  LocalMode.delete_tool_config(scope, tool, name) if local_mode
end

.list_configs(tool, scope: $openc3_scope) ⇒ Object



33
34
35
# File 'lib/openc3/models/tool_config_model.rb', line 33

def self.list_configs(tool, scope: $openc3_scope)
  Store.hkeys("#{scope}__config__#{tool}")
end

.load_config(tool, name, scope: $openc3_scope) ⇒ Object



37
38
39
# File 'lib/openc3/models/tool_config_model.rb', line 37

def self.load_config(tool, name, scope: $openc3_scope)
  Store.hget("#{scope}__config__#{tool}", name)
end

.save_config(tool, name, data, local_mode: true, scope: $openc3_scope) ⇒ Object



41
42
43
44
# File 'lib/openc3/models/tool_config_model.rb', line 41

def self.save_config(tool, name, data, local_mode: true, scope: $openc3_scope)
  Store.hset("#{scope}__config__#{tool}", name, data)
  LocalMode.save_tool_config(scope, tool, name, data) if local_mode
end