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
sourceimpl PollingDataSourceBuilder
impl PollingDataSourceBuilder
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)));
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 feature_requester_factory(
&mut self,
feature_requester_factory: Box<dyn FeatureRequesterFactory>
) -> &mut Self
pub fn feature_requester_factory(
&mut self,
feature_requester_factory: Box<dyn FeatureRequesterFactory>
) -> &mut Self
Sets the feature requester factory for use by this polling data source.
The default implementation relies on reqwest and handles basic caching.
Trait Implementations
sourceimpl Clone for PollingDataSourceBuilder
impl Clone for PollingDataSourceBuilder
sourcefn clone(&self) -> PollingDataSourceBuilder
fn clone(&self) -> PollingDataSourceBuilder
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for PollingDataSourceBuilder
impl Send for PollingDataSourceBuilder
impl Sync for PollingDataSourceBuilder
impl Unpin for PollingDataSourceBuilder
impl UnwindSafe for PollingDataSourceBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more