Class: LaunchDarkly::DataSystem::FDv1PollingDataSourceBuilder
- Inherits:
-
Object
- Object
- LaunchDarkly::DataSystem::FDv1PollingDataSourceBuilder
- Includes:
- DataSourceBuilderCommon
- Defined in:
- lib/ldclient-rb/data_system/polling_data_source_builder.rb
Overview
Builder for a polling data source that communicates with LaunchDarkly’s FDv1 (Flag Delivery v1) polling endpoint.
This builder is typically used with ConfigBuilder#fdv1_compatible_synchronizer to provide a fallback when the server signals that the environment should revert to the FDv1 protocol.
Most users will not need to interact with this builder directly, as the predefined strategies (default, streaming, polling) already configure an appropriate FDv1 fallback.
Constant Summary collapse
- DEFAULT_BASE_URI =
Returns The default base URI for FDv1 polling requests.
"https://sdk.launchdarkly.com"- DEFAULT_POLL_INTERVAL =
Returns The default polling interval in seconds.
30
Instance Method Summary collapse
-
#build(sdk_key, config) ⇒ LaunchDarkly::Impl::DataSystem::PollingDataSource
Builds the FDv1 polling data source with the configured parameters.
-
#initialize ⇒ FDv1PollingDataSourceBuilder
constructor
A new instance of FDv1PollingDataSourceBuilder.
-
#poll_interval(secs) ⇒ FDv1PollingDataSourceBuilder
Sets the polling interval in seconds.
-
#requester(requester) ⇒ FDv1PollingDataSourceBuilder
Sets a custom Requester for this polling data source.
Methods included from DataSourceBuilderCommon
#base_uri, #connect_timeout, #read_timeout, #socket_factory
Constructor Details
#initialize ⇒ FDv1PollingDataSourceBuilder
Returns a new instance of FDv1PollingDataSourceBuilder.
176 177 178 |
# File 'lib/ldclient-rb/data_system/polling_data_source_builder.rb', line 176 def initialize @requester = nil end |
Instance Method Details
#build(sdk_key, config) ⇒ LaunchDarkly::Impl::DataSystem::PollingDataSource
Builds the FDv1 polling data source with the configured parameters.
This method is called internally by the SDK. You do not need to call it directly; instead, pass the builder to ConfigBuilder#fdv1_compatible_synchronizer.
222 223 224 225 226 |
# File 'lib/ldclient-rb/data_system/polling_data_source_builder.rb', line 222 def build(sdk_key, config) http_opts = build_http_config requester = @requester || LaunchDarkly::Impl::DataSystem::HTTPFDv1PollingRequester.new(sdk_key, http_opts, config) LaunchDarkly::Impl::DataSystem::PollingDataSource.new(@poll_interval || DEFAULT_POLL_INTERVAL, requester, config.logger) end |
#poll_interval(secs) ⇒ FDv1PollingDataSourceBuilder
Sets the polling interval in seconds.
This controls how frequently the SDK polls LaunchDarkly for updates. The default is DEFAULT_POLL_INTERVAL seconds.
189 190 191 192 |
# File 'lib/ldclient-rb/data_system/polling_data_source_builder.rb', line 189 def poll_interval(secs) @poll_interval = secs self end |
#requester(requester) ⇒ FDv1PollingDataSourceBuilder
Sets a custom Requester for this polling data source.
By default, the builder uses an HTTP requester that communicates with LaunchDarkly’s FDv1 polling endpoint. Use this method to provide a custom requester implementation.
207 208 209 210 |
# File 'lib/ldclient-rb/data_system/polling_data_source_builder.rb', line 207 def requester(requester) @requester = requester self end |