RaftMetadata

Struct RaftMetadata 

Source
pub struct RaftMetadata {
    pub timeout: u64,
}

Fields§

§timeout: u64

Implementations§

Source§

impl RaftMetadata

Source

pub fn new(timeout: u64) -> Self

Trait Implementations§

Source§

impl Clone for RaftMetadata

Source§

fn clone(&self) -> RaftMetadata

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl CoordinationMetadataBuilder<RaftMetadata> for RaftMetadataBuilder

Source§

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

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::AppendLog are 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::AppendLogResponse before 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, AppendLog messages. This is set to be equal to the root timeout.
Source§

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

Returns the coordinated state of the system
Source§

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, )

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, )

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, )

Updates the coordinated state of the system based on measurement
Source§

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RaftMetadata

Source§

fn default() -> RaftMetadata

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for RaftMetadata

Source§

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

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Serialize for RaftMetadata

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl BasicMetadata for RaftMetadata

Source§

impl SerializableMetadata for RaftMetadata

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> Body for T
where T: Clone + Debug,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Readable for T
where T: Debug,

Source§

impl<T> Writable for T
where T: Debug,