[][src]Struct sc_peerset::Peerset

pub struct Peerset { /* fields omitted */ }

Side of the peer set manager owned by the network. In other words, the "receiving" side.

Implements the Stream trait and can be polled for messages. The Stream never ends and never errors.


impl Peerset[src]

pub fn from_config(config: PeersetConfig) -> (Peerset, PeersetHandle)[src]

Builds a new peerset from the given configuration.

pub fn incoming(&mut self, peer_id: PeerId, index: IncomingIndex)[src]

Indicate that we received an incoming connection. Must be answered either with a corresponding Accept or Reject, except if we were already connected to this peer.

Note that this mechanism is orthogonal to Connect/Drop. Accepting an incoming connection implicitly means Connect, but incoming connections aren't cancelled by dropped.

pub fn dropped(&mut self, peer_id: PeerId)[src]

Indicate that we dropped an active connection with a peer, or that we failed to connect.

Must only be called after the PSM has either generated a Connect message with this PeerId, or accepted an incoming connection with this PeerId.

pub fn discovered<I: IntoIterator<Item = PeerId>>(&mut self, peer_ids: I)[src]

Adds discovered peer ids to the PSM.

Note: There is no equivalent "expired" message, meaning that it is the responsibility of the PSM to remove PeerIds that fail to dial too often.

pub fn report_peer(&mut self, peer_id: PeerId, score_diff: ReputationChange)[src]

Reports an adjustment to the reputation of the given peer.

pub fn debug_info(&mut self) -> Value[src]

Produces a JSON object containing the state of the peerset manager, for debugging purposes.

pub fn num_discovered_peers(&self) -> usize[src]

Returns the number of peers that we have discovered.

pub fn get_priority_group(&self, group_id: &str) -> Option<HashSet<PeerId>>[src]

Returns priority group by id.

Trait Implementations

impl Debug for Peerset[src]

impl Stream for Peerset[src]

type Item = Message

Values yielded by the stream.

Auto Trait Implementations

impl !RefUnwindSafe for Peerset

impl Send for Peerset

impl Sync for Peerset

impl Unpin for Peerset

impl !UnwindSafe for Peerset

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> StreamExt for T where
    T: Stream + ?Sized

impl<T> StreamExt for T where
    T: Stream + ?Sized

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

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