pub struct PeerRegistry<const N: usize> { /* private fields */ }Expand description
Fixed-capacity registry of remote peers.
Implementations§
Source§impl<const N: usize> PeerRegistry<N>
impl<const N: usize> PeerRegistry<N>
Sourcepub fn lookup_by_hint(
&self,
hint: &NodeHint,
) -> impl Iterator<Item = (PeerId, &PeerInfo)>
pub fn lookup_by_hint( &self, hint: &NodeHint, ) -> impl Iterator<Item = (PeerId, &PeerInfo)>
Iterate over peers whose derived hint matches hint.
Sourcepub fn lookup_by_key(&self, key: &PublicKey) -> Option<(PeerId, &PeerInfo)>
pub fn lookup_by_key(&self, key: &PublicKey) -> Option<(PeerId, &PeerInfo)>
Look up a peer by full public key.
Sourcepub fn get_mut(&mut self, id: PeerId) -> Option<&mut PeerInfo>
pub fn get_mut(&mut self, id: PeerId) -> Option<&mut PeerInfo>
Mutably borrow peer metadata by identifier.
Sourcepub fn try_insert_or_update(
&mut self,
key: PublicKey,
) -> Result<PeerId, CapacityError>
pub fn try_insert_or_update( &mut self, key: PublicKey, ) -> Result<PeerId, CapacityError>
Insert or refresh an explicitly configured peer entry.
Sourcepub fn try_insert_or_update_auto(
&mut self,
key: PublicKey,
now_ms: u64,
) -> Result<AutoPeerUpdate, CapacityError>
pub fn try_insert_or_update_auto( &mut self, key: PublicKey, now_ms: u64, ) -> Result<AutoPeerUpdate, CapacityError>
Insert or refresh an opportunistically learned peer entry.
When the registry is full, this may recycle the oldest non-pinned entry in place
rather than failing. Explicitly configured (pinned) peers are never displaced.
Sourcepub fn update_route(&mut self, id: PeerId, route: CachedRoute)
pub fn update_route(&mut self, id: PeerId, route: CachedRoute)
Update the cached route for id.
Trait Implementations§
Source§impl<const N: usize> Clone for PeerRegistry<N>
impl<const N: usize> Clone for PeerRegistry<N>
Source§fn clone(&self) -> PeerRegistry<N>
fn clone(&self) -> PeerRegistry<N>
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const N: usize> Debug for PeerRegistry<N>
impl<const N: usize> Debug for PeerRegistry<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for PeerRegistry<N>
impl<const N: usize> RefUnwindSafe for PeerRegistry<N>
impl<const N: usize> Send for PeerRegistry<N>
impl<const N: usize> Sync for PeerRegistry<N>
impl<const N: usize> Unpin for PeerRegistry<N>
impl<const N: usize> UnwindSafe for PeerRegistry<N>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)