pub trait GossipEngineIface: Send + Sync + 'static {
    type Clock: AtLeast32BitUnsigned + Send + Sync + 'static;

    // Required methods
    fn send(
        &self,
        recipient: PeerId,
        message: SignedDKGMessage<AuthorityId>
    ) -> Result<(), DKGError>;
    fn gossip(
        &self,
        message: SignedDKGMessage<AuthorityId>
    ) -> Result<(), DKGError>;
    fn get_stream(
        &self
    ) -> Option<UnboundedReceiver<SignedDKGMessage<AuthorityId>>>;
    fn local_peer_id(&self) -> PeerId;
    fn logger(&self) -> &DebugLogger;
}
Expand description

A GossipEngine that can be used to send DKG messages.

in the core it is very simple, just two methods:

  • send which will send a DKG message to a specific peer.
  • gossip which will send a DKG message to all peers.
  • stream which will return a stream of DKG messages.

Required Associated Types§

source

type Clock: AtLeast32BitUnsigned + Send + Sync + 'static

Required Methods§

source

fn send( &self, recipient: PeerId, message: SignedDKGMessage<AuthorityId> ) -> Result<(), DKGError>

Send a DKG message to a specific peer.

source

fn gossip(&self, message: SignedDKGMessage<AuthorityId>) -> Result<(), DKGError>

Send a DKG message to all peers.

source

fn get_stream(&self) -> Option<UnboundedReceiver<SignedDKGMessage<AuthorityId>>>

A stream that sends messages. Should only return once with Some, then None thereafter to reinforce a single read stream rather than multiple points in the codebase

source

fn local_peer_id(&self) -> PeerId

source

fn logger(&self) -> &DebugLogger

Implementations on Foreign Types§

source§

impl<T: GossipEngineIface + ?Sized> GossipEngineIface for Box<T>where Box<T>: Send + Sync + 'static,

§

type Clock = <T as GossipEngineIface>::Clock

source§

fn send( &self, recipient: PeerId, message: SignedDKGMessage<AuthorityId> ) -> Result<(), DKGError>

source§

fn gossip(&self, message: SignedDKGMessage<AuthorityId>) -> Result<(), DKGError>

source§

fn get_stream(&self) -> Option<UnboundedReceiver<SignedDKGMessage<AuthorityId>>>

source§

fn local_peer_id(&self) -> PeerId

source§

fn logger(&self) -> &DebugLogger

source§

impl GossipEngineIface for ()

A Stub implementation of the GossipEngineIface.

§

type Clock = u32

source§

fn send( &self, _recipient: PeerId, _message: SignedDKGMessage<AuthorityId> ) -> Result<(), DKGError>

source§

fn gossip( &self, _message: SignedDKGMessage<AuthorityId> ) -> Result<(), DKGError>

source§

fn get_stream(&self) -> Option<UnboundedReceiver<SignedDKGMessage<AuthorityId>>>

source§

fn local_peer_id(&self) -> PeerId

source§

fn logger(&self) -> &DebugLogger

source§

impl<T: GossipEngineIface + ?Sized> GossipEngineIface for Arc<T>where Arc<T>: Send + Sync + 'static,

§

type Clock = <T as GossipEngineIface>::Clock

source§

fn send( &self, recipient: PeerId, message: SignedDKGMessage<AuthorityId> ) -> Result<(), DKGError>

source§

fn gossip(&self, message: SignedDKGMessage<AuthorityId>) -> Result<(), DKGError>

source§

fn get_stream(&self) -> Option<UnboundedReceiver<SignedDKGMessage<AuthorityId>>>

source§

fn local_peer_id(&self) -> PeerId

source§

fn logger(&self) -> &DebugLogger

source§

impl<'a, T: 'a + GossipEngineIface + ?Sized> GossipEngineIface for &'a Twhere &'a T: Send + Sync + 'static,

§

type Clock = <T as GossipEngineIface>::Clock

source§

fn send( &self, recipient: PeerId, message: SignedDKGMessage<AuthorityId> ) -> Result<(), DKGError>

source§

fn gossip(&self, message: SignedDKGMessage<AuthorityId>) -> Result<(), DKGError>

source§

fn get_stream(&self) -> Option<UnboundedReceiver<SignedDKGMessage<AuthorityId>>>

source§

fn local_peer_id(&self) -> PeerId

source§

fn logger(&self) -> &DebugLogger

Implementors§

source§

impl<B: Block> GossipEngineIface for GossipHandlerController<B>

§

type Clock = <<B as Block>::Header as Header>::Number