Module: LaunchDarkly::DataSystem
- Defined in:
- lib/ldclient-rb/data_system.rb
Overview
Configuration for LaunchDarkly's data acquisition strategy.
This module provides factory methods for creating data system configurations.
Defined Under Namespace
Classes: ConfigBuilder
Class Method Summary collapse
-
.custom ⇒ ConfigBuilder
Custom returns a builder suitable for creating a custom data acquisition strategy.
-
.daemon(store) ⇒ ConfigBuilder
Daemon configures the SDK to read from a persistent store integration that is populated by Relay Proxy or other SDKs.
-
.default ⇒ ConfigBuilder
Default is LaunchDarkly's recommended flag data acquisition strategy.
-
.fdv1_fallback_ds_builder ⇒ LaunchDarkly::Impl::DataSystem::FDv1PollingDataSourceBuilder
Returns a builder for creating an FDv1 fallback polling data source.
-
.persistent_store(store) ⇒ ConfigBuilder
PersistentStore is similar to default, with the addition of a persistent store integration.
-
.polling ⇒ ConfigBuilder
Polling configures the SDK to regularly poll an endpoint for flag/segment data in the background.
-
.polling_ds_builder ⇒ LaunchDarkly::Impl::DataSystem::PollingDataSourceBuilder
Returns a builder for creating a polling data source.
-
.streaming ⇒ ConfigBuilder
Streaming configures the SDK to efficiently stream flag/segment data in the background, allowing evaluations to operate on the latest data with no additional latency.
-
.streaming_ds_builder ⇒ LaunchDarkly::Impl::DataSystem::StreamingDataSourceBuilder
Returns a builder for creating a streaming data source.
Class Method Details
.custom ⇒ ConfigBuilder
Custom returns a builder suitable for creating a custom data acquisition strategy. You may configure how the SDK uses a Persistent Store, how the SDK obtains an initial set of data, and how the SDK keeps data up-to-date.
196 197 198 |
# File 'lib/ldclient-rb/data_system.rb', line 196 def self.custom ConfigBuilder.new end |
.daemon(store) ⇒ ConfigBuilder
Daemon configures the SDK to read from a persistent store integration that is populated by Relay Proxy or other SDKs. The SDK will not connect to LaunchDarkly. In this mode, the SDK never writes to the data store.
208 209 210 |
# File 'lib/ldclient-rb/data_system.rb', line 208 def self.daemon(store) custom.data_store(store, LaunchDarkly::Interfaces::DataSystem::DataStoreMode::READ_ONLY) end |
.default ⇒ ConfigBuilder
Default is LaunchDarkly's recommended flag data acquisition strategy.
Currently, it operates a two-phase method for obtaining data: first, it requests data from LaunchDarkly's global CDN. Then, it initiates a streaming connection to LaunchDarkly's Flag Delivery services to receive real-time updates.
If the streaming connection is interrupted for an extended period of time, the SDK will automatically fall back to polling the global CDN for updates.
139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/ldclient-rb/data_system.rb', line 139 def self.default polling_builder = polling_ds_builder streaming_builder = streaming_ds_builder fallback = fdv1_fallback_ds_builder builder = ConfigBuilder.new builder.initializers([polling_builder]) builder.synchronizers([streaming_builder, polling_builder]) builder.fdv1_compatible_synchronizer(fallback) builder end |
.fdv1_fallback_ds_builder ⇒ LaunchDarkly::Impl::DataSystem::FDv1PollingDataSourceBuilder
Returns a builder for creating an FDv1 fallback polling data source. This is a building block that can be used with LaunchDarkly::DataSystem::ConfigBuilder#fdv1_compatible_synchronizer to provide FDv1 compatibility in custom data system configurations.
110 111 112 |
# File 'lib/ldclient-rb/data_system.rb', line 110 def self.fdv1_fallback_ds_builder LaunchDarkly::Impl::DataSystem::FDv1PollingDataSourceBuilder.new end |
.persistent_store(store) ⇒ ConfigBuilder
PersistentStore is similar to default, with the addition of a persistent store integration. Before data has arrived from LaunchDarkly, the SDK is able to evaluate flags using data from the persistent store. Once fresh data is available, the SDK will no longer read from the persistent store, although it will keep it up-to-date.
222 223 224 |
# File 'lib/ldclient-rb/data_system.rb', line 222 def self.persistent_store(store) default.data_store(store, LaunchDarkly::Interfaces::DataSystem::DataStoreMode::READ_WRITE) end |
.polling ⇒ ConfigBuilder
Polling configures the SDK to regularly poll an endpoint for flag/segment data in the background. This is less efficient than streaming, but may be necessary in some network environments.
177 178 179 180 181 182 183 184 185 186 |
# File 'lib/ldclient-rb/data_system.rb', line 177 def self.polling polling_builder = polling_ds_builder fallback = fdv1_fallback_ds_builder builder = ConfigBuilder.new builder.synchronizers([polling_builder]) builder.fdv1_compatible_synchronizer(fallback) builder end |
.polling_ds_builder ⇒ LaunchDarkly::Impl::DataSystem::PollingDataSourceBuilder
Returns a builder for creating a polling data source. This is a building block that can be used with LaunchDarkly::DataSystem::ConfigBuilder#initializers or LaunchDarkly::DataSystem::ConfigBuilder#synchronizers to create custom data system configurations.
99 100 101 |
# File 'lib/ldclient-rb/data_system.rb', line 99 def self.polling_ds_builder LaunchDarkly::Impl::DataSystem::PollingDataSourceBuilder.new end |
.streaming ⇒ ConfigBuilder
Streaming configures the SDK to efficiently stream flag/segment data in the background, allowing evaluations to operate on the latest data with no additional latency.
159 160 161 162 163 164 165 166 167 168 |
# File 'lib/ldclient-rb/data_system.rb', line 159 def self.streaming streaming_builder = streaming_ds_builder fallback = fdv1_fallback_ds_builder builder = ConfigBuilder.new builder.synchronizers([streaming_builder]) builder.fdv1_compatible_synchronizer(fallback) builder end |
.streaming_ds_builder ⇒ LaunchDarkly::Impl::DataSystem::StreamingDataSourceBuilder
Returns a builder for creating a streaming data source. This is a building block that can be used with LaunchDarkly::DataSystem::ConfigBuilder#synchronizers to create custom data system configurations.
121 122 123 |
# File 'lib/ldclient-rb/data_system.rb', line 121 def self.streaming_ds_builder LaunchDarkly::Impl::DataSystem::StreamingDataSourceBuilder.new end |