pub struct SyncPolicy {
pub interval: Duration,
pub min_interval: Duration,
pub backoff: Backoff,
pub offline_retry: Duration,
}Expand description
When a target should be synchronised.
The same engine serves a one-minute notification poll and a six-hour analytics refresh — only these numbers differ.
Fields§
§interval: DurationCadence while everything is healthy.
min_interval: DurationFloor between two runs, however often a refresh is requested.
Protects against a user holding the refresh button and against a UI that re-syncs on every window focus.
backoff: BackoffHow to back off after failures.
offline_retry: DurationRetry delay while the machine appears to be offline.
Short and flat rather than exponential: connectivity usually returns in one step, and backing off for half an hour would leave the app stale long after the network came back.
Implementations§
Source§impl SyncPolicy
impl SyncPolicy
pub fn with_min_interval(self, min_interval: Duration) -> Self
pub fn with_backoff(self, backoff: Backoff) -> Self
pub fn with_offline_retry(self, offline_retry: Duration) -> Self
Trait Implementations§
Source§impl Clone for SyncPolicy
impl Clone for SyncPolicy
Source§fn clone(&self) -> SyncPolicy
fn clone(&self) -> SyncPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for SyncPolicy
Source§impl Debug for SyncPolicy
impl Debug for SyncPolicy
Source§impl Default for SyncPolicy
impl Default for SyncPolicy
Source§impl PartialEq for SyncPolicy
impl PartialEq for SyncPolicy
impl StructuralPartialEq for SyncPolicy
Auto Trait Implementations§
impl Freeze for SyncPolicy
impl RefUnwindSafe for SyncPolicy
impl Send for SyncPolicy
impl Sync for SyncPolicy
impl Unpin for SyncPolicy
impl UnsafeUnpin for SyncPolicy
impl UnwindSafe for SyncPolicy
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
Mutably borrows from an owned value. Read more