pub struct PeerMap {
map: LinkedHashMap<NodeId, PeerData>,
client_auth: ClientAuth,
capacity: usize,
stats_counter: Metrics,
}
Fields§
§map: LinkedHashMap<NodeId, PeerData>
§client_auth: ClientAuth
§capacity: usize
§stats_counter: Metrics
Implementations§
source§impl PeerMap
impl PeerMap
pub fn new(capacity: usize, stats_counter: Metrics) -> Self
pub fn entry(&mut self, id: NodeId) -> Option<Entry<'_>>
sourcepub fn refresh_peer(&mut self, id: &NodeId) -> Option<&mut PeerStats>
pub fn refresh_peer(&mut self, id: &NodeId) -> Option<&mut PeerStats>
Returns metadata of most recent peer interaction with given node
pub fn peer_comms(&mut self, id: &NodeId) -> Option<&mut PeerComms>
sourcefn join_peer(&mut self, id: NodeId, remote_addr: Address) -> &mut PeerData
fn join_peer(&mut self, id: NodeId, remote_addr: Address) -> &mut PeerData
Inserts peer and returns associated metadata
pub fn server_comms(&mut self, id: &NodeId) -> Option<&mut PeerComms>
pub fn generate_auth_nonce(&mut self, addr: Address) -> [u8; 32]
pub fn client_id(&self, peer_addr: Address) -> Option<&NodeId>
pub fn complete_handshake<F>( &mut self, addr: Address, id: NodeId, verify: F ) -> Result<(), NetworkError>where F: FnOnce([u8; 32]) -> Result<(), NetworkError>,
pub fn add_connecting( &mut self, id: NodeId, remote_addr: Address, handle: ConnectHandle ) -> &mut PeerComms
pub fn add_client(&mut self, id: NodeId, remote_addr: Address) -> &mut PeerComms
pub fn remove_peer(&mut self, id: &NodeId) -> Option<PeerComms>
pub fn next_peer_for_block_fetch(&mut self) -> Option<(NodeId, &mut PeerComms)>
pub fn infos(&self) -> Vec<PeerInfo>
pub fn evict_clients(&mut self, num: usize)
fn evict_if_full(&mut self)
Auto Trait Implementations§
impl !RefUnwindSafe for PeerMap
impl Send for PeerMap
impl Sync for PeerMap
impl Unpin for PeerMap
impl !UnwindSafe for PeerMap
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request