|
OpenCBDC Transaction Processor
|
Interface for replicating internal state for prepared and committed tickets managed by a locking shard. More...
#include <replicated_shard_interface.hpp>

Data Structures | |
| struct | ticket_type |
| Ticket date stored in the replicated state machine. More... | |
Public Types | |
| enum class | error_code : uint8_t { unknown_ticket , internal_error } |
| Error codes returned by class methods. More... | |
| enum class | ticket_state : uint8_t { prepared , committed } |
| Ticket states returned by shards for broker recovery purposes. More... | |
| using | state_type |
| Type for state updates to a shard. | |
| using | tickets_type = std::unordered_map<ticket_number_type, ticket_type> |
| Type for the tickets list returned by the state machine. | |
| using | return_type = std::optional<error_code> |
| Return type from a prepare operation. An error, if applicable. | |
| using | callback_type = std::function<void(return_type)> |
| Callback function type for the result of a prepare operation. | |
| using | get_tickets_return_type = std::variant<tickets_type, error_code> |
| Return type from a get tickets operation. | |
| using | get_tickets_callback_type = std::function<void(get_tickets_return_type)> |
| Callback function type for the result of a get tickets operation. | |
Public Member Functions | |
| virtual | ~replicated_shard_interface ()=default |
| replicated_shard_interface ()=default | |
| replicated_shard_interface (const replicated_shard_interface &)=default | |
| auto | operator= (const replicated_shard_interface &) -> replicated_shard_interface &=default |
| replicated_shard_interface (replicated_shard_interface &&)=default | |
| auto | operator= (replicated_shard_interface &&) -> replicated_shard_interface &=default |
| virtual auto | prepare (ticket_number_type ticket_number, broker_id_type broker_id, state_type state_update, callback_type result_callback) -> bool=0 |
| Stores a prepare request for a ticket in the state machine. | |
| virtual auto | commit (ticket_number_type ticket_number, callback_type result_callback) -> bool=0 |
| Stores a commit request in the state machine. | |
| virtual auto | finish (ticket_number_type ticket_number, callback_type result_callback) -> bool=0 |
| Stores a finish request in the state machine. | |
| virtual auto | get_tickets (get_tickets_callback_type result_callback) const -> bool=0 |
| Retrieves unfinished tickets from the state machine. | |
Interface for replicating internal state for prepared and committed tickets managed by a locking shard.
Definition at line 14 of file replicated_shard_interface.hpp.
| using cbdc::parsec::runtime_locking_shard::replicated_shard_interface::callback_type = std::function<void(return_type)> |
Callback function type for the result of a prepare operation.
Definition at line 54 of file replicated_shard_interface.hpp.
| using cbdc::parsec::runtime_locking_shard::replicated_shard_interface::get_tickets_callback_type = std::function<void(get_tickets_return_type)> |
Callback function type for the result of a get tickets operation.
Definition at line 99 of file replicated_shard_interface.hpp.
| using cbdc::parsec::runtime_locking_shard::replicated_shard_interface::get_tickets_return_type = std::variant<tickets_type, error_code> |
Return type from a get tickets operation.
Either a map of ticket states or an error code.
Definition at line 97 of file replicated_shard_interface.hpp.
| using cbdc::parsec::runtime_locking_shard::replicated_shard_interface::return_type = std::optional<error_code> |
Return type from a prepare operation. An error, if applicable.
Definition at line 52 of file replicated_shard_interface.hpp.
Type for state updates to a shard.
A map of keys and their new values.
Definition at line 44 of file replicated_shard_interface.hpp.
| using cbdc::parsec::runtime_locking_shard::replicated_shard_interface::tickets_type = std::unordered_map<ticket_number_type, ticket_type> |
Type for the tickets list returned by the state machine.
Definition at line 49 of file replicated_shard_interface.hpp.
|
strong |
Error codes returned by class methods.
| Enumerator | |
|---|---|
| unknown_ticket | Requested ticket does not exist. |
| internal_error | Internal error preventing processing. |
Definition at line 17 of file replicated_shard_interface.hpp.
|
strong |
Ticket states returned by shards for broker recovery purposes.
| Enumerator | |
|---|---|
| prepared | Prepared, holds locks. |
| committed | Committed, not holding any locks. |
Definition at line 25 of file replicated_shard_interface.hpp.
|
virtualdefault |
|
default |
|
default |
|
default |
|
pure virtual |
Stores a commit request in the state machine.
| ticket_number | ticket to commit. |
| result_callback | function to call with commit result. |
Implemented in cbdc::parsec::runtime_locking_shard::replicated_shard, and cbdc::parsec::runtime_locking_shard::replicated_shard_client.
|
pure virtual |
Stores a finish request in the state machine.
| ticket_number | ticket to finish. |
| result_callback | function to call with finish result. |
Implemented in cbdc::parsec::runtime_locking_shard::replicated_shard, and cbdc::parsec::runtime_locking_shard::replicated_shard_client.
|
nodiscardpure virtual |
Retrieves unfinished tickets from the state machine.
| result_callback | function to call with the tickets held by the state machine. |
Implemented in cbdc::parsec::runtime_locking_shard::replicated_shard, and cbdc::parsec::runtime_locking_shard::replicated_shard_client.
|
default |
|
default |
|
pure virtual |
Stores a prepare request for a ticket in the state machine.
| ticket_number | ticket to prepare. |
| broker_id | broker managing the ticket. |
| state_update | keys and values to update after commit. |
| result_callback | function to call with prepare result. |
Implemented in cbdc::parsec::runtime_locking_shard::replicated_shard, and cbdc::parsec::runtime_locking_shard::replicated_shard_client.