Trait dkg_gadget::gossip_engine::GossipEngineIface
source · 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§
Required Methods§
sourcefn send(
&self,
recipient: PeerId,
message: SignedDKGMessage<AuthorityId>
) -> Result<(), DKGError>
fn send( &self, recipient: PeerId, message: SignedDKGMessage<AuthorityId> ) -> Result<(), DKGError>
Send a DKG message to a specific peer.
sourcefn gossip(&self, message: SignedDKGMessage<AuthorityId>) -> Result<(), DKGError>
fn gossip(&self, message: SignedDKGMessage<AuthorityId>) -> Result<(), DKGError>
Send a DKG message to all peers.
sourcefn get_stream(&self) -> Option<UnboundedReceiver<SignedDKGMessage<AuthorityId>>>
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
fn local_peer_id(&self) -> PeerId
fn logger(&self) -> &DebugLogger
Implementations on Foreign Types§
source§impl<T: GossipEngineIface + ?Sized> GossipEngineIface for Box<T>where
Box<T>: Send + Sync + 'static,
impl<T: GossipEngineIface + ?Sized> GossipEngineIface for Box<T>where Box<T>: Send + Sync + 'static,
type Clock = <T as GossipEngineIface>::Clock
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
source§impl GossipEngineIface for ()
impl GossipEngineIface for ()
A Stub implementation of the GossipEngineIface.