Trait paxakos::communicator::Communicator[][src]

pub trait Communicator: Sized + 'static {
    type Node: NodeInfo;
    type RoundNum: RoundNum;
    type CoordNum: CoordNum;
    type LogEntry: LogEntry;
    type Error: Debug + Send + Sync + 'static;
    type SendPrepare: Future<Output = Result<VoteFor<Self>, Self::Error>>;
    type Abstain: Debug + Send + Sync + 'static;
    type SendProposal: Future<Output = Result<AcceptanceFor<Self>, Self::Error>>;
    type Yea: Debug + Send + Sync + 'static;
    type Nay: Debug + Send + Sync + 'static;
    type SendCommit: Future<Output = Result<Committed, Self::Error>>;
    type SendCommitById: Future<Output = Result<Committed, Self::Error>>;
    fn send_prepare<'a>(
        &mut self,
        receivers: &'a [Self::Node],
        round_num: Self::RoundNum,
        coord_num: Self::CoordNum
    ) -> Vec<(&'a Self::Node, Self::SendPrepare)>;
fn send_proposal<'a>(
        &mut self,
        receivers: &'a [Self::Node],
        round_num: Self::RoundNum,
        coord_num: Self::CoordNum,
        log_entry: Arc<Self::LogEntry>
    ) -> Vec<(&'a Self::Node, Self::SendProposal)>;
fn send_commit<'a>(
        &mut self,
        receivers: &'a [Self::Node],
        round_num: Self::RoundNum,
        coord_num: Self::CoordNum,
        log_entry: Arc<Self::LogEntry>
    ) -> Vec<(&'a Self::Node, Self::SendCommit)>;
fn send_commit_by_id<'a>(
        &mut self,
        receivers: &'a [Self::Node],
        round_num: Self::RoundNum,
        coord_num: Self::CoordNum,
        log_entry_id: <Self::LogEntry as LogEntry>::Id
    ) -> Vec<(&'a Self::Node, Self::SendCommitById)>; }
Expand description

Defines how Nodes call others’ RequestHandlers.

The simplest possible implementation directly calls RequestHandler methods, requiring that all nodes live in the same process. This is useful for prototyping and testing. Most other use cases require a different, custom implementation.

Soundness

Implementations must be secure, i.e. prevent forgery and replay attacks. This implicitly means that a restarted node will not see messages intended for its previous run, i.e. delayed messages sent over a connectionless protocol. Failure to shield a node from such messages may cause it to come out of passive participation mode early and lead to inconsistency.

Associated Types

Required methods

Implementors