Trait sc_network::service::traits::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§

source

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

Implementations on Foreign Types§

source§

impl<T> NetworkEventStream for Arc<T>

source§

fn event_stream( &self, name: &'static str, ) -> Pin<Box<dyn Stream<Item = Event> + Send>>

Implementors§

source§

impl<B, H> NetworkEventStream for NetworkService<B, H>
where B: BlockT + 'static, H: ExHashT,