pub struct AdaptiveRefreshScheduler { /* private fields */ }Expand description
Coordinates Kademlia routing-table refresh using adaptive intervals.
Implementations§
Source§impl AdaptiveRefreshScheduler
impl AdaptiveRefreshScheduler
Sourcepub fn new(config: AdaptiveRefreshConfig) -> Arc<Self> ⓘ
pub fn new(config: AdaptiveRefreshConfig) -> Arc<Self> ⓘ
Create a new scheduler wrapped in an Arc.
Sourcepub fn record_peer_event(&self, event: PeerChurnEvent)
pub fn record_peer_event(&self, event: PeerChurnEvent)
Record a peer event (delegates to the underlying tracker).
Sourcepub fn is_refresh_due(&self, now_ms: u64) -> bool
pub fn is_refresh_due(&self, now_ms: u64) -> bool
Returns true when the current adaptive interval has elapsed since the
last recorded refresh.
Sourcepub fn mark_refreshed(&self, now_ms: u64)
pub fn mark_refreshed(&self, now_ms: u64)
Record that a refresh was performed at now_ms.
Sourcepub fn current_interval(&self, now_ms: u64) -> Duration
pub fn current_interval(&self, now_ms: u64) -> Duration
Current recommended refresh interval.
Sourcepub fn time_until_refresh(&self, now_ms: u64) -> Duration
pub fn time_until_refresh(&self, now_ms: u64) -> Duration
Duration remaining until the next scheduled refresh.
Returns Duration::ZERO if a refresh is already due.
Sourcepub fn refresh_count(&self) -> u64
pub fn refresh_count(&self) -> u64
Total number of refreshes performed.
Sourcepub fn churn_metrics(&self, now_ms: u64) -> ChurnMetrics
pub fn churn_metrics(&self, now_ms: u64) -> ChurnMetrics
Current churn metrics (delegates to tracker).
Auto Trait Implementations§
impl !Freeze for AdaptiveRefreshScheduler
impl !RefUnwindSafe for AdaptiveRefreshScheduler
impl !UnwindSafe for AdaptiveRefreshScheduler
impl Send for AdaptiveRefreshScheduler
impl Sync for AdaptiveRefreshScheduler
impl Unpin for AdaptiveRefreshScheduler
impl UnsafeUnpin for AdaptiveRefreshScheduler
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
Converts
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>
Converts
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