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
-
#base_uri(uri) ⇒ self
included
from DataSourceBuilderCommon
Sets the base URI for HTTP requests.
-
#build(sdk_key, config) ⇒ LaunchDarkly::Impl::DataSystem::PollingDataSource
Builds the FDv1 polling data source with the configured parameters.
-
#connect_timeout(timeout) ⇒ self
included
from DataSourceBuilderCommon
Sets the connect timeout for HTTP connections.
-
#initialize ⇒ FDv1PollingDataSourceBuilder
constructor
A new instance of FDv1PollingDataSourceBuilder.
-
#poll_interval(secs) ⇒ FDv1PollingDataSourceBuilder
Sets the polling interval in seconds.
-
#read_timeout(timeout) ⇒ self
included
from DataSourceBuilderCommon
Sets the read timeout for HTTP connections.
-
#requester(requester) ⇒ FDv1PollingDataSourceBuilder
Sets a custom Requester for this polling data source.
-
#socket_factory(factory) ⇒ self
included
from DataSourceBuilderCommon
Sets a custom socket factory for HTTP connections.
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
#base_uri(uri) ⇒ self Originally defined in module DataSourceBuilderCommon
Sets the base URI for HTTP requests.
Use this to point the SDK at a Relay Proxy instance or any other URI that implements the corresponding LaunchDarkly API.
#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 |
#connect_timeout(timeout) ⇒ self Originally defined in module DataSourceBuilderCommon
Sets the connect timeout for HTTP connections.
#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 |
#read_timeout(timeout) ⇒ self Originally defined in module DataSourceBuilderCommon
Sets the read timeout for HTTP connections.
#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 |
#socket_factory(factory) ⇒ self Originally defined in module DataSourceBuilderCommon
Sets a custom socket factory for HTTP connections.