OpenCBDC Transaction Processor
|
Raft state machine for managing a replicated coordinator. More...
#include <state_machine.hpp>
Data Structures | |
struct | coordinator_state |
Used to store dtxs, which phase they are in and relevant data require for recovery. More... | |
Public Types | |
enum class | command : uint8_t { prepare = 0 , commit = 1 , discard = 2 , done = 3 , get = 4 } |
Types of command the state machine can process. More... | |
Public Member Functions | |
state_machine (std::shared_ptr< logging::log > logger) | |
Constructor. | |
auto | commit (uint64_t log_idx, nuraft::buffer &data) -> nuraft::ptr< nuraft::buffer > override |
Commits a state machine command. | |
void | commit_config (nuraft::ulong log_idx, nuraft::ptr< nuraft::cluster_config > &) override |
Handler for the raft cluster configuration changes. | |
auto | apply_snapshot (nuraft::snapshot &) -> bool override |
Not implemented for coordinators. | |
auto | last_snapshot () -> nuraft::ptr< nuraft::snapshot > override |
Not implemented for coordinators. | |
auto | last_commit_index () -> uint64_t override |
Returns the index of the last-committed command. | |
void | create_snapshot (nuraft::snapshot &, nuraft::async_result< bool >::handler_type &when_done) override |
Not implemented for coordinators. | |
Raft state machine for managing a replicated coordinator.
Contains a coordinator_state and the last-committed index. Accepts requests to manage and query distributed transactions.
Definition at line 21 of file uhs/twophase/coordinator/state_machine.hpp.
|
strong |
Types of command the state machine can process.
Definition at line 30 of file uhs/twophase/coordinator/state_machine.hpp.
|
explicit |
Constructor.
Constructs a new coordinator state machine.
logger | pointer to logger instance. |
Definition at line 122 of file uhs/twophase/coordinator/state_machine.cpp.
|
override |
Not implemented for coordinators.
Definition at line 101 of file uhs/twophase/coordinator/state_machine.cpp.
|
override |
Commits a state machine command.
log_idx | index of raft entry. |
data | the buffer containing the command to commit. |
Definition at line 14 of file uhs/twophase/coordinator/state_machine.cpp.
References cbdc::serialized_size(), and cbdc::to_string().
|
override |
Handler for the raft cluster configuration changes.
log_idx | Raft log number of the configuration change. |
Definition at line 94 of file uhs/twophase/coordinator/state_machine.cpp.
|
override |
Not implemented for coordinators.
Definition at line 114 of file uhs/twophase/coordinator/state_machine.cpp.
|
override |
Returns the index of the last-committed command.
Definition at line 110 of file uhs/twophase/coordinator/state_machine.cpp.
|
override |
Not implemented for coordinators.
Definition at line 106 of file uhs/twophase/coordinator/state_machine.cpp.