Skip to main content

Relay

Trait Relay 

Source
pub trait Relay:
    Clone
    + Send
    + 'static {
    type Digest: Digest;
    type PublicKey: PublicKey;
    type Plan: Send;

    // Required method
    fn broadcast(
        &mut self,
        payload: Self::Digest,
        plan: Self::Plan,
    ) -> impl Future<Output = ()> + Send;
}
Expand description

Relay is the interface responsible for broadcasting payloads to the network.

The consensus engine is only aware of a payload’s digest, not its contents. It is up to the relay to efficiently broadcast the full payload to other participants.

Required Associated Types§

Source

type Digest: Digest

Hash of an arbitrary payload.

Source

type PublicKey: PublicKey

Identity key of a network participant.

Source

type Plan: Send

Directive for how a payload should be broadcast.

Consensus mechanisms that need broadcast control (e.g. distinguishing initial broadcast from rebroadcasts) define a custom enum here. Mechanisms that treat every broadcast identically can set this to ().

Required Methods§

Source

fn broadcast( &mut self, payload: Self::Digest, plan: Self::Plan, ) -> impl Future<Output = ()> + Send

Broadcast a payload to the given recipients.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<E, A, B, C, H, Z, S, ES> Relay for Marshaled<E, A, B, C, H, Z, S, ES>
where E: Rng + Storage + Spawner + Metrics + Clock, A: Application<E, Block = B, Context = Context<Commitment, <Z::Scheme as CertificateScheme>::PublicKey>>, B: CertifiableBlock<Context = <A as Application<E>>::Context>, C: CodingScheme, H: Hasher, Z: Provider<Scope = Epoch, Scheme: Scheme<Commitment>>, S: Strategy, ES: Epocher,

Source§

type Digest = Commitment

Source§

type PublicKey = <<Z as Provider>::Scheme as Scheme>::PublicKey

Source§

type Plan = Plan<<Marshaled<E, A, B, C, H, Z, S, ES> as Relay>::PublicKey>

Source§

impl<E, S, A, B, ES> Relay for Deferred<E, S, A, B, ES>
where E: Rng + Spawner + Metrics + Clock, S: Scheme, A: Application<E, Block = B, Context = Context<B::Digest, S::PublicKey>>, B: CertifiableBlock<Context = <A as Application<E>>::Context>, ES: Epocher,

Source§

impl<E, S, A, B, ES> Relay for Inline<E, S, A, B, ES>
where E: Rng + Spawner + Metrics + Clock, S: Scheme, A: Application<E, Block = B, Context = Context<B::Digest, S::PublicKey>>, B: Block + Clone, ES: Epocher,