Enum openraft::raft::AppendEntriesResponse
source · pub enum AppendEntriesResponse<NID: NodeId> {
Success,
PartialSuccess(Option<LogId<NID>>),
Conflict,
HigherVote(Vote<NID>),
}
Expand description
The response to an AppendEntriesRequest
.
RaftNetwork::append_entries
returns this type only when received an RPC reply.
Otherwise it should return RPCError
.
Variants§
Success
Successfully replicated all log entries to the target node.
PartialSuccess(Option<LogId<NID>>)
Successfully sent the first portion of log entries.
RaftNetwork::append_entries
can return a partial success.
For example, it tries to send log entries [1-2..3-10]
, the application is allowed to send
just [1-2..1-3]
and return PartialSuccess(1-3)
,
§Caution
The returned matching log id must be greater than or equal to the first log
id(AppendEntriesRequest::prev_log_id
) of the entries to send. If no RPC reply is
received, RaftNetwork::append_entries
must return an RPCError
to inform
Openraft that the first log id(AppendEntriesRequest::prev_log_id
) may not match on
the remote target node.
Conflict
The first log id(AppendEntriesRequest::prev_log_id
) of the entries to send does not
match on the remote target node.
HigherVote(Vote<NID>)
Seen a vote v
that does not hold mine_vote >= v
.
And a leader’s vote(committed vote) must be total order with other vote.
Therefore it has to be a higher vote: mine_vote < v
Implementations§
source§impl<NID: NodeId> AppendEntriesResponse<NID>
impl<NID: NodeId> AppendEntriesResponse<NID>
pub fn is_success(&self) -> bool
pub fn is_conflict(&self) -> bool
Trait Implementations§
source§impl<'de, NID: NodeId> Deserialize<'de> for AppendEntriesResponse<NID>
impl<'de, NID: NodeId> Deserialize<'de> for AppendEntriesResponse<NID>
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<NID: NodeId> Display for AppendEntriesResponse<NID>
impl<NID: NodeId> Display for AppendEntriesResponse<NID>
source§impl<NID: PartialEq + NodeId> PartialEq for AppendEntriesResponse<NID>
impl<NID: PartialEq + NodeId> PartialEq for AppendEntriesResponse<NID>
source§fn eq(&self, other: &AppendEntriesResponse<NID>) -> bool
fn eq(&self, other: &AppendEntriesResponse<NID>) -> bool
self
and other
values to be equal, and is used
by ==
.