pub struct RaftMetadata {
pub timeout: u64,
}Fields§
§timeout: u64Implementations§
Trait Implementations§
Source§impl Clone for RaftMetadata
impl Clone for RaftMetadata
Source§fn clone(&self) -> RaftMetadata
fn clone(&self) -> RaftMetadata
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl CoordinationMetadataBuilder<RaftMetadata> for RaftMetadataBuilder
impl CoordinationMetadataBuilder<RaftMetadata> for RaftMetadataBuilder
fn build(args: &SystemNodeArgs) -> RaftMetadata
Source§impl<T: Stopwatch, L: LogData> CoordinationService<T, RaftMessage<L>, LinearMap<SystemNodeId, RaftMetadata, CLUSTER_NODE_COUNT>, RaftMetadata> for RaftService<T, L>
impl<T: Stopwatch, L: LogData> CoordinationService<T, RaftMessage<L>, LinearMap<SystemNodeId, RaftMetadata, CLUSTER_NODE_COUNT>, RaftMetadata> for RaftService<T, L>
Source§fn new(id: SystemNodeId, metadata: RaftMetadata) -> Self
fn new(id: SystemNodeId, metadata: RaftMetadata) -> Self
The id will identify this nodes and the metadata will be used to obtain the root timeout.
From that value the heartbeat timeout, the candidate timeout, and the follower timeout will be computed
as follows:
- The heartbeat: this is the time between empty
RaftMessage::AppendLogare sent to the followers is set to be 20% of the root timeout. - The candidate timeout: this is the time candidates will wait for the
RaftMessage::AppendLogResponsebefore starting a new election. This is set to be the 75% of the root timeout - Follower timeout: this is the time a follower will wait for heartbeats, this is,
AppendLogmessages. This is set to be equal to the root timeout.
Source§fn leader(&self) -> Option<SystemNodeId>
fn leader(&self) -> Option<SystemNodeId>
Returns the ID of the cluster leader, or None if it is not set.
Source§fn get_state(&self) -> SystemState
fn get_state(&self) -> SystemState
Returns the coordinated state of the system
Source§fn get_current_rule(&self) -> Option<Rule>
fn get_current_rule(&self) -> Option<Rule>
Returns the current rule coordinated by the system
Source§fn update_rule(
&mut self,
communication_service: &mut dyn CommunicationService<Package<SystemNodeId, RaftMessage<L>>>,
new_rule: Rule,
)
fn update_rule( &mut self, communication_service: &mut dyn CommunicationService<Package<SystemNodeId, RaftMessage<L>>>, new_rule: Rule, )
Updates the nodes in the cluster based on [
new_config].Source§fn update_members(
&mut self,
communication_service: &mut dyn CommunicationService<RaftPackage<L>>,
new_config: UpdateClusterVec,
)
fn update_members( &mut self, communication_service: &mut dyn CommunicationService<RaftPackage<L>>, new_config: UpdateClusterVec, )
Updates the nodes in the cluster based on [
new_config].Source§fn update_state(
&mut self,
communication_service: &mut dyn CommunicationService<RaftPackage<L>>,
measurement: Measurement,
)
fn update_state( &mut self, communication_service: &mut dyn CommunicationService<RaftPackage<L>>, measurement: Measurement, )
Updates the coordinated state of the system based on
measurementSource§fn process(
&mut self,
communication_service: &mut dyn CommunicationService<RaftPackage<L>>,
package: Option<CoordinationPackage<RaftMessage<L>>>,
members: LinearMap<SystemNodeId, RaftMetadata, CLUSTER_NODE_COUNT>,
)
fn process( &mut self, communication_service: &mut dyn CommunicationService<RaftPackage<L>>, package: Option<CoordinationPackage<RaftMessage<L>>>, members: LinearMap<SystemNodeId, RaftMetadata, CLUSTER_NODE_COUNT>, )
Receives a message from another node so that the coordination can occur.
Source§impl Debug for RaftMetadata
impl Debug for RaftMetadata
Source§impl Default for RaftMetadata
impl Default for RaftMetadata
Source§fn default() -> RaftMetadata
fn default() -> RaftMetadata
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for RaftMetadata
impl<'de> Deserialize<'de> for RaftMetadata
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 Display for RaftMetadata
impl Display for RaftMetadata
Source§impl Serialize for RaftMetadata
impl Serialize for RaftMetadata
impl BasicMetadata for RaftMetadata
impl SerializableMetadata for RaftMetadata
Auto Trait Implementations§
impl Freeze for RaftMetadata
impl RefUnwindSafe for RaftMetadata
impl Send for RaftMetadata
impl Sync for RaftMetadata
impl Unpin for RaftMetadata
impl UnwindSafe for RaftMetadata
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