pub struct BootstrapPeer {
pub peer_id: String,
pub multiaddr: String,
pub priority: u8,
pub last_attempt: Option<Instant>,
pub last_success: Option<Instant>,
pub consecutive_failures: u32,
}Expand description
A single bootstrap peer with priority, backoff state, and attempt history.
Fields§
§peer_id: StringOpaque string peer identifier (e.g. libp2p PeerId base58)
multiaddr: StringMultiaddr string for dialling (e.g. “/ip4/1.2.3.4/tcp/4001”)
priority: u8Scheduling priority: 255 = highest, 0 = lowest
last_attempt: Option<Instant>Wall-clock time of the most recent dial attempt
last_success: Option<Instant>Wall-clock time of the most recent successful connection
consecutive_failures: u32Number of consecutive failures since the last success
Implementations§
Source§impl BootstrapPeer
impl BootstrapPeer
Sourcepub fn new(
peer_id: impl Into<String>,
multiaddr: impl Into<String>,
priority: u8,
) -> Self
pub fn new( peer_id: impl Into<String>, multiaddr: impl Into<String>, priority: u8, ) -> Self
Create a new bootstrap peer with no history.
Sourcepub fn is_available(&self) -> bool
pub fn is_available(&self) -> bool
Returns true when the peer has not yet accumulated five consecutive failures.
Peers with five or more consecutive failures are considered unhealthy and
will not be returned by BootstrapCoordinator::next_bootstrap_peer.
Sourcepub fn backoff_duration(&self) -> Duration
pub fn backoff_duration(&self) -> Duration
Computes the minimum wait time before the next dial attempt.
The formula is min(30s, 2^consecutive_failures seconds), giving:
0 failures → 1 s, 1 → 2 s, 2 → 4 s, 3 → 8 s, 4 → 16 s, ≥5 → 30 s (unavailable).
Trait Implementations§
Source§impl Clone for BootstrapPeer
impl Clone for BootstrapPeer
Source§fn clone(&self) -> BootstrapPeer
fn clone(&self) -> BootstrapPeer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for BootstrapPeer
impl RefUnwindSafe for BootstrapPeer
impl Send for BootstrapPeer
impl Sync for BootstrapPeer
impl Unpin for BootstrapPeer
impl UnsafeUnpin for BootstrapPeer
impl UnwindSafe for BootstrapPeer
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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