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§
source§impl 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§
source§impl Clone for PollingDataSourceBuilder
impl Clone for PollingDataSourceBuilder
source§fn clone(&self) -> PollingDataSourceBuilder
fn clone(&self) -> PollingDataSourceBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for PollingDataSourceBuilder
impl RefUnwindSafe for PollingDataSourceBuilder
impl Send for PollingDataSourceBuilder
impl Sync for PollingDataSourceBuilder
impl Unpin for PollingDataSourceBuilder
impl UnwindSafe for PollingDataSourceBuilder
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)