Trait sc_network_common::service::NetworkEventStream
source · pub trait NetworkEventStream {
// Required method
fn event_stream(
&self,
name: &'static str
) -> Pin<Box<dyn Stream<Item = Event> + Send>>;
}
Expand description
Provides access to network-level event stream.
Required Methods§
sourcefn event_stream(
&self,
name: &'static str
) -> Pin<Box<dyn Stream<Item = Event> + Send>>
fn event_stream( &self, name: &'static str ) -> Pin<Box<dyn Stream<Item = Event> + Send>>
Returns a stream containing the events that happen on the network.
If this method is called multiple times, the events are duplicated.
The stream never ends (unless the NetworkWorker
gets shut down).
The name passed is used to identify the channel in the Prometheus metrics. Note that the
parameter is a &'static str
, and not a String
, in order to avoid accidentally having
an unbounded set of Prometheus metrics, which would be quite bad in terms of memory