Trait sc_network_gossip::Network [−][src]
pub trait Network<B: BlockT> { fn event_stream(&self) -> Pin<Box<dyn Stream<Item = Event> + Send>>; fn report_peer(&self, peer_id: PeerId, reputation: ReputationChange); fn add_set_reserved(&self, who: PeerId, protocol: Cow<'static, str>); fn remove_set_reserved(&self, who: PeerId, protocol: Cow<'static, str>); fn disconnect_peer(&self, who: PeerId, protocol: Cow<'static, str>); fn write_notification(
&self,
who: PeerId,
protocol: Cow<'static, str>,
message: Vec<u8>
); fn announce(&self, block: B::Hash, associated_data: Option<Vec<u8>>); }
Expand description
Abstraction over a network.
Required methods
fn event_stream(&self) -> Pin<Box<dyn Stream<Item = Event> + Send>>
fn event_stream(&self) -> Pin<Box<dyn Stream<Item = Event> + Send>>
Returns a stream of events representing what happens on the network.
fn report_peer(&self, peer_id: PeerId, reputation: ReputationChange)
fn report_peer(&self, peer_id: PeerId, reputation: ReputationChange)
Adjust the reputation of a node.
fn add_set_reserved(&self, who: PeerId, protocol: Cow<'static, str>)
fn add_set_reserved(&self, who: PeerId, protocol: Cow<'static, str>)
Adds the peer to the set of peers to be connected to with this protocol.
fn remove_set_reserved(&self, who: PeerId, protocol: Cow<'static, str>)
fn remove_set_reserved(&self, who: PeerId, protocol: Cow<'static, str>)
Removes the peer from the set of peers to be connected to with this protocol.
fn disconnect_peer(&self, who: PeerId, protocol: Cow<'static, str>)
fn disconnect_peer(&self, who: PeerId, protocol: Cow<'static, str>)
Force-disconnect a peer.
Send a notification to a peer.