hotstuff_rs::networking::network

Trait Network

source
pub trait Network: Clone + Send {
    // Required methods
    fn init_validator_set(&mut self, validator_set: ValidatorSet);
    fn update_validator_set(&mut self, updates: ValidatorSetUpdates);
    fn broadcast(&mut self, message: Message);
    fn send(&mut self, peer: VerifyingKey, message: Message);
    fn recv(&mut self) -> Option<(VerifyingKey, Message)>;
}

Required Methods§

source

fn init_validator_set(&mut self, validator_set: ValidatorSet)

Inform the network provider the validator set on wake-up.

source

fn update_validator_set(&mut self, updates: ValidatorSetUpdates)

Inform the networking provider of updates to the validator set.

source

fn broadcast(&mut self, message: Message)

Send a message to all peers (including listeners) without blocking.

source

fn send(&mut self, peer: VerifyingKey, message: Message)

Send a message to the specified peer without blocking.

source

fn recv(&mut self) -> Option<(VerifyingKey, Message)>

Receive a message from any peer. Returns immediately with a None if no message is available now.

Object Safety§

This trait is not object safe.

Implementors§