Struct tc_network_gossip::GossipEngine[][src]

pub struct GossipEngine<B: BlockT> { /* fields omitted */ }

Wraps around an implementation of the Network crate and provides gossiping capabilities on top of it.

Implementations

impl<B: BlockT> GossipEngine<B>[src]

pub fn new<N: Network<B> + Send + Clone + 'static>(
    network: N,
    protocol: impl Into<Cow<'static, str>>,
    validator: Arc<dyn Validator<B>>,
    metrics_registry: Option<&Registry>
) -> Self where
    B: 'static, 
[src]

Create a new instance.

pub fn report(&self, who: PeerId, reputation: ReputationChange)[src]

pub fn register_gossip_message(&mut self, topic: B::Hash, message: Vec<u8>)[src]

Registers a message without propagating it to any peers. The message becomes available to new peers or when the service is asked to gossip the message’s topic. No validation is performed on the message, if the message is already expired it should be dropped on the next garbage collection.

pub fn broadcast_topic(&mut self, topic: B::Hash, force: bool)[src]

Broadcast all messages with given topic.

pub fn messages_for(&mut self, topic: B::Hash) -> Receiver<TopicNotification>[src]

Get data of valid, incoming messages for a topic (but might have expired meanwhile).

pub fn send_topic(&mut self, who: &PeerId, topic: B::Hash, force: bool)[src]

Send all messages with given topic to a peer.

pub fn gossip_message(&mut self, topic: B::Hash, message: Vec<u8>, force: bool)[src]

Multicast a message to all peers.

pub fn send_message(&mut self, who: Vec<PeerId>, data: Vec<u8>)[src]

Send addressed message to the given peers. The message is not kept or multicast later on.

pub fn announce(&self, block: B::Hash, associated_data: Option<Vec<u8>>)[src]

Notify everyone we’re connected to that we have the given block.

Note: this method isn’t strictly related to gossiping and should eventually be moved somewhere else.

Trait Implementations

impl<B: BlockT> Future for GossipEngine<B>[src]

type Output = ()

The type of value produced on completion.

impl<B: BlockT> Unpin for GossipEngine<B>[src]

Auto Trait Implementations

impl<B> !RefUnwindSafe for GossipEngine<B>

impl<B> Send for GossipEngine<B>

impl<B> !Sync for GossipEngine<B>

impl<B> !UnwindSafe for GossipEngine<B>

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> CheckedConversion for T[src]

impl<T> Downcast for T where
    T: Any

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

impl<T> FutureExt for T where
    T: Future + ?Sized

impl<F> FutureExt for F where
    F: Future + ?Sized

impl<T> FutureExt for T where
    T: Future + ?Sized

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

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

impl<F> IntoFuture for F where
    F: Future
[src]

type Output = <F as Future>::Output

🔬 This is a nightly-only experimental API. (into_future)

The output that the future will produce on completion.

type Future = F

🔬 This is a nightly-only experimental API. (into_future)

Which kind of future are we turning this into?

impl<T> IntoFuture for T where
    T: Future

type Output = <T as Future>::Output

The type of value produced on completion.

type Future = T

Which kind of future are we turning this into?

impl<T, Outer> IsWrappedBy<Outer> for T where
    T: From<Outer>,
    Outer: AsRef<T> + AsMut<T> + From<T>, 

pub fn from_ref(outer: &Outer) -> &T

Get a reference to the inner from the outer.

pub fn from_mut(outer: &mut Outer) -> &mut T

Get a mutable reference to the inner from the outer.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SaturatedConversion for T

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<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 

impl<T, S> UniqueSaturatedInto<T> for S where
    T: Bounded,
    S: TryInto<T>, 

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