Trait ConsensusHandler

Source
pub trait ConsensusHandler: Debug {
    // Required methods
    fn send_peer_message(&mut self, id: ServerId, message: PeerMessage);
    fn send_client_response(&mut self, id: ClientId, message: ClientResponse);
    fn set_timeout(&mut self, timeout: ConsensusTimeout);
    fn clear_timeout(&mut self, timeout: ConsensusTimeout);

    // Provided methods
    fn state_changed(&mut self, old: ConsensusState, new: ConsensusState) { ... }
    fn done(&mut self) { ... }
}
Expand description

Handler for actions returned from consensus

Required Methods§

Source

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

Source

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

Source

fn set_timeout(&mut self, timeout: ConsensusTimeout)

Source

fn clear_timeout(&mut self, timeout: ConsensusTimeout)

Provided Methods§

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.

Implementors§