launchdarkly-server-sdk 6.3.0 → 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -4
- data/lib/ldclient-rb/config.rb +112 -62
- data/lib/ldclient-rb/context.rb +444 -0
- data/lib/ldclient-rb/evaluation_detail.rb +26 -22
- data/lib/ldclient-rb/events.rb +256 -146
- data/lib/ldclient-rb/flags_state.rb +26 -15
- data/lib/ldclient-rb/impl/big_segments.rb +18 -18
- data/lib/ldclient-rb/impl/broadcaster.rb +78 -0
- data/lib/ldclient-rb/impl/context.rb +96 -0
- data/lib/ldclient-rb/impl/context_filter.rb +145 -0
- data/lib/ldclient-rb/impl/data_source.rb +188 -0
- data/lib/ldclient-rb/impl/data_store.rb +59 -0
- data/lib/ldclient-rb/impl/dependency_tracker.rb +102 -0
- data/lib/ldclient-rb/impl/diagnostic_events.rb +9 -10
- data/lib/ldclient-rb/impl/evaluator.rb +386 -142
- data/lib/ldclient-rb/impl/evaluator_bucketing.rb +40 -41
- data/lib/ldclient-rb/impl/evaluator_helpers.rb +50 -0
- data/lib/ldclient-rb/impl/evaluator_operators.rb +26 -55
- data/lib/ldclient-rb/impl/event_sender.rb +7 -6
- data/lib/ldclient-rb/impl/event_summarizer.rb +68 -0
- data/lib/ldclient-rb/impl/event_types.rb +136 -0
- data/lib/ldclient-rb/impl/flag_tracker.rb +58 -0
- data/lib/ldclient-rb/impl/integrations/consul_impl.rb +19 -7
- data/lib/ldclient-rb/impl/integrations/dynamodb_impl.rb +38 -30
- data/lib/ldclient-rb/impl/integrations/file_data_source.rb +24 -11
- data/lib/ldclient-rb/impl/integrations/redis_impl.rb +109 -12
- data/lib/ldclient-rb/impl/migrations/migrator.rb +287 -0
- data/lib/ldclient-rb/impl/migrations/tracker.rb +136 -0
- data/lib/ldclient-rb/impl/model/clause.rb +45 -0
- data/lib/ldclient-rb/impl/model/feature_flag.rb +255 -0
- data/lib/ldclient-rb/impl/model/preprocessed_data.rb +64 -0
- data/lib/ldclient-rb/impl/model/segment.rb +132 -0
- data/lib/ldclient-rb/impl/model/serialization.rb +54 -44
- data/lib/ldclient-rb/impl/repeating_task.rb +3 -4
- data/lib/ldclient-rb/impl/sampler.rb +25 -0
- data/lib/ldclient-rb/impl/store_client_wrapper.rb +102 -8
- data/lib/ldclient-rb/impl/store_data_set_sorter.rb +2 -2
- data/lib/ldclient-rb/impl/unbounded_pool.rb +1 -1
- data/lib/ldclient-rb/impl/util.rb +59 -1
- data/lib/ldclient-rb/in_memory_store.rb +9 -2
- data/lib/ldclient-rb/integrations/consul.rb +2 -2
- data/lib/ldclient-rb/integrations/dynamodb.rb +2 -2
- data/lib/ldclient-rb/integrations/file_data.rb +4 -4
- data/lib/ldclient-rb/integrations/redis.rb +5 -5
- data/lib/ldclient-rb/integrations/test_data/flag_builder.rb +287 -62
- data/lib/ldclient-rb/integrations/test_data.rb +18 -14
- data/lib/ldclient-rb/integrations/util/store_wrapper.rb +20 -9
- data/lib/ldclient-rb/interfaces.rb +600 -14
- data/lib/ldclient-rb/ldclient.rb +314 -134
- data/lib/ldclient-rb/memoized_value.rb +1 -1
- data/lib/ldclient-rb/migrations.rb +230 -0
- data/lib/ldclient-rb/non_blocking_thread_pool.rb +1 -1
- data/lib/ldclient-rb/polling.rb +52 -6
- data/lib/ldclient-rb/reference.rb +274 -0
- data/lib/ldclient-rb/requestor.rb +9 -11
- data/lib/ldclient-rb/stream.rb +96 -34
- data/lib/ldclient-rb/util.rb +97 -14
- data/lib/ldclient-rb/version.rb +1 -1
- data/lib/ldclient-rb.rb +3 -4
- metadata +65 -23
- data/lib/ldclient-rb/event_summarizer.rb +0 -55
- data/lib/ldclient-rb/file_data_source.rb +0 -23
- data/lib/ldclient-rb/impl/event_factory.rb +0 -126
- data/lib/ldclient-rb/newrelic.rb +0 -17
- data/lib/ldclient-rb/redis_store.rb +0 -88
- data/lib/ldclient-rb/user_filter.rb +0 -52
@@ -22,7 +22,7 @@ module LaunchDarkly
|
|
22
22
|
#
|
23
23
|
class CachingStoreWrapper
|
24
24
|
include LaunchDarkly::Interfaces::FeatureStore
|
25
|
-
|
25
|
+
|
26
26
|
#
|
27
27
|
# Creates a new store wrapper instance.
|
28
28
|
#
|
@@ -43,13 +43,24 @@ module LaunchDarkly
|
|
43
43
|
end
|
44
44
|
|
45
45
|
@inited = Concurrent::AtomicBoolean.new(false)
|
46
|
+
@has_available_method = @core.respond_to? :available?
|
47
|
+
end
|
48
|
+
|
49
|
+
def monitoring_enabled?
|
50
|
+
@has_available_method
|
51
|
+
end
|
52
|
+
|
53
|
+
def available?
|
54
|
+
return false unless @has_available_method
|
55
|
+
|
56
|
+
@core.available?
|
46
57
|
end
|
47
58
|
|
48
59
|
def init(all_data)
|
49
60
|
@core.init_internal(all_data)
|
50
61
|
@inited.make_true
|
51
62
|
|
52
|
-
|
63
|
+
unless @cache.nil?
|
53
64
|
@cache.clear
|
54
65
|
all_data.each do |kind, items|
|
55
66
|
@cache[kind] = items_if_not_deleted(items)
|
@@ -61,15 +72,15 @@ module LaunchDarkly
|
|
61
72
|
end
|
62
73
|
|
63
74
|
def get(kind, key)
|
64
|
-
|
75
|
+
unless @cache.nil?
|
65
76
|
cache_key = item_cache_key(kind, key)
|
66
77
|
cached = @cache[cache_key] # note, item entries in the cache are wrapped in an array so we can cache nil values
|
67
|
-
return item_if_not_deleted(cached[0])
|
78
|
+
return item_if_not_deleted(cached[0]) unless cached.nil?
|
68
79
|
end
|
69
80
|
|
70
81
|
item = @core.get_internal(kind, key)
|
71
82
|
|
72
|
-
|
83
|
+
unless @cache.nil?
|
73
84
|
@cache[cache_key] = [item]
|
74
85
|
end
|
75
86
|
|
@@ -77,20 +88,20 @@ module LaunchDarkly
|
|
77
88
|
end
|
78
89
|
|
79
90
|
def all(kind)
|
80
|
-
|
91
|
+
unless @cache.nil?
|
81
92
|
items = @cache[all_cache_key(kind)]
|
82
|
-
return items
|
93
|
+
return items unless items.nil?
|
83
94
|
end
|
84
95
|
|
85
96
|
items = items_if_not_deleted(@core.get_all_internal(kind))
|
86
|
-
@cache[all_cache_key(kind)] = items
|
97
|
+
@cache[all_cache_key(kind)] = items unless @cache.nil?
|
87
98
|
items
|
88
99
|
end
|
89
100
|
|
90
101
|
def upsert(kind, item)
|
91
102
|
new_state = @core.upsert_internal(kind, item)
|
92
103
|
|
93
|
-
|
104
|
+
unless @cache.nil?
|
94
105
|
@cache[item_cache_key(kind, item[:key])] = [new_state]
|
95
106
|
@cache.delete(all_cache_key(kind))
|
96
107
|
end
|