Class: LaunchDarkly::DataSystem::ConfigBuilder
- Inherits:
-
Object
- Object
- LaunchDarkly::DataSystem::ConfigBuilder
- Defined in:
- lib/ldclient-rb/data_system/config_builder.rb
Overview
Builder for the data system configuration.
This builder configures the overall data acquisition strategy for the SDK, including which data sources to use for initialization and synchronization, and how to interact with a persistent data store.
Instance Method Summary collapse
-
#build ⇒ DataSystemConfig
Builds the data system configuration.
-
#data_store(data_store, store_mode) ⇒ ConfigBuilder
Sets the data store configuration for the data system.
-
#fdv1_compatible_synchronizer(fallback) ⇒ ConfigBuilder
Configures the SDK with a fallback synchronizer that is compatible with the Flag Delivery v1 API.
-
#initialize ⇒ ConfigBuilder
constructor
A new instance of ConfigBuilder.
-
#initializers(initializers) ⇒ ConfigBuilder
Sets the initializers for the data system.
-
#overrides(source) ⇒ ConfigBuilder
Configures the SDK with an override source.
-
#synchronizers(synchronizers) ⇒ ConfigBuilder
Sets the synchronizers for the data system.
Constructor Details
#initialize ⇒ ConfigBuilder
Returns a new instance of ConfigBuilder.
20 21 22 23 24 25 26 27 |
# File 'lib/ldclient-rb/data_system/config_builder.rb', line 20 def initialize @initializers = nil @synchronizers = nil @fdv1_fallback_synchronizer = nil @data_store_mode = LaunchDarkly::Interfaces::DataSystem::DataStoreMode::READ_ONLY @data_store = nil @overrides = nil end |
Instance Method Details
#build ⇒ DataSystemConfig
Builds the data system configuration.
126 127 128 129 130 131 132 133 134 135 |
# File 'lib/ldclient-rb/data_system/config_builder.rb', line 126 def build DataSystemConfig.new( initializers: @initializers, synchronizers: @synchronizers, data_store_mode: @data_store_mode, data_store: @data_store, fdv1_fallback_synchronizer: @fdv1_fallback_synchronizer, overrides: @overrides ) end |
#data_store(data_store, store_mode) ⇒ ConfigBuilder
Sets the data store configuration for the data system.
83 84 85 86 87 |
# File 'lib/ldclient-rb/data_system/config_builder.rb', line 83 def data_store(data_store, store_mode) @data_store = data_store @data_store_mode = store_mode self end |
#fdv1_compatible_synchronizer(fallback) ⇒ ConfigBuilder
Configures the SDK with a fallback synchronizer that is compatible with the Flag Delivery v1 API.
This fallback is used when the server signals that the environment should revert to FDv1 protocol. Most users will not need to set this directly.
70 71 72 73 |
# File 'lib/ldclient-rb/data_system/config_builder.rb', line 70 def fdv1_compatible_synchronizer(fallback) @fdv1_fallback_synchronizer = fallback self end |
#initializers(initializers) ⇒ ConfigBuilder
Sets the initializers for the data system.
Initializers are used to fetch an initial set of data when the SDK starts. They are tried in order; if the first one fails, the next is tried, and so on.
39 40 41 42 |
# File 'lib/ldclient-rb/data_system/config_builder.rb', line 39 def initializers(initializers) @initializers = initializers self end |
#overrides(source) ⇒ ConfigBuilder
Configures the SDK with an override source. Flag overrides are currently experimental and subject to change.
Overrides are flag and segment definitions that take precedence over data received from LaunchDarkly at evaluation time, on a per-key basis. They exist for resilience during an incident. Overrides let an operator force one or more flags to a known state on a running client, whether or not the client can reach LaunchDarkly. Flags not present in the override data are completely unaffected.
The override source is not a data source. It has no effect on the client's initialization status, data availability, or data source status. Without a configured source, or while the source supplies no overrides, the SDK behaves as it would without this feature.
At most one override source can be configured. A later call replaces an earlier one.
When the client is offline, the source is not built or started: no overrides are served, and a configuration error in the source is not reported. The SDK logs a warning instead.
116 117 118 119 |
# File 'lib/ldclient-rb/data_system/config_builder.rb', line 116 def overrides(source) @overrides = source self end |
#synchronizers(synchronizers) ⇒ ConfigBuilder
Sets the synchronizers for the data system.
Synchronizers keep data up-to-date after initialization. Like initializers, they are tried in order. If the primary synchronizer fails, the next one takes over.
55 56 57 58 |
# File 'lib/ldclient-rb/data_system/config_builder.rb', line 55 def synchronizers(synchronizers) @synchronizers = synchronizers self end |