cosmos 5.0.2 → 5.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/data/config/microservice.yaml +47 -35
  3. data/data/config/plugins.yaml +3 -150
  4. data/data/config/target.yaml +70 -0
  5. data/data/config/tool.yaml +37 -31
  6. data/lib/cosmos/api/cmd_api.rb +11 -0
  7. data/lib/cosmos/api/tlm_api.rb +56 -32
  8. data/lib/cosmos/config/config_parser.rb +17 -20
  9. data/lib/cosmos/conversions/generic_conversion.rb +2 -2
  10. data/lib/cosmos/conversions/polynomial_conversion.rb +5 -8
  11. data/lib/cosmos/conversions/segmented_polynomial_conversion.rb +26 -9
  12. data/lib/cosmos/io/json_drb.rb +5 -1
  13. data/lib/cosmos/microservices/cleanup_microservice.rb +28 -29
  14. data/lib/cosmos/microservices/microservice.rb +1 -1
  15. data/lib/cosmos/models/gem_model.rb +1 -1
  16. data/lib/cosmos/models/scope_model.rb +0 -20
  17. data/lib/cosmos/models/target_model.rb +110 -3
  18. data/lib/cosmos/packets/packet.rb +23 -0
  19. data/lib/cosmos/packets/packet_config.rb +2 -2
  20. data/lib/cosmos/packets/packet_item.rb +57 -0
  21. data/lib/cosmos/packets/packet_item_limits.rb +14 -2
  22. data/lib/cosmos/packets/parsers/packet_item_parser.rb +1 -1
  23. data/lib/cosmos/packets/parsers/packet_parser.rb +1 -1
  24. data/lib/cosmos/packets/parsers/xtce_parser.rb +1 -1
  25. data/lib/cosmos/packets/structure_item.rb +10 -1
  26. data/lib/cosmos/script/api_shared.rb +30 -25
  27. data/lib/cosmos/script/commands.rb +5 -7
  28. data/lib/cosmos/script/script.rb +19 -39
  29. data/lib/cosmos/script/storage.rb +92 -105
  30. data/lib/cosmos/tools/table_manager/table_item.rb +1 -1
  31. data/lib/cosmos/topics/command_decom_topic.rb +4 -0
  32. data/lib/cosmos/topics/telemetry_decom_topic.rb +4 -0
  33. data/lib/cosmos/topics/topic.rb +10 -0
  34. data/lib/cosmos/utilities/logger.rb +1 -0
  35. data/lib/cosmos/utilities/s3.rb +61 -0
  36. data/lib/cosmos/utilities/store_autoload.rb +0 -10
  37. data/lib/cosmos/version.rb +5 -4
  38. data/templates/plugin-template/plugin.gemspec +0 -2
  39. metadata +3 -3
@@ -23,6 +23,7 @@ require 'cosmos/utilities/store'
23
23
  require 'socket'
24
24
  require 'logger'
25
25
  require 'time'
26
+ require 'json'
26
27
 
27
28
  module Cosmos
28
29
  # Supports different levels of logging and only writes if the level
@@ -22,6 +22,67 @@ require 'cosmos/models/reducer_model'
22
22
 
23
23
  module Cosmos
24
24
  class S3Utilities
25
+ def self.list_files_before_time(bucket, prefix, time)
26
+ rubys3_client = Aws::S3::Client.new
27
+ oldest_list = []
28
+ total_size = 0
29
+
30
+ # Return nothing if bucket doesn't exist (it won't at the very beginning)
31
+ begin
32
+ rubys3_client.head_bucket(bucket: bucket)
33
+ rescue Aws::S3::Errors::NotFound
34
+ return total_size, oldest_list
35
+ end
36
+
37
+ # Get List of Packet Names - Assumes prefix gets us to a folder of packet names
38
+ token = nil
39
+ folder_list = []
40
+ while true
41
+ resp = rubys3_client.list_objects_v2({
42
+ bucket: bucket,
43
+ max_keys: 1000,
44
+ prefix: prefix,
45
+ delimiter: '/',
46
+ continuation_token: token
47
+ })
48
+
49
+ resp.common_prefixes.each do |item|
50
+ folder_list << item.prefix
51
+ end
52
+ break unless resp.is_truncated
53
+ token = resp.next_continuation_token
54
+ end
55
+
56
+ # Go through each folder and keep files that end before time
57
+ folder_list.each do |folder|
58
+ token = nil
59
+ next_folder = false
60
+ while true
61
+ resp = rubys3_client.list_objects_v2({
62
+ bucket: bucket,
63
+ max_keys: 1000,
64
+ prefix: folder,
65
+ continuation_token: token
66
+ })
67
+ resp.contents.each do |item|
68
+ t = item.key.split('__')[1]
69
+ file_end_time = Time.utc(t[0..3], t[4..5], t[6..7], t[8..9], t[10..11], t[12..13])
70
+ if file_end_time < time
71
+ oldest_list << item
72
+ total_size += item.size
73
+ else
74
+ next_folder = true
75
+ break
76
+ end
77
+ end
78
+ break if !resp.is_truncated or next_folder
79
+
80
+ token = resp.next_continuation_token
81
+ end
82
+ end
83
+ return total_size, oldest_list
84
+ end
85
+
25
86
  def self.get_total_size_and_oldest_list(bucket, prefix, max_list_length = 10000)
26
87
  rubys3_client = Aws::S3::Client.new
27
88
  oldest_list = []
@@ -324,16 +324,6 @@ module Cosmos
324
324
  return redis.xtrim_minid(topic, minid, approximate: approximate, limit: limit)
325
325
  end
326
326
  end
327
-
328
- # Execute any Redis command. Args must be an array (e.g. ["KEYS", "*"])
329
- def self.execute_raw(args)
330
- self.instance.execute_raw(args)
331
- end
332
-
333
- # Execute any Redis command. Args must be an array (e.g. ["KEYS", "*"])
334
- def execute_raw(args)
335
- synchronize { |client| client.call(args) }
336
- end
337
327
  end
338
328
  end
339
329
 
@@ -1,13 +1,14 @@
1
1
  # encoding: ascii-8bit
2
2
 
3
- COSMOS_VERSION = '5.0.2'
3
+ COSMOS_VERSION = '5.0.3'
4
4
  module Cosmos
5
5
  module Version
6
6
  MAJOR = '5'
7
7
  MINOR = '0'
8
- PATCH = '2'
8
+ PATCH = '3'
9
9
  OTHER = ''
10
- BUILD = 'ce01db297de2695bdb78b542c428ca244144d59a'
10
+ BUILD = '715c106240ff43bb59be2d17d1f5aed50595fbc9'
11
11
  end
12
- VERSION = '5.0.2'
12
+ VERSION = '5.0.3'
13
+ GEM_VERSION = '5.0.3'
13
14
  end
@@ -20,6 +20,4 @@ spec = Gem::Specification.new do |s|
20
20
  s.version = '0.0.0' + ".#{time}"
21
21
  end
22
22
  s.files = Dir.glob("{targets,lib,procedures,tools,microservices}/**/*") + %w(Rakefile README.md plugin.txt)
23
-
24
- s.add_runtime_dependency 'cosmos', '~> 5.0'
25
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cosmos
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.2
4
+ version: 5.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Melton
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-04-28 00:00:00.000000000 Z
12
+ date: 2022-05-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -837,7 +837,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
837
837
  - !ruby/object:Gem::Version
838
838
  version: '0'
839
839
  requirements: []
840
- rubygems_version: 3.3.5
840
+ rubygems_version: 3.3.13
841
841
  signing_key:
842
842
  specification_version: 4
843
843
  summary: Ball Aerospace COSMOS