pub struct SerializableExampleStateMachine {
pub last_applied_log: Option<LogId<ExampleNodeId>>,
pub last_membership: StoredMembership<ExampleNodeId, BasicNode>,
pub data: BTreeMap<String, String>,
}
Expand description
Here defines a state machine of the raft, this state represents a copy of the data
between each node. Note that we are using serde
to serialize the data
, which has
a implementation to be serialized. Note that for this test we set both the key and
value as String, but you could set any type of value that has the serialization impl.
Fields§
§last_applied_log: Option<LogId<ExampleNodeId>>
§last_membership: StoredMembership<ExampleNodeId, BasicNode>
§data: BTreeMap<String, String>
Application data.
Trait Implementations§
source§impl Clone for SerializableExampleStateMachine
impl Clone for SerializableExampleStateMachine
source§fn clone(&self) -> SerializableExampleStateMachine
fn clone(&self) -> SerializableExampleStateMachine
Returns a copy 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 Default for SerializableExampleStateMachine
impl Default for SerializableExampleStateMachine
source§fn default() -> SerializableExampleStateMachine
fn default() -> SerializableExampleStateMachine
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for SerializableExampleStateMachine
impl<'de> Deserialize<'de> for SerializableExampleStateMachine
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 From<&ExampleStateMachine> for SerializableExampleStateMachine
impl From<&ExampleStateMachine> for SerializableExampleStateMachine
source§fn from(state: &ExampleStateMachine) -> Self
fn from(state: &ExampleStateMachine) -> Self
Converts to this type from the input type.