pub struct RetryPolicy {
pub max_retries: u32,
pub base_delay: Duration,
pub backoff_factor: f64,
}Expand description
Exponential back-off policy for retrying gap-fetch Interests.
The reference ndnSVS implementation retries up to 4 times with a 2× backoff
starting at 1 second. Pass a RetryPolicy to fetch_with_retry to apply
these semantics to your own fetch logic.
§Example
ⓘ
use ndn_sync::RetryPolicy;
let data = fetch_with_retry(RetryPolicy::default(), || async {
consumer.fetch("/ndn/svs/alice/1").await
}).await?;Fields§
§max_retries: u32Maximum number of retry attempts after the first failure (default: 4).
base_delay: DurationDelay before the first retry (default: 1 s).
backoff_factor: f64Multiplier applied to the delay after each attempt (default: 2.0).
Trait Implementations§
Source§impl Clone for RetryPolicy
impl Clone for RetryPolicy
Source§fn clone(&self) -> RetryPolicy
fn clone(&self) -> RetryPolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RetryPolicy
impl Debug for RetryPolicy
Auto Trait Implementations§
impl Freeze for RetryPolicy
impl RefUnwindSafe for RetryPolicy
impl Send for RetryPolicy
impl Sync for RetryPolicy
impl Unpin for RetryPolicy
impl UnwindSafe for RetryPolicy
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