Struct tc_peerset::Peerset[][src]

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.

Implementations

impl Peerset[src]

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

Builds a new peerset from the given configuration.

pub fn add_to_peers_set(&mut self, set_id: SetId, peer_id: PeerId)[src]

Adds a node to the given set. The peerset will, if possible and not already the case, try to connect to it.

Note: This has the same effect as PeersetHandle::add_to_peers_set.

pub fn incoming(&mut self, set_id: SetId, 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, set_id: SetId, peer_id: PeerId, reason: DropReason)[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 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.

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
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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>,