launchdarkly-server-sdk 6.2.5 → 7.0.0
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.
- checksums.yaml +4 -4
- data/README.md +1 -2
- data/lib/ldclient-rb/config.rb +203 -43
- data/lib/ldclient-rb/context.rb +487 -0
- data/lib/ldclient-rb/evaluation_detail.rb +85 -26
- data/lib/ldclient-rb/events.rb +185 -146
- data/lib/ldclient-rb/flags_state.rb +25 -14
- data/lib/ldclient-rb/impl/big_segments.rb +117 -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/diagnostic_events.rb +9 -10
- data/lib/ldclient-rb/impl/evaluator.rb +428 -132
- 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 +6 -6
- data/lib/ldclient-rb/impl/event_summarizer.rb +68 -0
- data/lib/ldclient-rb/impl/event_types.rb +78 -0
- data/lib/ldclient-rb/impl/integrations/consul_impl.rb +7 -7
- data/lib/ldclient-rb/impl/integrations/dynamodb_impl.rb +92 -28
- data/lib/ldclient-rb/impl/integrations/file_data_source.rb +212 -0
- data/lib/ldclient-rb/impl/integrations/redis_impl.rb +165 -32
- data/lib/ldclient-rb/impl/integrations/test_data/test_data_source.rb +40 -0
- data/lib/ldclient-rb/impl/model/clause.rb +39 -0
- data/lib/ldclient-rb/impl/model/feature_flag.rb +213 -0
- data/lib/ldclient-rb/impl/model/preprocessed_data.rb +64 -0
- data/lib/ldclient-rb/impl/model/segment.rb +126 -0
- data/lib/ldclient-rb/impl/model/serialization.rb +54 -44
- data/lib/ldclient-rb/impl/repeating_task.rb +47 -0
- 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 +62 -1
- data/lib/ldclient-rb/in_memory_store.rb +2 -2
- data/lib/ldclient-rb/integrations/consul.rb +9 -2
- data/lib/ldclient-rb/integrations/dynamodb.rb +47 -2
- data/lib/ldclient-rb/integrations/file_data.rb +108 -0
- data/lib/ldclient-rb/integrations/redis.rb +43 -3
- data/lib/ldclient-rb/integrations/test_data/flag_builder.rb +594 -0
- data/lib/ldclient-rb/integrations/test_data.rb +213 -0
- data/lib/ldclient-rb/integrations/util/store_wrapper.rb +14 -9
- data/lib/ldclient-rb/integrations.rb +2 -51
- data/lib/ldclient-rb/interfaces.rb +151 -1
- data/lib/ldclient-rb/ldclient.rb +175 -133
- data/lib/ldclient-rb/memoized_value.rb +1 -1
- data/lib/ldclient-rb/non_blocking_thread_pool.rb +1 -1
- data/lib/ldclient-rb/polling.rb +22 -41
- data/lib/ldclient-rb/reference.rb +274 -0
- data/lib/ldclient-rb/requestor.rb +7 -7
- data/lib/ldclient-rb/stream.rb +9 -9
- data/lib/ldclient-rb/util.rb +11 -17
- data/lib/ldclient-rb/version.rb +1 -1
- data/lib/ldclient-rb.rb +2 -4
- metadata +49 -23
- data/lib/ldclient-rb/event_summarizer.rb +0 -55
- data/lib/ldclient-rb/file_data_source.rb +0 -314
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e189d76d654dbf73dc95e9cea758b81bc0df93d9012ebb6560d0994e6dff227c
|
4
|
+
data.tar.gz: fc8bdc8b9affee0e51ef233c217cfa4a3c7fbdbceb4694c38c5a2e90155205ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fb89d48c3185f7019cd170f36f571b1ca2f7de130c624d6301fbfd30d46a0ae7a986494393ab290fa23b66511ce676b660533e1ad23d3a9e01fb037e20db6c4
|
7
|
+
data.tar.gz: 7e706747d2fcd1ab299a76eca7bf26908dbe97972b8c1ea74cfae6bc6aaffe866ddfc157b26675eb44fb22044c74efff88e7c5c4bf8dc0e75fa93dfe0ddbea8a
|
data/README.md
CHANGED
@@ -3,8 +3,7 @@ LaunchDarkly Server-side SDK for Ruby
|
|
3
3
|
|
4
4
|
[](http://badge.fury.io/rb/launchdarkly-server-sdk)
|
5
5
|
|
6
|
-
[](https://hakiri.io/github/launchdarkly/ruby-server-sdk/master)
|
6
|
+
[](https://circleci.com/gh/launchdarkly/ruby-server-sdk/tree/main)
|
8
7
|
[](https://www.rubydoc.info/gems/launchdarkly-server-sdk)
|
9
8
|
[](https://launchdarkly.github.io/ruby-server-sdk)
|
10
9
|
|
data/lib/ldclient-rb/config.rb
CHANGED
@@ -13,6 +13,18 @@ module LaunchDarkly
|
|
13
13
|
#
|
14
14
|
# Constructor for creating custom LaunchDarkly configurations.
|
15
15
|
#
|
16
|
+
# `user_keys_capacity` and `user_keys_flush_interval` are deprecated
|
17
|
+
# configuration options. They exist to maintain backwards compatibility
|
18
|
+
# with previous configurations. Newer code should prefer their replacement
|
19
|
+
# options -- `context_keys_capacity` and `context_keys_flush_interval`.
|
20
|
+
#
|
21
|
+
# In the event both the user and context variations are provided, the
|
22
|
+
# context specific configuration option will take precedence.
|
23
|
+
#
|
24
|
+
# Similarly, `private_attribute_names` is deprecated. Newer code should
|
25
|
+
# prefer `private_attributes`. If both are provided, `private_attributes`
|
26
|
+
# will take precedence.
|
27
|
+
#
|
16
28
|
# @param opts [Hash] the configuration options
|
17
29
|
# @option opts [Logger] :logger See {#logger}.
|
18
30
|
# @option opts [String] :base_uri ("https://sdk.launchdarkly.com") See {#base_uri}.
|
@@ -21,6 +33,7 @@ module LaunchDarkly
|
|
21
33
|
# @option opts [Integer] :capacity (10000) See {#capacity}.
|
22
34
|
# @option opts [Float] :flush_interval (30) See {#flush_interval}.
|
23
35
|
# @option opts [Float] :read_timeout (10) See {#read_timeout}.
|
36
|
+
# @option opts [Float] :initial_reconnect_delay (1) See {#initial_reconnect_delay}.
|
24
37
|
# @option opts [Float] :connect_timeout (2) See {#connect_timeout}.
|
25
38
|
# @option opts [Object] :cache_store See {#cache_store}.
|
26
39
|
# @option opts [Object] :feature_store See {#feature_store}.
|
@@ -30,18 +43,20 @@ module LaunchDarkly
|
|
30
43
|
# @option opts [Boolean] :stream (true) See {#stream?}.
|
31
44
|
# @option opts [Boolean] all_attributes_private (false) See {#all_attributes_private}.
|
32
45
|
# @option opts [Array] :private_attribute_names See {#private_attribute_names}.
|
46
|
+
# @option opts [Array] :private_attributes See {#private_attributes}.
|
33
47
|
# @option opts [Boolean] :send_events (true) See {#send_events}.
|
34
48
|
# @option opts [Integer] :user_keys_capacity (1000) See {#user_keys_capacity}.
|
49
|
+
# @option opts [Integer] :context_keys_capacity (1000) See {#context_keys_capacity}.
|
35
50
|
# @option opts [Float] :user_keys_flush_interval (300) See {#user_keys_flush_interval}.
|
36
|
-
# @option opts [
|
51
|
+
# @option opts [Float] :context_keys_flush_interval (300) See {#context_keys_flush_interval}.
|
37
52
|
# @option opts [Object] :data_source See {#data_source}.
|
38
|
-
# @option opts [Object] :update_processor Obsolete synonym for `data_source`.
|
39
|
-
# @option opts [Object] :update_processor_factory Obsolete synonym for `data_source`.
|
40
53
|
# @option opts [Boolean] :diagnostic_opt_out (false) See {#diagnostic_opt_out?}.
|
41
54
|
# @option opts [Float] :diagnostic_recording_interval (900) See {#diagnostic_recording_interval}.
|
42
55
|
# @option opts [String] :wrapper_name See {#wrapper_name}.
|
43
56
|
# @option opts [String] :wrapper_version See {#wrapper_version}.
|
44
57
|
# @option opts [#open] :socket_factory See {#socket_factory}.
|
58
|
+
# @option opts [BigSegmentsConfig] :big_segments See {#big_segments}.
|
59
|
+
# @option opts [Hash] :application See {#application}
|
45
60
|
#
|
46
61
|
def initialize(opts = {})
|
47
62
|
@base_uri = (opts[:base_uri] || Config.default_base_uri).chomp("/")
|
@@ -53,26 +68,26 @@ module LaunchDarkly
|
|
53
68
|
@flush_interval = opts[:flush_interval] || Config.default_flush_interval
|
54
69
|
@connect_timeout = opts[:connect_timeout] || Config.default_connect_timeout
|
55
70
|
@read_timeout = opts[:read_timeout] || Config.default_read_timeout
|
71
|
+
@initial_reconnect_delay = opts[:initial_reconnect_delay] || Config.default_initial_reconnect_delay
|
56
72
|
@feature_store = opts[:feature_store] || Config.default_feature_store
|
57
73
|
@stream = opts.has_key?(:stream) ? opts[:stream] : Config.default_stream
|
58
74
|
@use_ldd = opts.has_key?(:use_ldd) ? opts[:use_ldd] : Config.default_use_ldd
|
59
75
|
@offline = opts.has_key?(:offline) ? opts[:offline] : Config.default_offline
|
60
76
|
@poll_interval = opts.has_key?(:poll_interval) && opts[:poll_interval] > Config.default_poll_interval ? opts[:poll_interval] : Config.default_poll_interval
|
61
77
|
@all_attributes_private = opts[:all_attributes_private] || false
|
62
|
-
@
|
78
|
+
@private_attributes = opts[:private_attributes] || opts[:private_attribute_names] || []
|
63
79
|
@send_events = opts.has_key?(:send_events) ? opts[:send_events] : Config.default_send_events
|
64
|
-
@
|
65
|
-
@
|
66
|
-
@
|
67
|
-
@data_source = opts[:data_source] || opts[:update_processor] || opts[:update_processor_factory]
|
68
|
-
@update_processor = opts[:update_processor]
|
69
|
-
@update_processor_factory = opts[:update_processor_factory]
|
80
|
+
@context_keys_capacity = opts[:context_keys_capacity] || opts[:user_keys_capacity] || Config.default_context_keys_capacity
|
81
|
+
@context_keys_flush_interval = opts[:context_keys_flush_interval] || opts[:user_keys_flush_interval] || Config.default_user_keys_flush_interval
|
82
|
+
@data_source = opts[:data_source]
|
70
83
|
@diagnostic_opt_out = opts.has_key?(:diagnostic_opt_out) && opts[:diagnostic_opt_out]
|
71
84
|
@diagnostic_recording_interval = opts.has_key?(:diagnostic_recording_interval) && opts[:diagnostic_recording_interval] > Config.minimum_diagnostic_recording_interval ?
|
72
85
|
opts[:diagnostic_recording_interval] : Config.default_diagnostic_recording_interval
|
73
86
|
@wrapper_name = opts[:wrapper_name]
|
74
87
|
@wrapper_version = opts[:wrapper_version]
|
75
88
|
@socket_factory = opts[:socket_factory]
|
89
|
+
@big_segments = opts[:big_segments] || BigSegmentsConfig.new(store: nil)
|
90
|
+
@application = LaunchDarkly::Impl::Util.validate_application_info(opts[:application] || {}, @logger)
|
76
91
|
end
|
77
92
|
|
78
93
|
#
|
@@ -120,7 +135,7 @@ module LaunchDarkly
|
|
120
135
|
def use_ldd?
|
121
136
|
@use_ldd
|
122
137
|
end
|
123
|
-
|
138
|
+
|
124
139
|
#
|
125
140
|
# Whether the client should be initialized in offline mode. In offline mode, default values are
|
126
141
|
# returned for all flags and no remote network requests are made.
|
@@ -178,6 +193,13 @@ module LaunchDarkly
|
|
178
193
|
#
|
179
194
|
attr_reader :read_timeout
|
180
195
|
|
196
|
+
#
|
197
|
+
# The initial delay before reconnecting after an error in the SSE client.
|
198
|
+
# This only applies to the streaming connection.
|
199
|
+
# @return [Float]
|
200
|
+
#
|
201
|
+
attr_reader :initial_reconnect_delay
|
202
|
+
|
181
203
|
#
|
182
204
|
# The connect timeout for network connections in seconds.
|
183
205
|
# @return [Float]
|
@@ -196,28 +218,37 @@ module LaunchDarkly
|
|
196
218
|
attr_reader :feature_store
|
197
219
|
|
198
220
|
#
|
199
|
-
# True if all
|
221
|
+
# True if all context attributes (other than the key) should be considered private. This means
|
200
222
|
# that the attribute values will not be sent to LaunchDarkly in analytics events and will not
|
201
223
|
# appear on the LaunchDarkly dashboard.
|
202
224
|
# @return [Boolean]
|
203
|
-
# @see #
|
225
|
+
# @see #private_attributes
|
204
226
|
#
|
205
227
|
attr_reader :all_attributes_private
|
206
228
|
|
207
229
|
#
|
208
|
-
# A list of
|
230
|
+
# A list of context attribute names that should always be considered private. This means that the
|
209
231
|
# attribute values will not be sent to LaunchDarkly in analytics events and will not appear on
|
210
232
|
# the LaunchDarkly dashboard.
|
211
233
|
#
|
212
|
-
# You can also specify the same behavior for an individual flag evaluation
|
213
|
-
#
|
214
|
-
#
|
234
|
+
# You can also specify the same behavior for an individual flag evaluation
|
235
|
+
# by providing the context object with a list of private attributes.
|
236
|
+
#
|
237
|
+
# @see https://docs.launchdarkly.com/sdk/features/user-context-config#using-private-attributes
|
215
238
|
#
|
216
239
|
# @return [Array<String>]
|
217
240
|
# @see #all_attributes_private
|
218
241
|
#
|
219
|
-
attr_reader :
|
220
|
-
|
242
|
+
attr_reader :private_attributes
|
243
|
+
|
244
|
+
#
|
245
|
+
# @deprecated Backwards compatibility alias for #private_attributes.
|
246
|
+
#
|
247
|
+
# @return [Integer]
|
248
|
+
# @see #private_attributes
|
249
|
+
#
|
250
|
+
alias :private_attribute_names :private_attributes
|
251
|
+
|
221
252
|
#
|
222
253
|
# Whether to send events back to LaunchDarkly. This differs from {#offline?} in that it affects
|
223
254
|
# only the sending of client-side events, not streaming or polling for events from the server.
|
@@ -226,27 +257,35 @@ module LaunchDarkly
|
|
226
257
|
attr_reader :send_events
|
227
258
|
|
228
259
|
#
|
229
|
-
# The number of
|
230
|
-
# amount of duplicate
|
260
|
+
# The number of context keys that the event processor can remember at any one time. This reduces the
|
261
|
+
# amount of duplicate context details sent in analytics events.
|
262
|
+
# @return [Integer]
|
263
|
+
# @see #context_keys_flush_interval
|
264
|
+
#
|
265
|
+
attr_reader :context_keys_capacity
|
266
|
+
|
267
|
+
#
|
268
|
+
# @deprecated Backwards compatibility alias for #context_keys_capacity.
|
269
|
+
#
|
231
270
|
# @return [Integer]
|
232
|
-
# @see #
|
271
|
+
# @see #context_keys_flush_interval
|
233
272
|
#
|
234
|
-
|
273
|
+
alias :user_keys_capacity :context_keys_capacity
|
235
274
|
|
236
275
|
#
|
237
|
-
# The interval in seconds at which the event processor will reset its set of known
|
276
|
+
# The interval in seconds at which the event processor will reset its set of known context keys.
|
238
277
|
# @return [Float]
|
239
|
-
# @see #
|
278
|
+
# @see #context_keys_capacity
|
240
279
|
#
|
241
|
-
attr_reader :
|
280
|
+
attr_reader :context_keys_flush_interval
|
242
281
|
|
243
282
|
#
|
244
|
-
#
|
245
|
-
# include the user key, except for one "index" event that provides the full details for the user.
|
246
|
-
# The only reason to change this is if you are using the Analytics Data Stream.
|
247
|
-
# @return [Boolean]
|
283
|
+
# @deprecated Backwards compatibility alias for #context_keys_flush_interval.
|
248
284
|
#
|
249
|
-
|
285
|
+
# @return [Integer]
|
286
|
+
# @see #context_keys_flush_interval
|
287
|
+
#
|
288
|
+
alias :user_keys_flush_interval :context_keys_flush_interval
|
250
289
|
|
251
290
|
#
|
252
291
|
# An object that is responsible for receiving feature flag data from LaunchDarkly. By default,
|
@@ -258,15 +297,38 @@ module LaunchDarkly
|
|
258
297
|
# object.
|
259
298
|
#
|
260
299
|
# @return [LaunchDarkly::Interfaces::DataSource|lambda]
|
261
|
-
# @see
|
300
|
+
# @see LaunchDarkly::Integrations::FileData
|
301
|
+
# @see LaunchDarkly::Integrations::TestData
|
262
302
|
#
|
263
303
|
attr_reader :data_source
|
264
304
|
|
265
|
-
#
|
266
|
-
|
267
|
-
|
268
|
-
#
|
269
|
-
|
305
|
+
#
|
306
|
+
# Configuration options related to Big Segments.
|
307
|
+
#
|
308
|
+
# Big Segments are a specific type of segments. For more information, read the LaunchDarkly
|
309
|
+
# documentation: https://docs.launchdarkly.com/home/users/big-segments
|
310
|
+
#
|
311
|
+
# @return [BigSegmentsConfig]
|
312
|
+
#
|
313
|
+
attr_reader :big_segments
|
314
|
+
|
315
|
+
#
|
316
|
+
# An object that allows configuration of application metadata.
|
317
|
+
#
|
318
|
+
# Application metadata may be used in LaunchDarkly analytics or other product features, but does not affect feature flag evaluations.
|
319
|
+
#
|
320
|
+
# If you want to set non-default values for any of these fields, provide the appropriately configured hash to the {Config} object.
|
321
|
+
#
|
322
|
+
# @example Configuring application information
|
323
|
+
# opts[:application] = {
|
324
|
+
# id: "MY APPLICATION ID",
|
325
|
+
# version: "MY APPLICATION VERSION"
|
326
|
+
# }
|
327
|
+
# config = LDConfig.new(opts)
|
328
|
+
#
|
329
|
+
# @return [Hash]
|
330
|
+
#
|
331
|
+
attr_reader :application
|
270
332
|
|
271
333
|
#
|
272
334
|
# Set to true to opt out of sending diagnostics data.
|
@@ -382,6 +444,14 @@ module LaunchDarkly
|
|
382
444
|
10
|
383
445
|
end
|
384
446
|
|
447
|
+
#
|
448
|
+
# The default value for {#initial_reconnect_delay}.
|
449
|
+
# @return [Float] 1
|
450
|
+
#
|
451
|
+
def self.default_initial_reconnect_delay
|
452
|
+
1
|
453
|
+
end
|
454
|
+
|
385
455
|
#
|
386
456
|
# The default value for {#connect_timeout}.
|
387
457
|
# @return [Float] 10
|
@@ -396,8 +466,8 @@ module LaunchDarkly
|
|
396
466
|
#
|
397
467
|
def self.default_logger
|
398
468
|
if defined?(Rails) && Rails.respond_to?(:logger)
|
399
|
-
Rails.logger
|
400
|
-
else
|
469
|
+
Rails.logger
|
470
|
+
else
|
401
471
|
log = ::Logger.new($stdout)
|
402
472
|
log.level = ::Logger::WARN
|
403
473
|
log
|
@@ -453,21 +523,33 @@ module LaunchDarkly
|
|
453
523
|
end
|
454
524
|
|
455
525
|
#
|
456
|
-
# The default value for {#
|
526
|
+
# The default value for {#context_keys_capacity}.
|
457
527
|
# @return [Integer] 1000
|
458
528
|
#
|
459
|
-
def self.
|
529
|
+
def self.default_context_keys_capacity
|
460
530
|
1000
|
461
531
|
end
|
462
532
|
|
463
533
|
#
|
464
|
-
# The default value for {#
|
534
|
+
# The default value for {#context_keys_flush_interval}.
|
465
535
|
# @return [Float] 300
|
466
536
|
#
|
467
|
-
def self.
|
537
|
+
def self.default_context_keys_flush_interval
|
468
538
|
300
|
469
539
|
end
|
470
540
|
|
541
|
+
class << self
|
542
|
+
#
|
543
|
+
# @deprecated Backwards compatibility alias for #default_context_keys_capacity
|
544
|
+
#
|
545
|
+
alias :default_user_keys_capacity :default_context_keys_capacity
|
546
|
+
|
547
|
+
#
|
548
|
+
# @deprecated Backwards compatibility alias for #default_context_keys_flush_interval
|
549
|
+
#
|
550
|
+
alias :default_user_keys_flush_interval :default_context_keys_flush_interval
|
551
|
+
end
|
552
|
+
|
471
553
|
#
|
472
554
|
# The default value for {#diagnostic_recording_interval}.
|
473
555
|
# @return [Float] 900
|
@@ -484,4 +566,82 @@ module LaunchDarkly
|
|
484
566
|
60
|
485
567
|
end
|
486
568
|
end
|
569
|
+
|
570
|
+
#
|
571
|
+
# Configuration options related to Big Segments.
|
572
|
+
#
|
573
|
+
# Big Segments are a specific type of segments. For more information, read the LaunchDarkly
|
574
|
+
# documentation: https://docs.launchdarkly.com/home/users/big-segments
|
575
|
+
#
|
576
|
+
# If your application uses Big Segments, you will need to create a `BigSegmentsConfig` that at a
|
577
|
+
# minimum specifies what database integration to use, and then pass the `BigSegmentsConfig`
|
578
|
+
# object as the `big_segments` parameter when creating a {Config}.
|
579
|
+
#
|
580
|
+
# @example Configuring Big Segments with Redis
|
581
|
+
# store = LaunchDarkly::Integrations::Redis::new_big_segments_store(redis_url: "redis://my-server")
|
582
|
+
# config = LaunchDarkly::Config.new(big_segments:
|
583
|
+
# LaunchDarkly::BigSegmentsConfig.new(store: store))
|
584
|
+
# client = LaunchDarkly::LDClient.new(my_sdk_key, config)
|
585
|
+
#
|
586
|
+
class BigSegmentsConfig
|
587
|
+
DEFAULT_CONTEXT_CACHE_SIZE = 1000
|
588
|
+
DEFAULT_CONTEXT_CACHE_TIME = 5
|
589
|
+
DEFAULT_STATUS_POLL_INTERVAL = 5
|
590
|
+
DEFAULT_STALE_AFTER = 2 * 60
|
591
|
+
|
592
|
+
#
|
593
|
+
# Constructor for setting Big Segments options.
|
594
|
+
#
|
595
|
+
# @param store [LaunchDarkly::Interfaces::BigSegmentStore] the data store implementation
|
596
|
+
# @param context_cache_size [Integer] See {#context_cache_size}.
|
597
|
+
# @param context_cache_time [Float] See {#context_cache_time}.
|
598
|
+
# @param status_poll_interval [Float] See {#status_poll_interval}.
|
599
|
+
# @param stale_after [Float] See {#stale_after}.
|
600
|
+
#
|
601
|
+
def initialize(store:, context_cache_size: nil, context_cache_time: nil, status_poll_interval: nil, stale_after: nil)
|
602
|
+
@store = store
|
603
|
+
@context_cache_size = context_cache_size.nil? ? DEFAULT_CONTEXT_CACHE_SIZE : context_cache_size
|
604
|
+
@context_cache_time = context_cache_time.nil? ? DEFAULT_CONTEXT_CACHE_TIME : context_cache_time
|
605
|
+
@status_poll_interval = status_poll_interval.nil? ? DEFAULT_STATUS_POLL_INTERVAL : status_poll_interval
|
606
|
+
@stale_after = stale_after.nil? ? DEFAULT_STALE_AFTER : stale_after
|
607
|
+
end
|
608
|
+
|
609
|
+
# The implementation of {LaunchDarkly::Interfaces::BigSegmentStore} that will be used to
|
610
|
+
# query the Big Segments database.
|
611
|
+
# @return [LaunchDarkly::Interfaces::BigSegmentStore]
|
612
|
+
attr_reader :store
|
613
|
+
|
614
|
+
# The maximum number of contexts whose Big Segment state will be cached by the SDK at any given time.
|
615
|
+
# @return [Integer]
|
616
|
+
attr_reader :context_cache_size
|
617
|
+
|
618
|
+
#
|
619
|
+
# @deprecated Backwards compatibility alias for #context_cache_size
|
620
|
+
#
|
621
|
+
# @return [Integer]
|
622
|
+
#
|
623
|
+
alias :user_cache_size :context_cache_size
|
624
|
+
|
625
|
+
# The maximum length of time (in seconds) that the Big Segment state for a context will be cached
|
626
|
+
# by the SDK.
|
627
|
+
# @return [Float]
|
628
|
+
attr_reader :context_cache_time
|
629
|
+
|
630
|
+
#
|
631
|
+
# @deprecated Backwards compatibility alias for #context_cache_time
|
632
|
+
#
|
633
|
+
# @return [Float]
|
634
|
+
#
|
635
|
+
alias :user_cache_time :context_cache_time
|
636
|
+
|
637
|
+
# The interval (in seconds) at which the SDK will poll the Big Segment store to make sure it is
|
638
|
+
# available and to determine how long ago it was updated.
|
639
|
+
# @return [Float]
|
640
|
+
attr_reader :status_poll_interval
|
641
|
+
|
642
|
+
# The maximum length of time between updates of the Big Segments data before the data is
|
643
|
+
# considered out of date.
|
644
|
+
# @return [Float]
|
645
|
+
attr_reader :stale_after
|
646
|
+
end
|
487
647
|
end
|