pub struct MsgBuilder { /* private fields */ }
Expand description
A helper struct contains all infos about how to create a message.
User should read the term of previous log (id is from_id()-1
), the logs
between range [from_id(), until_id()]
, and provides those infos to
MsgBuilder to build pending messages. After that, user is to send this
message to remote_id()
.
WARNING:
User should check the value of channel_id()
to determine whether invoke
whick build function. If the value of is INDEX_CHANNEL_ID
, invokes
build_index_msg()
, otherwise invokes build_append_msg()
.
Implementations§
Source§impl MsgBuilder
impl MsgBuilder
Sourcepub fn channel_id(&self) -> u64
pub fn channel_id(&self) -> u64
The channel this message belongs to.
pub fn build_append_msg( builder: &Self, prev_term: u64, entries: Vec<Entry>, ) -> Message
pub fn build_index_msg( builder: &Self, prev_term: u64, indexes: Vec<LogIndex>, ) -> Message
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MsgBuilder
impl RefUnwindSafe for MsgBuilder
impl Send for MsgBuilder
impl Sync for MsgBuilder
impl Unpin for MsgBuilder
impl UnwindSafe for MsgBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more