NetworkView

Trait NetworkView 

Source
pub trait NetworkView {
    // Required methods
    fn listening_as(&self) -> HashSet<Multiaddr>;
    fn multiaddress_of(&self, peer: &PeerId) -> Option<HashSet<Multiaddr>>;
    fn discovered_peers(&self) -> HashSet<PeerId>;
    fn connected_peers(&self) -> HashSet<PeerId>;
    fn observations_for<'a>(
        &'a self,
        peer: &'a PeerId,
    ) -> Option<impl Observable + 'static>;
    fn health(&self) -> Health;
}
Expand description

Trait representing a read-only view of the network state.

Required Methods§

Source

fn listening_as(&self) -> HashSet<Multiaddr>

Multiaddresses used for listening by the local node.

Source

fn multiaddress_of(&self, peer: &PeerId) -> Option<HashSet<Multiaddr>>

Translation of the peer into its known multiaddresses.

Source

fn discovered_peers(&self) -> HashSet<PeerId>

Peers collected by the network discovery mechanism.

Source

fn connected_peers(&self) -> HashSet<PeerId>

Peers currently connected and tracked by the network.

Source

fn observations_for<'a>( &'a self, peer: &'a PeerId, ) -> Option<impl Observable + 'static>

Observables related to a specific peer in the network.

Returns None if no observations have been recorded for the peer.

Source

fn health(&self) -> Health

Represents perceived health of the network.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§