prefab-cloud-ruby 0.24.3 → 0.24.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -1
  3. data/.rubocop.yml +13 -0
  4. data/CHANGELOG.md +78 -0
  5. data/Gemfile.lock +4 -4
  6. data/VERSION +1 -1
  7. data/bin/console +21 -0
  8. data/compile_protos.sh +6 -0
  9. data/lib/prefab/client.rb +25 -4
  10. data/lib/prefab/config_client.rb +17 -6
  11. data/lib/prefab/config_loader.rb +1 -1
  12. data/lib/prefab/config_resolver.rb +2 -4
  13. data/lib/prefab/config_value_wrapper.rb +18 -0
  14. data/lib/prefab/context.rb +22 -2
  15. data/lib/prefab/context_shape.rb +20 -0
  16. data/lib/prefab/context_shape_aggregator.rb +63 -0
  17. data/lib/prefab/criteria_evaluator.rb +61 -41
  18. data/lib/prefab/evaluated_configs_aggregator.rb +60 -0
  19. data/lib/prefab/evaluated_keys_aggregator.rb +41 -0
  20. data/lib/prefab/http_connection.rb +5 -1
  21. data/lib/prefab/local_config_parser.rb +13 -13
  22. data/lib/prefab/log_path_aggregator.rb +64 -0
  23. data/lib/prefab/logger_client.rb +11 -13
  24. data/lib/prefab/options.rb +37 -1
  25. data/lib/prefab/periodic_sync.rb +51 -0
  26. data/lib/prefab/time_helpers.rb +7 -0
  27. data/lib/prefab-cloud-ruby.rb +9 -2
  28. data/lib/prefab_pb.rb +33 -220
  29. data/prefab-cloud-ruby.gemspec +21 -5
  30. data/test/test_config_loader.rb +15 -15
  31. data/test/test_config_resolver.rb +102 -102
  32. data/test/test_config_value_unwrapper.rb +13 -13
  33. data/test/test_context.rb +42 -0
  34. data/test/test_context_shape.rb +51 -0
  35. data/test/test_context_shape_aggregator.rb +137 -0
  36. data/test/test_criteria_evaluator.rb +253 -150
  37. data/test/test_evaluated_configs_aggregator.rb +254 -0
  38. data/test/test_evaluated_keys_aggregator.rb +54 -0
  39. data/test/test_helper.rb +34 -2
  40. data/test/test_log_path_aggregator.rb +57 -0
  41. data/test/test_logger.rb +33 -33
  42. data/test/test_weighted_value_resolver.rb +2 -2
  43. metadata +21 -5
  44. data/lib/prefab/log_path_collector.rb +0 -102
  45. data/test/test_log_path_collector.rb +0 -58
data/lib/prefab_pb.rb CHANGED
@@ -1,234 +1,40 @@
1
+ # frozen_string_literal: true
1
2
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
3
  # source: prefab.proto
3
4
 
4
5
  require 'google/protobuf'
5
6
 
6
- Google::Protobuf::DescriptorPool.generated_pool.build do
7
- add_file("prefab.proto", :syntax => :proto3) do
8
- add_message "prefab.ConfigServicePointer" do
9
- optional :project_id, :int64, 1
10
- optional :start_at_id, :int64, 2
11
- optional :project_env_id, :int64, 3
12
- end
13
- add_message "prefab.ConfigValue" do
14
- oneof :type do
15
- optional :int, :int64, 1
16
- optional :string, :string, 2
17
- optional :bytes, :bytes, 3
18
- optional :double, :double, 4
19
- optional :bool, :bool, 5
20
- optional :weighted_values, :message, 6, "prefab.WeightedValues"
21
- optional :limit_definition, :message, 7, "prefab.LimitDefinition"
22
- optional :log_level, :enum, 9, "prefab.LogLevel"
23
- optional :string_list, :message, 10, "prefab.StringList"
24
- end
25
- end
26
- add_message "prefab.StringList" do
27
- repeated :values, :string, 1
28
- end
29
- add_message "prefab.WeightedValue" do
30
- optional :weight, :int32, 1
31
- optional :value, :message, 2, "prefab.ConfigValue"
32
- end
33
- add_message "prefab.WeightedValues" do
34
- repeated :weighted_values, :message, 1, "prefab.WeightedValue"
35
- proto3_optional :hash_by_property_name, :string, 2
36
- end
37
- add_message "prefab.Configs" do
38
- repeated :configs, :message, 1, "prefab.Config"
39
- optional :config_service_pointer, :message, 2, "prefab.ConfigServicePointer"
40
- end
41
- add_message "prefab.Config" do
42
- optional :id, :int64, 1
43
- optional :project_id, :int64, 2
44
- optional :key, :string, 3
45
- optional :changed_by, :message, 4, "prefab.ChangedBy"
46
- repeated :rows, :message, 5, "prefab.ConfigRow"
47
- repeated :allowable_values, :message, 6, "prefab.ConfigValue"
48
- optional :config_type, :enum, 7, "prefab.ConfigType"
49
- proto3_optional :draftId, :int64, 8
50
- end
51
- add_message "prefab.ChangedBy" do
52
- optional :user_id, :int64, 1
53
- optional :email, :string, 2
54
- end
55
- add_message "prefab.ConfigRow" do
56
- proto3_optional :project_env_id, :int64, 1
57
- repeated :values, :message, 2, "prefab.ConditionalValue"
58
- map :properties, :string, :message, 3, "prefab.ConfigValue"
59
- end
60
- add_message "prefab.ConditionalValue" do
61
- repeated :criteria, :message, 1, "prefab.Criterion"
62
- optional :value, :message, 2, "prefab.ConfigValue"
63
- end
64
- add_message "prefab.Criterion" do
65
- optional :property_name, :string, 1
66
- optional :operator, :enum, 2, "prefab.Criterion.CriterionOperator"
67
- optional :value_to_match, :message, 3, "prefab.ConfigValue"
68
- end
69
- add_enum "prefab.Criterion.CriterionOperator" do
70
- value :NOT_SET, 0
71
- value :LOOKUP_KEY_IN, 1
72
- value :LOOKUP_KEY_NOT_IN, 2
73
- value :IN_SEG, 3
74
- value :NOT_IN_SEG, 4
75
- value :ALWAYS_TRUE, 5
76
- value :PROP_IS_ONE_OF, 6
77
- value :PROP_IS_NOT_ONE_OF, 7
78
- value :PROP_ENDS_WITH_ONE_OF, 8
79
- value :PROP_DOES_NOT_END_WITH_ONE_OF, 9
80
- value :HIERARCHICAL_MATCH, 10
81
- end
82
- add_message "prefab.Loggers" do
83
- repeated :loggers, :message, 1, "prefab.Logger"
84
- optional :start_at, :int64, 2
85
- optional :end_at, :int64, 3
86
- optional :instance_hash, :string, 4
87
- proto3_optional :namespace, :string, 5
88
- end
89
- add_message "prefab.Logger" do
90
- optional :logger_name, :string, 1
91
- proto3_optional :traces, :int64, 2
92
- proto3_optional :debugs, :int64, 3
93
- proto3_optional :infos, :int64, 4
94
- proto3_optional :warns, :int64, 5
95
- proto3_optional :errors, :int64, 6
96
- proto3_optional :fatals, :int64, 7
97
- end
98
- add_message "prefab.LoggerReportResponse" do
99
- end
100
- add_message "prefab.LimitResponse" do
101
- optional :passed, :bool, 1
102
- optional :expires_at, :int64, 2
103
- optional :enforced_group, :string, 3
104
- optional :current_bucket, :int64, 4
105
- optional :policy_group, :string, 5
106
- optional :policy_name, :enum, 6, "prefab.LimitResponse.LimitPolicyNames"
107
- optional :policy_limit, :int32, 7
108
- optional :amount, :int64, 8
109
- optional :limit_reset_at, :int64, 9
110
- optional :safety_level, :enum, 10, "prefab.LimitDefinition.SafetyLevel"
111
- end
112
- add_enum "prefab.LimitResponse.LimitPolicyNames" do
113
- value :NOT_SET, 0
114
- value :SECONDLY_ROLLING, 1
115
- value :MINUTELY_ROLLING, 3
116
- value :HOURLY_ROLLING, 5
117
- value :DAILY_ROLLING, 7
118
- value :MONTHLY_ROLLING, 8
119
- value :INFINITE, 9
120
- value :YEARLY_ROLLING, 10
121
- end
122
- add_message "prefab.LimitRequest" do
123
- optional :account_id, :int64, 1
124
- optional :acquire_amount, :int32, 2
125
- repeated :groups, :string, 3
126
- optional :limit_combiner, :enum, 4, "prefab.LimitRequest.LimitCombiner"
127
- optional :allow_partial_response, :bool, 5
128
- optional :safety_level, :enum, 6, "prefab.LimitDefinition.SafetyLevel"
129
- end
130
- add_enum "prefab.LimitRequest.LimitCombiner" do
131
- value :NOT_SET, 0
132
- value :MINIMUM, 1
133
- value :MAXIMUM, 2
134
- end
135
- add_message "prefab.Identity" do
136
- proto3_optional :lookup, :string, 1
137
- map :attributes, :string, :string, 2
138
- end
139
- add_message "prefab.ClientConfigValue" do
140
- proto3_optional :int, :int64, 1
141
- proto3_optional :string, :string, 2
142
- proto3_optional :double, :double, 3
143
- proto3_optional :bool, :bool, 4
144
- end
145
- add_message "prefab.ConfigEvaluations" do
146
- map :values, :string, :message, 1, "prefab.ClientConfigValue"
147
- end
148
- add_message "prefab.LimitDefinition" do
149
- optional :policy_name, :enum, 2, "prefab.LimitResponse.LimitPolicyNames"
150
- optional :limit, :int32, 3
151
- optional :burst, :int32, 4
152
- optional :account_id, :int64, 5
153
- optional :last_modified, :int64, 6
154
- optional :returnable, :bool, 7
155
- optional :safety_level, :enum, 8, "prefab.LimitDefinition.SafetyLevel"
156
- end
157
- add_enum "prefab.LimitDefinition.SafetyLevel" do
158
- value :NOT_SET, 0
159
- value :L4_BEST_EFFORT, 4
160
- value :L5_BOMBPROOF, 5
161
- end
162
- add_message "prefab.LimitDefinitions" do
163
- repeated :definitions, :message, 1, "prefab.LimitDefinition"
164
- end
165
- add_message "prefab.BufferedRequest" do
166
- optional :account_id, :int64, 1
167
- optional :method, :string, 2
168
- optional :uri, :string, 3
169
- optional :body, :string, 4
170
- repeated :limit_groups, :string, 5
171
- optional :content_type, :string, 6
172
- optional :fifo, :bool, 7
173
- end
174
- add_message "prefab.BatchRequest" do
175
- optional :account_id, :int64, 1
176
- optional :method, :string, 2
177
- optional :uri, :string, 3
178
- optional :body, :string, 4
179
- repeated :limit_groups, :string, 5
180
- optional :batch_template, :string, 6
181
- optional :batch_separator, :string, 7
182
- end
183
- add_message "prefab.BasicResponse" do
184
- optional :message, :string, 1
185
- end
186
- add_message "prefab.CreationResponse" do
187
- optional :message, :string, 1
188
- optional :new_id, :int64, 2
189
- end
190
- add_message "prefab.IdBlock" do
191
- optional :project_id, :int64, 1
192
- optional :project_env_id, :int64, 2
193
- optional :sequence_name, :string, 3
194
- optional :start, :int64, 4
195
- optional :end, :int64, 5
196
- end
197
- add_message "prefab.IdBlockRequest" do
198
- optional :project_id, :int64, 1
199
- optional :project_env_id, :int64, 2
200
- optional :sequence_name, :string, 3
201
- optional :size, :int64, 4
202
- end
203
- add_enum "prefab.ConfigType" do
204
- value :NOT_SET_CONFIG_TYPE, 0
205
- value :CONFIG, 1
206
- value :FEATURE_FLAG, 2
207
- value :LOG_LEVEL, 3
208
- value :SEGMENT, 4
209
- value :LIMIT_DEFINITION, 5
210
- end
211
- add_enum "prefab.LogLevel" do
212
- value :NOT_SET_LOG_LEVEL, 0
213
- value :TRACE, 1
214
- value :DEBUG, 2
215
- value :INFO, 3
216
- value :WARN, 5
217
- value :ERROR, 6
218
- value :FATAL, 9
219
- end
220
- add_enum "prefab.OnFailure" do
221
- value :NOT_SET, 0
222
- value :LOG_AND_PASS, 1
223
- value :LOG_AND_FAIL, 2
224
- value :THROW, 3
7
+
8
+ descriptor_data = "\n\x0cprefab.proto\x12\x06prefab\"W\n\x14\x43onfigServicePointer\x12\x12\n\nproject_id\x18\x01 \x01(\x03\x12\x13\n\x0bstart_at_id\x18\x02 \x01(\x03\x12\x16\n\x0eproject_env_id\x18\x03 \x01(\x03\"\xca\x02\n\x0b\x43onfigValue\x12\r\n\x03int\x18\x01 \x01(\x03H\x00\x12\x10\n\x06string\x18\x02 \x01(\tH\x00\x12\x0f\n\x05\x62ytes\x18\x03 \x01(\x0cH\x00\x12\x10\n\x06\x64ouble\x18\x04 \x01(\x01H\x00\x12\x0e\n\x04\x62ool\x18\x05 \x01(\x08H\x00\x12\x31\n\x0fweighted_values\x18\x06 \x01(\x0b\x32\x16.prefab.WeightedValuesH\x00\x12\x33\n\x10limit_definition\x18\x07 \x01(\x0b\x32\x17.prefab.LimitDefinitionH\x00\x12%\n\tlog_level\x18\t \x01(\x0e\x32\x10.prefab.LogLevelH\x00\x12)\n\x0bstring_list\x18\n \x01(\x0b\x32\x12.prefab.StringListH\x00\x12%\n\tint_range\x18\x0b \x01(\x0b\x32\x10.prefab.IntRangeH\x00\x42\x06\n\x04type\"B\n\x08IntRange\x12\x12\n\x05start\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12\x10\n\x03\x65nd\x18\x02 \x01(\x03H\x01\x88\x01\x01\x42\x08\n\x06_startB\x06\n\x04_end\"\x1c\n\nStringList\x12\x0e\n\x06values\x18\x01 \x03(\t\"C\n\rWeightedValue\x12\x0e\n\x06weight\x18\x01 \x01(\x05\x12\"\n\x05value\x18\x02 \x01(\x0b\x32\x13.prefab.ConfigValue\"~\n\x0eWeightedValues\x12.\n\x0fweighted_values\x18\x01 \x03(\x0b\x32\x15.prefab.WeightedValue\x12\"\n\x15hash_by_property_name\x18\x02 \x01(\tH\x00\x88\x01\x01\x42\x18\n\x16_hash_by_property_name\"h\n\x07\x43onfigs\x12\x1f\n\x07\x63onfigs\x18\x01 \x03(\x0b\x32\x0e.prefab.Config\x12<\n\x16\x63onfig_service_pointer\x18\x02 \x01(\x0b\x32\x1c.prefab.ConfigServicePointer\"\xf7\x01\n\x06\x43onfig\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x12\n\nproject_id\x18\x02 \x01(\x03\x12\x0b\n\x03key\x18\x03 \x01(\t\x12%\n\nchanged_by\x18\x04 \x01(\x0b\x32\x11.prefab.ChangedBy\x12\x1f\n\x04rows\x18\x05 \x03(\x0b\x32\x11.prefab.ConfigRow\x12-\n\x10\x61llowable_values\x18\x06 \x03(\x0b\x32\x13.prefab.ConfigValue\x12\'\n\x0b\x63onfig_type\x18\x07 \x01(\x0e\x32\x12.prefab.ConfigType\x12\x14\n\x07\x64raftId\x18\x08 \x01(\x03H\x00\x88\x01\x01\x42\n\n\x08_draftId\"+\n\tChangedBy\x12\x0f\n\x07user_id\x18\x01 \x01(\x03\x12\r\n\x05\x65mail\x18\x02 \x01(\t\"\xe4\x01\n\tConfigRow\x12\x1b\n\x0eproject_env_id\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12(\n\x06values\x18\x02 \x03(\x0b\x32\x18.prefab.ConditionalValue\x12\x35\n\nproperties\x18\x03 \x03(\x0b\x32!.prefab.ConfigRow.PropertiesEntry\x1a\x46\n\x0fPropertiesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\"\n\x05value\x18\x02 \x01(\x0b\x32\x13.prefab.ConfigValue:\x02\x38\x01\x42\x11\n\x0f_project_env_id\"[\n\x10\x43onditionalValue\x12#\n\x08\x63riteria\x18\x01 \x03(\x0b\x32\x11.prefab.Criterion\x12\"\n\x05value\x18\x02 \x01(\x0b\x32\x13.prefab.ConfigValue\"\x94\x03\n\tCriterion\x12\x15\n\rproperty_name\x18\x01 \x01(\t\x12\x35\n\x08operator\x18\x02 \x01(\x0e\x32#.prefab.Criterion.CriterionOperator\x12+\n\x0evalue_to_match\x18\x03 \x01(\x0b\x32\x13.prefab.ConfigValue\"\x8b\x02\n\x11\x43riterionOperator\x12\x0b\n\x07NOT_SET\x10\x00\x12\x11\n\rLOOKUP_KEY_IN\x10\x01\x12\x15\n\x11LOOKUP_KEY_NOT_IN\x10\x02\x12\n\n\x06IN_SEG\x10\x03\x12\x0e\n\nNOT_IN_SEG\x10\x04\x12\x0f\n\x0b\x41LWAYS_TRUE\x10\x05\x12\x12\n\x0ePROP_IS_ONE_OF\x10\x06\x12\x16\n\x12PROP_IS_NOT_ONE_OF\x10\x07\x12\x19\n\x15PROP_ENDS_WITH_ONE_OF\x10\x08\x12!\n\x1dPROP_DOES_NOT_END_WITH_ONE_OF\x10\t\x12\x16\n\x12HIERARCHICAL_MATCH\x10\n\x12\x10\n\x0cIN_INT_RANGE\x10\x0b\"\x89\x01\n\x07Loggers\x12\x1f\n\x07loggers\x18\x01 \x03(\x0b\x32\x0e.prefab.Logger\x12\x10\n\x08start_at\x18\x02 \x01(\x03\x12\x0e\n\x06\x65nd_at\x18\x03 \x01(\x03\x12\x15\n\rinstance_hash\x18\x04 \x01(\t\x12\x16\n\tnamespace\x18\x05 \x01(\tH\x00\x88\x01\x01\x42\x0c\n\n_namespace\"\xd9\x01\n\x06Logger\x12\x13\n\x0blogger_name\x18\x01 \x01(\t\x12\x13\n\x06traces\x18\x02 \x01(\x03H\x00\x88\x01\x01\x12\x13\n\x06\x64\x65\x62ugs\x18\x03 \x01(\x03H\x01\x88\x01\x01\x12\x12\n\x05infos\x18\x04 \x01(\x03H\x02\x88\x01\x01\x12\x12\n\x05warns\x18\x05 \x01(\x03H\x03\x88\x01\x01\x12\x13\n\x06\x65rrors\x18\x06 \x01(\x03H\x04\x88\x01\x01\x12\x13\n\x06\x66\x61tals\x18\x07 \x01(\x03H\x05\x88\x01\x01\x42\t\n\x07_tracesB\t\n\x07_debugsB\x08\n\x06_infosB\x08\n\x06_warnsB\t\n\x07_errorsB\t\n\x07_fatals\"\x16\n\x14LoggerReportResponse\"\xdb\x03\n\rLimitResponse\x12\x0e\n\x06passed\x18\x01 \x01(\x08\x12\x12\n\nexpires_at\x18\x02 \x01(\x03\x12\x16\n\x0e\x65nforced_group\x18\x03 \x01(\t\x12\x16\n\x0e\x63urrent_bucket\x18\x04 \x01(\x03\x12\x14\n\x0cpolicy_group\x18\x05 \x01(\t\x12;\n\x0bpolicy_name\x18\x06 \x01(\x0e\x32&.prefab.LimitResponse.LimitPolicyNames\x12\x14\n\x0cpolicy_limit\x18\x07 \x01(\x05\x12\x0e\n\x06\x61mount\x18\x08 \x01(\x03\x12\x16\n\x0elimit_reset_at\x18\t \x01(\x03\x12\x39\n\x0csafety_level\x18\n \x01(\x0e\x32#.prefab.LimitDefinition.SafetyLevel\"\xa9\x01\n\x10LimitPolicyNames\x12\x0b\n\x07NOT_SET\x10\x00\x12\x14\n\x10SECONDLY_ROLLING\x10\x01\x12\x14\n\x10MINUTELY_ROLLING\x10\x03\x12\x12\n\x0eHOURLY_ROLLING\x10\x05\x12\x11\n\rDAILY_ROLLING\x10\x07\x12\x13\n\x0fMONTHLY_ROLLING\x10\x08\x12\x0c\n\x08INFINITE\x10\t\x12\x12\n\x0eYEARLY_ROLLING\x10\n\"\x99\x02\n\x0cLimitRequest\x12\x12\n\naccount_id\x18\x01 \x01(\x03\x12\x16\n\x0e\x61\x63quire_amount\x18\x02 \x01(\x05\x12\x0e\n\x06groups\x18\x03 \x03(\t\x12:\n\x0elimit_combiner\x18\x04 \x01(\x0e\x32\".prefab.LimitRequest.LimitCombiner\x12\x1e\n\x16\x61llow_partial_response\x18\x05 \x01(\x08\x12\x39\n\x0csafety_level\x18\x06 \x01(\x0e\x32#.prefab.LimitDefinition.SafetyLevel\"6\n\rLimitCombiner\x12\x0b\n\x07NOT_SET\x10\x00\x12\x0b\n\x07MINIMUM\x10\x01\x12\x0b\n\x07MAXIMUM\x10\x02\"/\n\nContextSet\x12!\n\x08\x63ontexts\x18\x01 \x03(\x0b\x32\x0f.prefab.Context\"\x96\x01\n\x07\x43ontext\x12\x11\n\x04type\x18\x01 \x01(\tH\x00\x88\x01\x01\x12+\n\x06values\x18\x02 \x03(\x0b\x32\x1b.prefab.Context.ValuesEntry\x1a\x42\n\x0bValuesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\"\n\x05value\x18\x02 \x01(\x0b\x32\x13.prefab.ConfigValue:\x02\x38\x01\x42\x07\n\x05_type\"\x93\x01\n\x08Identity\x12\x13\n\x06lookup\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x34\n\nattributes\x18\x02 \x03(\x0b\x32 .prefab.Identity.AttributesEntry\x1a\x31\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\t\n\x07_lookup\"\x89\x01\n\x11\x43lientConfigValue\x12\x10\n\x03int\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12\x13\n\x06string\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x13\n\x06\x64ouble\x18\x03 \x01(\x01H\x02\x88\x01\x01\x12\x11\n\x04\x62ool\x18\x04 \x01(\x08H\x03\x88\x01\x01\x42\x06\n\x04_intB\t\n\x07_stringB\t\n\x07_doubleB\x07\n\x05_bool\"\x94\x01\n\x11\x43onfigEvaluations\x12\x35\n\x06values\x18\x01 \x03(\x0b\x32%.prefab.ConfigEvaluations.ValuesEntry\x1aH\n\x0bValuesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12(\n\x05value\x18\x02 \x01(\x0b\x32\x19.prefab.ClientConfigValue:\x02\x38\x01\"\xa8\x02\n\x0fLimitDefinition\x12;\n\x0bpolicy_name\x18\x02 \x01(\x0e\x32&.prefab.LimitResponse.LimitPolicyNames\x12\r\n\x05limit\x18\x03 \x01(\x05\x12\r\n\x05\x62urst\x18\x04 \x01(\x05\x12\x12\n\naccount_id\x18\x05 \x01(\x03\x12\x15\n\rlast_modified\x18\x06 \x01(\x03\x12\x12\n\nreturnable\x18\x07 \x01(\x08\x12\x39\n\x0csafety_level\x18\x08 \x01(\x0e\x32#.prefab.LimitDefinition.SafetyLevel\"@\n\x0bSafetyLevel\x12\x0b\n\x07NOT_SET\x10\x00\x12\x12\n\x0eL4_BEST_EFFORT\x10\x04\x12\x10\n\x0cL5_BOMBPROOF\x10\x05\"@\n\x10LimitDefinitions\x12,\n\x0b\x64\x65\x66initions\x18\x01 \x03(\x0b\x32\x17.prefab.LimitDefinition\"\x8a\x01\n\x0f\x42ufferedRequest\x12\x12\n\naccount_id\x18\x01 \x01(\x03\x12\x0e\n\x06method\x18\x02 \x01(\t\x12\x0b\n\x03uri\x18\x03 \x01(\t\x12\x0c\n\x04\x62ody\x18\x04 \x01(\t\x12\x14\n\x0climit_groups\x18\x05 \x03(\t\x12\x14\n\x0c\x63ontent_type\x18\x06 \x01(\t\x12\x0c\n\x04\x66ifo\x18\x07 \x01(\x08\"\x94\x01\n\x0c\x42\x61tchRequest\x12\x12\n\naccount_id\x18\x01 \x01(\x03\x12\x0e\n\x06method\x18\x02 \x01(\t\x12\x0b\n\x03uri\x18\x03 \x01(\t\x12\x0c\n\x04\x62ody\x18\x04 \x01(\t\x12\x14\n\x0climit_groups\x18\x05 \x03(\t\x12\x16\n\x0e\x62\x61tch_template\x18\x06 \x01(\t\x12\x17\n\x0f\x62\x61tch_separator\x18\x07 \x01(\t\" \n\rBasicResponse\x12\x0f\n\x07message\x18\x01 \x01(\t\"3\n\x10\x43reationResponse\x12\x0f\n\x07message\x18\x01 \x01(\t\x12\x0e\n\x06new_id\x18\x02 \x01(\x03\"h\n\x07IdBlock\x12\x12\n\nproject_id\x18\x01 \x01(\x03\x12\x16\n\x0eproject_env_id\x18\x02 \x01(\x03\x12\x15\n\rsequence_name\x18\x03 \x01(\t\x12\r\n\x05start\x18\x04 \x01(\x03\x12\x0b\n\x03\x65nd\x18\x05 \x01(\x03\"a\n\x0eIdBlockRequest\x12\x12\n\nproject_id\x18\x01 \x01(\x03\x12\x16\n\x0eproject_env_id\x18\x02 \x01(\x03\x12\x15\n\rsequence_name\x18\x03 \x01(\t\x12\x0c\n\x04size\x18\x04 \x01(\x03\"\x8a\x01\n\x0c\x43ontextShape\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x39\n\x0b\x66ield_types\x18\x02 \x03(\x0b\x32$.prefab.ContextShape.FieldTypesEntry\x1a\x31\n\x0f\x46ieldTypesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\"[\n\rContextShapes\x12$\n\x06shapes\x18\x01 \x03(\x0b\x32\x14.prefab.ContextShape\x12\x16\n\tnamespace\x18\x02 \x01(\tH\x00\x88\x01\x01\x42\x0c\n\n_namespace\"C\n\rEvaluatedKeys\x12\x0c\n\x04keys\x18\x01 \x03(\t\x12\x16\n\tnamespace\x18\x02 \x01(\tH\x00\x88\x01\x01\x42\x0c\n\n_namespace\"\x93\x01\n\x0f\x45valuatedConfig\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x16\n\x0e\x63onfig_version\x18\x02 \x01(\x03\x12#\n\x06result\x18\x03 \x01(\x0b\x32\x13.prefab.ConfigValue\x12#\n\x07\x63ontext\x18\x04 \x01(\x0b\x32\x12.prefab.ContextSet\x12\x11\n\ttimestamp\x18\x05 \x01(\x03\"<\n\x10\x45valuatedConfigs\x12(\n\x07\x63onfigs\x18\x01 \x03(\x0b\x32\x17.prefab.EvaluatedConfig*u\n\nConfigType\x12\x17\n\x13NOT_SET_CONFIG_TYPE\x10\x00\x12\n\n\x06\x43ONFIG\x10\x01\x12\x10\n\x0c\x46\x45\x41TURE_FLAG\x10\x02\x12\r\n\tLOG_LEVEL\x10\x03\x12\x0b\n\x07SEGMENT\x10\x04\x12\x14\n\x10LIMIT_DEFINITION\x10\x05*a\n\x08LogLevel\x12\x15\n\x11NOT_SET_LOG_LEVEL\x10\x00\x12\t\n\x05TRACE\x10\x01\x12\t\n\x05\x44\x45\x42UG\x10\x02\x12\x08\n\x04INFO\x10\x03\x12\x08\n\x04WARN\x10\x05\x12\t\n\x05\x45RROR\x10\x06\x12\t\n\x05\x46\x41TAL\x10\t*G\n\tOnFailure\x12\x0b\n\x07NOT_SET\x10\x00\x12\x10\n\x0cLOG_AND_PASS\x10\x01\x12\x10\n\x0cLOG_AND_FAIL\x10\x02\x12\t\n\x05THROW\x10\x03\x42\x1d\n\x13\x63loud.prefab.domainB\x06Prefabb\x06proto3"
9
+
10
+ pool = Google::Protobuf::DescriptorPool.generated_pool
11
+
12
+ begin
13
+ pool.add_serialized_file(descriptor_data)
14
+ rescue TypeError => e
15
+ # Compatibility code: will be removed in the next major version.
16
+ require 'google/protobuf/descriptor_pb'
17
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
18
+ parsed.clear_dependency
19
+ serialized = parsed.class.encode(parsed)
20
+ file = pool.add_serialized_file(serialized)
21
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
22
+ imports = [
23
+ ]
24
+ imports.each do |type_name, expected_filename|
25
+ import_file = pool.lookup(type_name).file_descriptor
26
+ if import_file.name != expected_filename
27
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
225
28
  end
226
29
  end
30
+ warn "Each proto file must use a consistent fully-qualified name."
31
+ warn "This will become an error in the next major version."
227
32
  end
228
33
 
229
- module Prefab
34
+ module PrefabProto
230
35
  ConfigServicePointer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigServicePointer").msgclass
231
36
  ConfigValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigValue").msgclass
37
+ IntRange = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.IntRange").msgclass
232
38
  StringList = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.StringList").msgclass
233
39
  WeightedValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.WeightedValue").msgclass
234
40
  WeightedValues = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.WeightedValues").msgclass
@@ -246,6 +52,8 @@ module Prefab
246
52
  LimitResponse::LimitPolicyNames = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitResponse.LimitPolicyNames").enummodule
247
53
  LimitRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitRequest").msgclass
248
54
  LimitRequest::LimitCombiner = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitRequest.LimitCombiner").enummodule
55
+ ContextSet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ContextSet").msgclass
56
+ Context = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.Context").msgclass
249
57
  Identity = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.Identity").msgclass
250
58
  ClientConfigValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ClientConfigValue").msgclass
251
59
  ConfigEvaluations = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigEvaluations").msgclass
@@ -258,6 +66,11 @@ module Prefab
258
66
  CreationResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.CreationResponse").msgclass
259
67
  IdBlock = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.IdBlock").msgclass
260
68
  IdBlockRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.IdBlockRequest").msgclass
69
+ ContextShape = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ContextShape").msgclass
70
+ ContextShapes = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ContextShapes").msgclass
71
+ EvaluatedKeys = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.EvaluatedKeys").msgclass
72
+ EvaluatedConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.EvaluatedConfig").msgclass
73
+ EvaluatedConfigs = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.EvaluatedConfigs").msgclass
261
74
  ConfigType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigType").enummodule
262
75
  LogLevel = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LogLevel").enummodule
263
76
  OnFailure = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.OnFailure").enummodule
@@ -2,19 +2,21 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: prefab-cloud-ruby 0.24.3 ruby lib
5
+ # stub: prefab-cloud-ruby 0.24.5 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "prefab-cloud-ruby".freeze
9
- s.version = "0.24.3"
9
+ s.version = "0.24.5"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Jeff Dwyer".freeze]
14
- s.date = "2023-05-15"
14
+ s.date = "2023-07-10"
15
15
  s.description = "Feature Flags, Live Config, and Dynamic Log Levels as a service".freeze
16
16
  s.email = "jdwyer@prefab.cloud".freeze
17
+ s.executables = ["console".freeze]
17
18
  s.extra_rdoc_files = [
19
+ "CHANGELOG.md",
18
20
  "LICENSE.txt",
19
21
  "README.md"
20
22
  ]
@@ -23,7 +25,9 @@ Gem::Specification.new do |s|
23
25
  ".envrc.sample",
24
26
  ".github/workflows/ruby.yml",
25
27
  ".gitmodules",
28
+ ".rubocop.yml",
26
29
  ".tool-versions",
30
+ "CHANGELOG.md",
27
31
  "CODEOWNERS",
28
32
  "Gemfile",
29
33
  "Gemfile.lock",
@@ -31,6 +35,7 @@ Gem::Specification.new do |s|
31
35
  "README.md",
32
36
  "Rakefile",
33
37
  "VERSION",
38
+ "bin/console",
34
39
  "compile_protos.sh",
35
40
  "lib/prefab-cloud-ruby.rb",
36
41
  "lib/prefab/client.rb",
@@ -38,25 +43,32 @@ Gem::Specification.new do |s|
38
43
  "lib/prefab/config_loader.rb",
39
44
  "lib/prefab/config_resolver.rb",
40
45
  "lib/prefab/config_value_unwrapper.rb",
46
+ "lib/prefab/config_value_wrapper.rb",
41
47
  "lib/prefab/context.rb",
48
+ "lib/prefab/context_shape.rb",
49
+ "lib/prefab/context_shape_aggregator.rb",
42
50
  "lib/prefab/criteria_evaluator.rb",
43
51
  "lib/prefab/error.rb",
44
52
  "lib/prefab/errors/initialization_timeout_error.rb",
45
53
  "lib/prefab/errors/invalid_api_key_error.rb",
46
54
  "lib/prefab/errors/missing_default_error.rb",
55
+ "lib/prefab/evaluated_configs_aggregator.rb",
56
+ "lib/prefab/evaluated_keys_aggregator.rb",
47
57
  "lib/prefab/exponential_backoff.rb",
48
58
  "lib/prefab/feature_flag_client.rb",
49
59
  "lib/prefab/http_connection.rb",
50
60
  "lib/prefab/internal_logger.rb",
51
61
  "lib/prefab/local_config_parser.rb",
52
- "lib/prefab/log_path_collector.rb",
62
+ "lib/prefab/log_path_aggregator.rb",
53
63
  "lib/prefab/logger_client.rb",
54
64
  "lib/prefab/murmer3.rb",
55
65
  "lib/prefab/noop_cache.rb",
56
66
  "lib/prefab/noop_stats.rb",
57
67
  "lib/prefab/options.rb",
68
+ "lib/prefab/periodic_sync.rb",
58
69
  "lib/prefab/resolved_config_presenter.rb",
59
70
  "lib/prefab/sse_logger.rb",
71
+ "lib/prefab/time_helpers.rb",
60
72
  "lib/prefab/weighted_value_resolver.rb",
61
73
  "lib/prefab/yaml_config_parser.rb",
62
74
  "lib/prefab_pb.rb",
@@ -71,13 +83,17 @@ Gem::Specification.new do |s|
71
83
  "test/test_config_resolver.rb",
72
84
  "test/test_config_value_unwrapper.rb",
73
85
  "test/test_context.rb",
86
+ "test/test_context_shape.rb",
87
+ "test/test_context_shape_aggregator.rb",
74
88
  "test/test_criteria_evaluator.rb",
89
+ "test/test_evaluated_configs_aggregator.rb",
90
+ "test/test_evaluated_keys_aggregator.rb",
75
91
  "test/test_exponential_backoff.rb",
76
92
  "test/test_feature_flag_client.rb",
77
93
  "test/test_helper.rb",
78
94
  "test/test_integration.rb",
79
95
  "test/test_local_config_parser.rb",
80
- "test/test_log_path_collector.rb",
96
+ "test/test_log_path_aggregator.rb",
81
97
  "test/test_logger.rb",
82
98
  "test/test_options.rb",
83
99
  "test/test_weighted_value_resolver.rb"
@@ -44,31 +44,31 @@ class TestConfigLoader < Minitest::Test
44
44
 
45
45
  def test_highwater
46
46
  assert_equal 0, @loader.highwater_mark
47
- @loader.set(Prefab::Config.new(id: 1, key: 'sample_int', rows: [config_row(Prefab::ConfigValue.new(int: 456))]),
47
+ @loader.set(PrefabProto::Config.new(id: 1, key: 'sample_int', rows: [config_row(PrefabProto::ConfigValue.new(int: 456))]),
48
48
  'test')
49
49
  assert_equal 1, @loader.highwater_mark
50
50
 
51
- @loader.set(Prefab::Config.new(id: 5, key: 'sample_int', rows: [config_row(Prefab::ConfigValue.new(int: 456))]),
51
+ @loader.set(PrefabProto::Config.new(id: 5, key: 'sample_int', rows: [config_row(PrefabProto::ConfigValue.new(int: 456))]),
52
52
  'test')
53
53
  assert_equal 5, @loader.highwater_mark
54
- @loader.set(Prefab::Config.new(id: 2, key: 'sample_int', rows: [config_row(Prefab::ConfigValue.new(int: 456))]),
54
+ @loader.set(PrefabProto::Config.new(id: 2, key: 'sample_int', rows: [config_row(PrefabProto::ConfigValue.new(int: 456))]),
55
55
  'test')
56
56
  assert_equal 5, @loader.highwater_mark
57
57
  end
58
58
 
59
59
  def test_keeps_most_recent
60
60
  assert_equal 0, @loader.highwater_mark
61
- @loader.set(Prefab::Config.new(id: 1, key: 'sample_int', rows: [config_row(Prefab::ConfigValue.new(int: 1))]),
61
+ @loader.set(PrefabProto::Config.new(id: 1, key: 'sample_int', rows: [config_row(PrefabProto::ConfigValue.new(int: 1))]),
62
62
  'test')
63
63
  assert_equal 1, @loader.highwater_mark
64
64
  should_be :int, 1, 'sample_int'
65
65
 
66
- @loader.set(Prefab::Config.new(id: 4, key: 'sample_int', rows: [config_row(Prefab::ConfigValue.new(int: 4))]),
66
+ @loader.set(PrefabProto::Config.new(id: 4, key: 'sample_int', rows: [config_row(PrefabProto::ConfigValue.new(int: 4))]),
67
67
  'test')
68
68
  assert_equal 4, @loader.highwater_mark
69
69
  should_be :int, 4, 'sample_int'
70
70
 
71
- @loader.set(Prefab::Config.new(id: 2, key: 'sample_int', rows: [config_row(Prefab::ConfigValue.new(int: 2))]),
71
+ @loader.set(PrefabProto::Config.new(id: 2, key: 'sample_int', rows: [config_row(PrefabProto::ConfigValue.new(int: 2))]),
72
72
  'test')
73
73
  assert_equal 4, @loader.highwater_mark
74
74
  should_be :int, 4, 'sample_int'
@@ -77,29 +77,29 @@ class TestConfigLoader < Minitest::Test
77
77
  def test_api_precedence
78
78
  should_be :int, 123, 'sample_int'
79
79
 
80
- @loader.set(Prefab::Config.new(key: 'sample_int', rows: [config_row(Prefab::ConfigValue.new(int: 456))]), 'test')
80
+ @loader.set(PrefabProto::Config.new(key: 'sample_int', rows: [config_row(PrefabProto::ConfigValue.new(int: 456))]), 'test')
81
81
  should_be :int, 456, 'sample_int'
82
82
  end
83
83
 
84
84
  def test_api_deltas
85
- val = Prefab::ConfigValue.new(int: 456)
86
- config = Prefab::Config.new(key: 'sample_int', rows: [config_row(val)])
85
+ val = PrefabProto::ConfigValue.new(int: 456)
86
+ config = PrefabProto::Config.new(key: 'sample_int', rows: [config_row(val)])
87
87
  @loader.set(config, 'test')
88
88
 
89
- configs = Prefab::Configs.new
89
+ configs = PrefabProto::Configs.new
90
90
  configs.configs << config
91
91
  assert_equal configs, @loader.get_api_deltas
92
92
  end
93
93
 
94
94
  def test_loading_tombstones_removes_entries
95
- val = Prefab::ConfigValue.new(int: 456)
96
- config = Prefab::Config.new(key: 'sample_int', rows: [config_row(val)], id: 2)
95
+ val = PrefabProto::ConfigValue.new(int: 456)
96
+ config = PrefabProto::Config.new(key: 'sample_int', rows: [config_row(val)], id: 2)
97
97
  @loader.set(config, 'test')
98
98
 
99
- config = Prefab::Config.new(key: 'sample_int', rows: [], id: 3)
99
+ config = PrefabProto::Config.new(key: 'sample_int', rows: [], id: 3)
100
100
  @loader.set(config, 'test')
101
101
 
102
- configs = Prefab::Configs.new
102
+ configs = PrefabProto::Configs.new
103
103
  assert_equal configs, @loader.get_api_deltas
104
104
  end
105
105
 
@@ -111,6 +111,6 @@ class TestConfigLoader < Minitest::Test
111
111
  end
112
112
 
113
113
  def config_row(value)
114
- Prefab::ConfigRow.new(values: [Prefab::ConditionalValue.new(value: value)])
114
+ PrefabProto::ConfigRow.new(values: [PrefabProto::ConditionalValue.new(value: value)])
115
115
  end
116
116
  end