Method: BucketFile#initialize
- Defined in:
- lib/openc3/utilities/bucket_file_cache.rb
#initialize(bucket_path) ⇒ BucketFile
Returns a new instance of BucketFile.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/openc3/utilities/bucket_file_cache.rb', line 41 def initialize(bucket_path) @bucket = OpenC3::Bucket.getClient() @bucket_path = bucket_path @local_path = nil @reservation_count = 0 @size = 0 @priority = 0 @error = nil @init_time = Time.now @mutex = Mutex.new path_split = @bucket_path.split("/") scope = path_split[0].to_s.upcase stream_mode = path_split[1].to_s.split("_")[0].to_s.upcase if stream_mode == 'REDUCED' stream_mode << '_' << path_split[1].to_s.split("_")[1].to_s.upcase end cmd_or_tlm = path_split[2].to_s.upcase target_name = path_split[3].to_s.upcase if stream_mode == 'RAW' type = (cmd_or_tlm == 'CMD') ? 'COMMAND' : 'TELEMETRY' else if stream_mode == 'DECOM' type = (cmd_or_tlm == 'CMD') ? 'DECOMCMD' : 'DECOM' else type = stream_mode # REDUCED_MINUTE, REDUCED_HOUR, or REDUCED_DAY end end @topic_prefix = "#{scope}__#{type}__{#{target_name}}" end |