pub struct RaftConfig {
pub node_id: u64,
pub group_id: u64,
pub peers: Vec<u64>,
pub learners: Vec<u64>,
pub observers: Vec<u64>,
pub starts_as_learner: bool,
pub starts_as_observer: bool,
pub election_timeout_min: Duration,
pub election_timeout_max: Duration,
pub heartbeat_interval: Duration,
}Expand description
Configuration for a Raft node.
Fields§
§node_id: u64This node’s ID (must be unique within the Raft group).
group_id: u64Raft group ID (for Multi-Raft routing).
peers: Vec<u64>IDs of voting peers in this group (excluding self).
learners: Vec<u64>IDs of non-voting learner peers in this group (excluding self).
Learners receive log replication but do not vote in elections and
are not counted in the commit quorum. They are promoted to voters
once they catch up — see RaftNode::promote_learner.
observers: Vec<u64>IDs of cross-cluster observer peers tracked by this leader.
Observers receive log entries and send advisory acks, but they never participate in leader election and are never counted in the commit quorum. A slow observer does not stall source commits.
starts_as_learner: boolWhether this node itself starts in the Learner role (boot-time).
Set true when a new node joins an existing cluster and is
created as a learner for a given group; cleared when the node is
promoted to voter via promote_self_to_voter.
starts_as_observer: boolWhether this node itself starts in the Observer role (boot-time).
Set true when this node is a cross-cluster mirror replica observing
a source cluster’s Raft group. An observer never participates in
elections and never contributes to the commit quorum. Acks it sends
to the source leader are advisory only.
election_timeout_min: DurationMinimum election timeout.
election_timeout_max: DurationMaximum election timeout.
heartbeat_interval: DurationHeartbeat interval (must be << election_timeout_min).
Implementations§
Source§impl RaftConfig
impl RaftConfig
Sourcepub fn cluster_size(&self) -> usize
pub fn cluster_size(&self) -> usize
Total number of voters (self + voter peers).
Learners are excluded. This value drives quorum math and so must never grow transiently while the learner is catching up — that is exactly the safety property the learner phase is designed to give.
Trait Implementations§
Source§impl Clone for RaftConfig
impl Clone for RaftConfig
Source§fn clone(&self) -> RaftConfig
fn clone(&self) -> RaftConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for RaftConfig
impl RefUnwindSafe for RaftConfig
impl Send for RaftConfig
impl Sync for RaftConfig
impl Unpin for RaftConfig
impl UnsafeUnpin for RaftConfig
impl UnwindSafe for RaftConfig
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.