libuav original
Dependents: UAVCAN UAVCAN_Subscriber
PersistentState Class Reference
This class is a convenient container for persistent state variables defined by Raft. More...
#include <persistent_state.hpp>
Public Member Functions | |
int | init () |
Initialization is performed as follows (every step may fail and return an error): 1. | |
int | setCurrentTerm (Term term) |
Invokes storage IO. | |
int | setVotedFor (NodeID node_id) |
Invokes storage IO. |
Detailed Description
This class is a convenient container for persistent state variables defined by Raft.
Writes are slow, reads are instantaneous.
Definition at line 25 of file persistent_state.hpp.
Member Function Documentation
int init | ( | ) |
Initialization is performed as follows (every step may fail and return an error): 1.
Log is restored or initialized. 2. Current term is restored. If there was no current term stored and the log is empty, it will be initialized with zero. 3. VotedFor value is restored. If there was no VotedFor value stored, the log is empty, and the current term is zero, the value will be initialized with zero.
Definition at line 53 of file persistent_state.hpp.
int setCurrentTerm | ( | Term | term ) |
Invokes storage IO.
Definition at line 171 of file persistent_state.hpp.
int setVotedFor | ( | NodeID | node_id ) |
Invokes storage IO.
Definition at line 202 of file persistent_state.hpp.
Generated on Tue Jul 12 2022 17:17:37 by 1.7.2