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.
174 175 176 |
# File 'lib/ldclient-rb/data_system/polling_data_source_builder.rb', line 174 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.
220 221 222 223 224 |
# File 'lib/ldclient-rb/data_system/polling_data_source_builder.rb', line 220 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.
187 188 189 190 |
# File 'lib/ldclient-rb/data_system/polling_data_source_builder.rb', line 187 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.
205 206 207 208 |
# File 'lib/ldclient-rb/data_system/polling_data_source_builder.rb', line 205 def requester(requester) @requester = requester self end |