Skip to main content

HoprNodeNetworkOperations

Trait HoprNodeNetworkOperations 

pub trait HoprNodeNetworkOperations {
    type Error: Error + Send + Sync + 'static;
    type TransportObservable: EdgeObservable + Send;

    // Required methods
    fn me_peer_id(&self) -> PeerId;
    fn get_public_nodes<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(PeerId, Address, Vec<Multiaddr>)>, Self::Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn network_health<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Health> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn network_connected_peers<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<PeerId>, Self::Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn network_peer_info(
        &self,
        peer: &PeerId,
    ) -> Option<Self::TransportObservable>;
    fn all_network_peers<'life0, 'async_trait>(
        &'life0 self,
        minimum_score: f64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(Option<Address>, PeerId, Self::TransportObservable)>, Self::Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn local_multiaddresses(&self) -> Vec<Multiaddr>;
    fn listening_multiaddresses<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Vec<Multiaddr>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn network_observed_multiaddresses<'life0, 'life1, 'async_trait>(
        &'life0 self,
        peer: &'life1 PeerId,
    ) -> Pin<Box<dyn Future<Output = Vec<Multiaddr>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn multiaddresses_announced_on_chain<'life0, 'life1, 'async_trait>(
        &'life0 self,
        peer: &'life1 PeerId,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Multiaddr>, Self::Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn ping<'life0, 'life1, 'async_trait>(
        &'life0 self,
        peer: &'life1 PeerId,
    ) -> Pin<Box<dyn Future<Output = Result<(Duration, Self::TransportObservable), Self::Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
}
Expand description

High-level network operations.

Required Associated Types§

type Error: Error + Send + Sync + 'static

Error type for node operations.

type TransportObservable: EdgeObservable + Send

Observable type returned by peer information queries.

Required Methods§

fn me_peer_id(&self) -> PeerId

Returns the PeerId of this node used in the transport layer.

fn get_public_nodes<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(PeerId, Address, Vec<Multiaddr>)>, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns all public nodes announced on the network.

fn network_health<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Health> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns the current network health status.

fn network_connected_peers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<PeerId>, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns all currently connected peers.

fn network_peer_info(&self, peer: &PeerId) -> Option<Self::TransportObservable>

Returns observations for a specific peer.

fn all_network_peers<'life0, 'async_trait>( &'life0 self, minimum_score: f64, ) -> Pin<Box<dyn Future<Output = Result<Vec<(Option<Address>, PeerId, Self::TransportObservable)>, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns all network peers with quality above the minimum score.

fn local_multiaddresses(&self) -> Vec<Multiaddr>

Returns the multiaddresses this node is announcing.

fn listening_multiaddresses<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Vec<Multiaddr>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns the multiaddresses this node is listening on.

fn network_observed_multiaddresses<'life0, 'life1, 'async_trait>( &'life0 self, peer: &'life1 PeerId, ) -> Pin<Box<dyn Future<Output = Vec<Multiaddr>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Returns the observed multiaddresses for a peer.

fn multiaddresses_announced_on_chain<'life0, 'life1, 'async_trait>( &'life0 self, peer: &'life1 PeerId, ) -> Pin<Box<dyn Future<Output = Result<Vec<Multiaddr>, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Returns the multiaddresses announced on-chain for a peer.

fn ping<'life0, 'life1, 'async_trait>( &'life0 self, peer: &'life1 PeerId, ) -> Pin<Box<dyn Future<Output = Result<(Duration, Self::TransportObservable), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Pings a peer and returns the round-trip time along with observable data.

Implementors§

Source§

impl<Chain, Db, Graph, Net> HoprNodeNetworkOperations for Hopr<Chain, Db, Graph, Net>
where Chain: HoprChainApi + Clone + Send + Sync + 'static, Db: HoprNodeDbApi + Clone + Send + Sync + 'static, Graph: NetworkGraphView<NodeId = OffchainPublicKey> + NetworkGraphUpdate + Clone + Send + Sync + 'static, Net: NetworkView + NetworkStreamControl + Send + Sync + Clone + 'static,