[−][src]Struct sc_network_gossip::GossipEngine
Wraps around an implementation of the Network
crate and provides gossiping capabilities on
top of it.
Methods
impl<B: BlockT> GossipEngine<B>
[src]
pub fn new<N: Network<B> + Send + Clone + 'static>(
network: N,
engine_id: ConsensusEngineId,
protocol_name: impl Into<Cow<'static, [u8]>>,
validator: Arc<dyn Validator<B>>
) -> Self where
B: 'static,
[src]
network: N,
engine_id: ConsensusEngineId,
protocol_name: impl Into<Cow<'static, [u8]>>,
validator: Arc<dyn Validator<B>>
) -> Self where
B: 'static,
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
) -> UnboundedReceiver<TopicNotification>
[src]
&mut self,
topic: B::Hash
) -> UnboundedReceiver<TopicNotification>
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: 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.
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output>
[src]
impl<B: BlockT> Unpin for GossipEngine<B>
[src]
Auto Trait Implementations
impl<B> !RefUnwindSafe for GossipEngine<B>
impl<B> Send for GossipEngine<B> where
<B as Block>::Hash: Send,
<B as Block>::Hash: Send,
impl<B> !Sync for GossipEngine<B>
impl<B> !UnwindSafe for GossipEngine<B>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CheckedConversion for T
[src]
fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
[src]
Self: TryFrom<T>,
fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
[src]
Self: TryInto<T>,
impl<T> From<T> for T
[src]
impl<T> FutureExt for T where
T: Future + ?Sized,
[src]
T: Future + ?Sized,
fn map<U, F>(self, f: F) -> Map<Self, F> where
F: FnOnce(Self::Output) -> U,
[src]
F: FnOnce(Self::Output) -> U,
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F> where
F: FnOnce(Self::Output) -> Fut,
Fut: Future,
[src]
F: FnOnce(Self::Output) -> Fut,
Fut: Future,
fn left_future<B>(self) -> Either<Self, B> where
B: Future<Output = Self::Output>,
[src]
B: Future<Output = Self::Output>,
fn right_future<A>(self) -> Either<A, Self> where
A: Future<Output = Self::Output>,
[src]
A: Future<Output = Self::Output>,
fn into_stream(self) -> IntoStream<Self>
[src]
fn flatten(self) -> Flatten<Self> where
Self::Output: Future,
[src]
Self::Output: Future,
fn flatten_stream(self) -> FlattenStream<Self> where
Self::Output: Stream,
[src]
Self::Output: Stream,
fn fuse(self) -> Fuse<Self>
[src]
fn inspect<F>(self, f: F) -> Inspect<Self, F> where
F: FnOnce(&Self::Output),
[src]
F: FnOnce(&Self::Output),
fn catch_unwind(self) -> CatchUnwind<Self> where
Self: UnwindSafe,
[src]
Self: UnwindSafe,
fn shared(self) -> Shared<Self> where
Self::Output: Clone,
[src]
Self::Output: Clone,
fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)
[src]
fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a + Send>> where
Self: Send + 'a,
[src]
Self: Send + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>> where
Self: 'a,
[src]
Self: 'a,
fn unit_error(self) -> UnitError<Self>
[src]
fn never_error(self) -> NeverError<Self>
[src]
fn poll_unpin(&mut self, cx: &mut Context) -> Poll<Self::Output> where
Self: Unpin,
[src]
Self: Unpin,
fn now_or_never(self) -> Option<Self::Output>
[src]
impl<T> FutureExt for T where
T: Future + ?Sized,
T: Future + ?Sized,
fn delay(self, dur: Duration) -> DelayFuture<Self>
fn flatten(self) -> FlattenFuture<Self, <Self::Output as IntoFuture>::Future> where
Self::Output: IntoFuture,
Self::Output: IntoFuture,
fn race<F>(self, other: F) -> Race<Self, F> where
F: Future<Output = Self::Output>,
Self: Future,
F: Future<Output = Self::Output>,
Self: Future,
fn try_race<F, T, E>(self, other: F) -> TryRace<Self, F> where
F: Future<Output = Self::Output>,
Self: Future<Output = Result<T, E>>,
F: Future<Output = Self::Output>,
Self: Future<Output = Result<T, E>>,
fn join<F>(self, other: F) -> Join<Self, F> where
F: Future,
Self: Future,
F: Future,
Self: Future,
fn try_join<F, A, B, E>(self, other: F) -> TryJoin<Self, F> where
F: Future<Output = Result<B, E>>,
Self: Future<Output = Result<A, E>>,
F: Future<Output = Result<B, E>>,
Self: Future<Output = Result<A, E>>,
fn timeout(self, dur: Duration) -> TimeoutFuture<Self>
impl<T> FutureExt for T where
T: Future,
T: Future,
fn with_diagnostics(
self,
name: impl Into<Cow<'static, str>>
) -> DiagnoseFuture<Self>
self,
name: impl Into<Cow<'static, str>>
) -> DiagnoseFuture<Self>
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoFuture for T where
T: Future,
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?
fn into_future(self) -> <T as IntoFuture>::Future
impl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
fn from_ref(outer: &Outer) -> &T
Get a reference to the inner from the outer.
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
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Self: UniqueSaturatedFrom<T>,
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Self: UniqueSaturatedInto<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
T: UncheckedFrom<S>,
fn unchecked_into(self) -> T
impl<T, S> UniqueSaturatedInto<T> for S where
S: TryInto<T>,
T: Bounded,
S: TryInto<T>,
T: Bounded,
fn unique_saturated_into(self) -> T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,