pub struct PeerCapabilitySet {
pub peer_id: String,
pub capabilities: HashSet<PeerCapability>,
pub version: String,
pub advertised_at: u64,
pub last_verified: Option<u64>,
}Expand description
The full capability advertisement for a single remote peer.
This is the unit stored inside CapabilityRegistry. The
advertised_at field carries a Unix-epoch millisecond timestamp which is
compared against the registry’s ttl_ms to determine freshness.
Fields§
§peer_id: StringUnique peer identifier (string form of the libp2p PeerId).
capabilities: HashSet<PeerCapability>Set of capabilities this peer claims to support.
version: StringPeer’s self-reported IPFRS protocol version string, e.g. "0.2.0".
advertised_at: u64Unix-epoch millisecond timestamp when this record was first advertised.
last_verified: Option<u64>Unix-epoch millisecond timestamp of the most recent successful verification, if any.
Implementations§
Source§impl PeerCapabilitySet
impl PeerCapabilitySet
Sourcepub fn has(&self, cap: &PeerCapability) -> bool
pub fn has(&self, cap: &PeerCapability) -> bool
Returns true if this peer supports cap.
Sourcepub fn has_all(&self, caps: &[PeerCapability]) -> bool
pub fn has_all(&self, caps: &[PeerCapability]) -> bool
Returns true if this peer supports all capabilities in caps.
Sourcepub fn has_any(&self, caps: &[PeerCapability]) -> bool
pub fn has_any(&self, caps: &[PeerCapability]) -> bool
Returns true if this peer supports at least one capability in
caps. Returns true when caps is empty (vacuous truth).
Sourcepub fn is_expired(&self, now_ms: u64, ttl_ms: u64) -> bool
pub fn is_expired(&self, now_ms: u64, ttl_ms: u64) -> bool
Returns true if the record has expired given now_ms and ttl_ms.
Expiry is defined as now_ms >= advertised_at + ttl_ms.
Trait Implementations§
Source§impl Clone for PeerCapabilitySet
impl Clone for PeerCapabilitySet
Source§fn clone(&self) -> PeerCapabilitySet
fn clone(&self) -> PeerCapabilitySet
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 PeerCapabilitySet
impl RefUnwindSafe for PeerCapabilitySet
impl Send for PeerCapabilitySet
impl Sync for PeerCapabilitySet
impl Unpin for PeerCapabilitySet
impl UnsafeUnpin for PeerCapabilitySet
impl UnwindSafe for PeerCapabilitySet
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