pub struct LeaderId {
pub term: u64,
pub node_id: u64,
}Expand description
LeaderId represents the leader identifier in Raft.
Fields§
§term: u64§node_id: u64Trait Implementations§
Source§impl<'de> Deserialize<'de> for LeaderId
impl<'de> Deserialize<'de> for LeaderId
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Message for LeaderId
impl Message for LeaderId
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Encodes the message to a buffer. Read more
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message to a newly allocated buffer.
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Encodes the message with a length-delimiter to a buffer. Read more
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message with a length-delimiter to a newly allocated buffer.
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes an instance of the message from a buffer. Read more
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes a length-delimited instance of the message from the buffer.
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
Decodes an instance of the message from a buffer, and merges it into
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
Decodes a length-delimited instance of the message from buffer, and
merges it into
self.Source§impl PartialOrd<u64> for LeaderId
impl PartialOrd<u64> for LeaderId
Source§impl PartialOrd for LeaderId
Implements PartialOrd for LeaderId to enforce the standard Raft behavior of
at most one leader per term.
impl PartialOrd for LeaderId
Implements PartialOrd for LeaderId to enforce the standard Raft behavior of at most one leader per term.
In standard Raft, each term can have at most one leader. This is enforced by making leader IDs with the same term incomparable (returning None), unless they refer to the same node.
This differs from the PartialOrd default implementation which would
allow multiple leaders in the same term by comparing node IDs.
Source§impl RaftLeaderId<TypeConfig> for LeaderId
impl RaftLeaderId<TypeConfig> for LeaderId
Source§fn to_committed(&self) -> Self::Committed
fn to_committed(&self) -> Self::Committed
Convert this leader ID to a committed leader ID. Read more
impl Copy for LeaderId
impl Eq for LeaderId
impl StructuralPartialEq for LeaderId
Auto Trait Implementations§
impl Freeze for LeaderId
impl RefUnwindSafe for LeaderId
impl Send for LeaderId
impl Sync for LeaderId
impl Unpin for LeaderId
impl UnsafeUnpin for LeaderId
impl UnwindSafe for LeaderId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> MessageSummary<T> for Twhere
T: Display,
impl<T> MessageSummary<T> for Twhere
T: Display,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<C, T> RaftLeaderIdExt<C> for Twhere
C: RaftTypeConfig,
T: RaftLeaderId<C>,
impl<C, T> RaftLeaderIdExt<C> for Twhere
C: RaftTypeConfig,
T: RaftLeaderId<C>,
Source§fn new_with_default_term(node_id: <C as RaftTypeConfig>::NodeId) -> Self
fn new_with_default_term(node_id: <C as RaftTypeConfig>::NodeId) -> Self
Create a LeaderId with default Term and specified Node ID
Source§fn new_committed(
term: <C as RaftTypeConfig>::Term,
node_id: <C as RaftTypeConfig>::NodeId,
) -> Self::Committed
fn new_committed( term: <C as RaftTypeConfig>::Term, node_id: <C as RaftTypeConfig>::NodeId, ) -> Self::Committed
Create a new committed leader ID.
Source§fn to_node_id(&self) -> <C as RaftTypeConfig>::NodeId
fn to_node_id(&self) -> <C as RaftTypeConfig>::NodeId
Get the node ID of this leader as an owned value.