Crate bft_core

Source
Expand description

An efficient and stable Rust library of BFT core for distributed system.

The crate provides a simplification BFT core which only includes a BFT state machine. The BFT machine is in stop state in default, so send BftMsg::Start message firstly. If wants to pause running it, send BftMsg::Pause message.

§Example

let (s, r) = unbounded();
let mut bft = Core::new(SendMsg::new(s), vec![0]);

// send message
bft.send_bft_msg(CoreInput::Start).unwrap();
bft.send_bft_msg(CoreInput::Status(status)).unwrap();
bft.send_bft_msg(CoreInput::Feed(feed)).unwrap();
bft.send_bft_msg(CoreInput::Pause).unwrap();

// receive message
r.recv().unwrap();

Re-exports§

pub use crate::core::Core;

Modules§

core
BFT core.
error
BFT error.
types
BFT types.

Traits§

FromCore
BFT core send message.