Trait round_based::containers::MessageStore[][src]

pub trait MessageStore {
    type M;
    type Err;
    type Output;
    fn push_msg(&mut self, msg: Msg<Self::M>) -> Result<(), Self::Err>;
fn contains_msg_from(&self, sender: u16) -> bool;
fn wants_more(&self) -> bool;
fn finish(self) -> Result<Self::Output, Self::Err>;
fn blame(&self) -> (u16, Vec<u16>); }

Accumulates messages received from other parties

StateMachine implementations need to handle incoming messages: they need to store messages somewhere until sufficient messages received, incoming messages needs to be pre-validated (haven’t we received message from this party at this round? is it a p2p message, as we expected? and so on). MessageStore encapsulates all this boilerplate.

Associated Types

type M[src]

Message body

type Err[src]

Error type

type Output[src]

Resulting messages container holding received messages

Loading content...

Required methods

fn push_msg(&mut self, msg: Msg<Self::M>) -> Result<(), Self::Err>[src]

Pushes received message to store

Might result in error if pre-validation failed. However, it does not prevent MessageStore from accepting further messages.

fn contains_msg_from(&self, sender: u16) -> bool[src]

Indicates if store contains message from this party

fn wants_more(&self) -> bool[src]

Indicates whether store needs more messages to receive

fn finish(self) -> Result<Self::Output, Self::Err>[src]

Returns resulting messages container

Returns error if store needs more messages (see wants_more).

fn blame(&self) -> (u16, Vec<u16>)[src]

Retrieve uncooperative parties

Returns how many more messages we expected to receive and list of parties who didn’t send a message

Loading content...

Implementors

impl<M> MessageStore for BroadcastMsgsStore<M>[src]

type M = M

type Err = StoreErr

type Output = BroadcastMsgs<M>

impl<M> MessageStore for P2PMsgsStore<M>[src]

type M = M

type Err = StoreErr

type Output = P2PMsgs<M>

Loading content...