Struct jormungandr::network::p2p::comm::Peers

source ·
pub struct Peers {
    mutex: Arc<Mutex<PeerMap>>,
}
Expand description

The collection of currently connected peer nodes.

This object uses internal locking and is shared between all network connection tasks.

Fields§

§mutex: Arc<Mutex<PeerMap>>

Implementations§

source§

impl Peers

source

pub fn new(capacity: usize, stats_counter: Metrics) -> Self

source

fn inner(&self) -> OwnedMutexLockFuture<PeerMap>

source

pub async fn clear(&self)

source

pub async fn add_connecting( &self, peer: NodeId, remote_addr: Address, handle: ConnectHandle, options: ConnectOptions )

source

pub async fn update_entry(&self, peer: NodeId)

source

pub async fn remove_peer(&self, peer: &NodeId) -> Option<PeerComms>

source

pub async fn generate_auth_nonce(&self, peer_addr: Address) -> [u8; 32]

source

pub async fn server_complete_handshake<F>( &self, peer_addr: Address, id: NodeId, verify: F ) -> Result<(), Error>where F: FnOnce([u8; 32]) -> Result<(), Error>,

source

pub async fn client_id(&self, peer_addr: Address) -> Option<NodeId>

source

pub async fn subscribe_to_block_events( &self, peer: &NodeId ) -> Option<BlockEventSubscription>

returns None if the handshake process was not completed successfully

source

pub async fn subscribe_to_fragments( &self, peer: &NodeId ) -> Option<FragmentSubscription>

returns None if the handshake process was not completed successfully

source

pub async fn subscribe_to_gossip( &self, peer: &NodeId ) -> Option<GossipSubscription>

returns None if the handshake process was not completed successfully

source

async fn propagate_with<T, F>(&self, peer: NodeId, f: F) -> Result<(), NodeId>where for<'a> F: Fn(CommStatus<'a>) -> Result<(), PropagateError<T>>,

source

pub async fn propagate_block( &self, peer: NodeId, header: Header ) -> Result<(), NodeId>

source

pub async fn propagate_fragment( &self, peer: NodeId, fragment: Fragment ) -> Result<(), NodeId>

source

pub async fn propagate_gossip_to( &self, peer: NodeId, gossip: Gossip ) -> Result<(), Gossip>

source

pub async fn refresh_peer_on_block(&self, peer: &NodeId) -> bool

source

pub async fn refresh_peer_on_fragment(&self, peer: &NodeId) -> bool

source

pub fn get_peer_addr(&self, node_id: NodeId) -> GetNodeAddress

source

pub async fn refresh_peer_on_gossip(&self, peer: &NodeId) -> bool

source

pub async fn solicit_blocks_any(&self, hashes: BlockIds)

source

pub async fn solicit_blocks_peer(&self, peer: &NodeId, hashes: BlockIds)

source

pub async fn pull_headers(&self, peer: &NodeId, from: BlockIds, to: BlockId)

source

pub async fn infos(&self) -> Vec<PeerInfo>

Auto Trait Implementations§

§

impl !RefUnwindSafe for Peers

§

impl Send for Peers

§

impl Sync for Peers

§

impl Unpin for Peers

§

impl !UnwindSafe for Peers

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more