pub struct PollingDataSourceBuilder<C> { /* 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::<HttpsConnector<HttpConnector>>::new()
.poll_interval(Duration::from_secs(60)));
Implementations§
Source§impl<C> PollingDataSourceBuilder<C>
impl<C> PollingDataSourceBuilder<C>
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::<HttpsConnector<HttpConnector>>::new()
.poll_interval(Duration::from_secs(60)));
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new instance of the PollingDataSourceBuilder with default values.
Sourcepub fn poll_interval(&mut self, poll_interval: Duration) -> &mut Self
pub fn poll_interval(&mut self, poll_interval: Duration) -> &mut Self
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.
Sourcepub fn https_connector(&mut self, connector: C) -> &mut Self
pub fn https_connector(&mut self, connector: C) -> &mut Self
Sets the connector for the polling client to use. This allows for re-use of a connector
between multiple client instances. This is especially useful for the sdk-test-harness
where many client instances are created throughout the test and reading the native
certificates is a substantial portion of the runtime.
Trait Implementations§
Source§impl<C: Clone> Clone for PollingDataSourceBuilder<C>
impl<C: Clone> Clone for PollingDataSourceBuilder<C>
Source§fn clone(&self) -> PollingDataSourceBuilder<C>
fn clone(&self) -> PollingDataSourceBuilder<C>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<C> Freeze for PollingDataSourceBuilder<C>where
C: Freeze,
impl<C> RefUnwindSafe for PollingDataSourceBuilder<C>where
C: RefUnwindSafe,
impl<C> Send for PollingDataSourceBuilder<C>where
C: Send,
impl<C> Sync for PollingDataSourceBuilder<C>where
C: Sync,
impl<C> Unpin for PollingDataSourceBuilder<C>where
C: Unpin,
impl<C> UnwindSafe for PollingDataSourceBuilder<C>where
C: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more