pub struct PollingDataSourceBuilder { /* private fields */ }
Expand description

Contains methods for configuring the polling data source.

Polling is not the default behavior; by default, the SDK uses a streaming connection to receive feature flag data from LaunchDarkly. In polling mode, the SDK instead makes a new HTTP request to LaunchDarkly at regular intervals. HTTP caching allows it to avoid redundantly downloading data if there have been no changes, but polling is still less efficient than streaming and should only be used on the advice of LaunchDarkly support.

To use polling mode, create a builder PollingDataSourceBuilder::new, change its properties with the methods of this class, and pass it to the crate::ConfigBuilder::data_source.

Examples

Adjust the initial reconnect delay.

    ConfigBuilder::new("sdk-key").data_source(PollingDataSourceBuilder::new()
        .poll_interval(Duration::from_secs(60)));

Implementations

Contains methods for configuring the polling data source.

Polling is not the default behavior; by default, the SDK uses a streaming connection to receive feature flag data from LaunchDarkly. In polling mode, the SDK instead makes a new HTTP request to LaunchDarkly at regular intervals. HTTP caching allows it to avoid redundantly downloading data if there have been no changes, but polling is still less efficient than streaming and should only be used on the advice of LaunchDarkly support.

To use polling mode, create a builder with PollingDataSourceBuilder::new, set its properties with the methods of this class, and pass it to crate::ConfigBuilder::data_source.

Examples

Adjust the poll interval.

    ConfigBuilder::new("sdk-key").data_source(PollingDataSourceBuilder::new()
        .poll_interval(Duration::from_secs(60)));

Create a new instance of the PollingDataSourceBuilder with default values.

Sets the poll interval for the polling connection.

The default and minimum value is 30 seconds. Values less than this will be set to the default.

Sets the feature requester factory for use by this polling data source.

The default implementation relies on reqwest and handles basic caching.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more