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.
-
#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 |
# 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 end |
Instance Method Details
#build ⇒ DataSystemConfig
Builds the data system configuration.
93 94 95 96 97 98 99 100 101 |
# File 'lib/ldclient-rb/data_system/config_builder.rb', line 93 def build DataSystemConfig.new( initializers: @initializers, synchronizers: @synchronizers, data_store_mode: @data_store_mode, data_store: @data_store, fdv1_fallback_synchronizer: @fdv1_fallback_synchronizer ) end |
#data_store(data_store, store_mode) ⇒ ConfigBuilder
Sets the data store configuration for the data system.
82 83 84 85 86 |
# File 'lib/ldclient-rb/data_system/config_builder.rb', line 82 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.
69 70 71 72 |
# File 'lib/ldclient-rb/data_system/config_builder.rb', line 69 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.
38 39 40 41 |
# File 'lib/ldclient-rb/data_system/config_builder.rb', line 38 def initializers(initializers) @initializers = initializers 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.
54 55 56 57 |
# File 'lib/ldclient-rb/data_system/config_builder.rb', line 54 def synchronizers(synchronizers) @synchronizers = synchronizers self end |