Struct CollectHandler

Source
pub struct CollectHandler {
    pub peer_messages: HashMap<ServerId, Vec<PeerMessage>>,
    pub client_messages: HashMap<ClientId, Vec<ClientResponse>>,
    pub timeouts: Vec<ConsensusTimeout>,
    pub clear_timeouts: Vec<ConsensusTimeout>,
    pub state: ConsensusState,
}
Expand description

A handler that collects all messages leaving processing of them untouched. Note that timeouts vectors may intersect, that means both - clearing and setting a new timeout was requested.

Fields§

§peer_messages: HashMap<ServerId, Vec<PeerMessage>>§client_messages: HashMap<ClientId, Vec<ClientResponse>>§timeouts: Vec<ConsensusTimeout>§clear_timeouts: Vec<ConsensusTimeout>§state: ConsensusState

Implementations§

Source§

impl CollectHandler

Source

pub fn new() -> Self

Source

pub fn clear(&mut self)

Delete all events

Trait Implementations§

Source§

impl ConsensusHandler for CollectHandler

Source§

fn send_peer_message(&mut self, id: ServerId, message: PeerMessage)

Saves peer message to a vector

Source§

fn send_client_response(&mut self, id: ClientId, message: ClientResponse)

Saves client message to a vector

Source§

fn set_timeout(&mut self, timeout: ConsensusTimeout)

Collects timeouts uniquely

Source§

fn clear_timeout(&mut self, timeout: ConsensusTimeout)

Source§

fn state_changed(&mut self, _old: ConsensusState, new: ConsensusState)

Called when consensus goes to new state. Initializing new consensus does not call this function.
Source§

fn done(&mut self)

Called when the particular event has been fully processed. Useful for doing actions in batches.
Source§

impl Debug for CollectHandler

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CollectHandler

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.