Class: OpenC3::EphemeralStore

Inherits:
Store show all
Defined in:
lib/openc3/utilities/store_autoload.rb

Constant Summary

Constants inherited from Store

Store::DB_SHARD_CACHE_TIMEOUT

Instance Attribute Summary

Attributes inherited from Store

#redis_pool, #redis_url

Instance Method Summary collapse

Methods inherited from Store

#build_redis, db_shard_for_target, #get_last_offset, #get_newest_message, #get_oldest_message, instance, method_missing, #method_missing, #read_topics, #trim_topic, #update_topic_offsets, #write_topic

Constructor Details

#initialize(pool_size = 10, db_shard: 0) ⇒ EphemeralStore

Returns a new instance of EphemeralStore.



261
262
263
264
265
266
# File 'lib/openc3/utilities/store_autoload.rb', line 261

def initialize(pool_size = 10, db_shard: 0)
  super(pool_size)
  hostname = ENV['OPENC3_REDIS_EPHEMERAL_HOSTNAME'].to_s.gsub("SHARDNUM", db_shard.to_s)
  @redis_url = "redis://#{hostname}:#{ENV.fetch('OPENC3_REDIS_EPHEMERAL_PORT', 6380)}"
  @redis_pool = StoreConnectionPool.new(size: pool_size) { build_redis() }
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class OpenC3::Store