OpenCBDC Transaction Processor
|
Manages a sentinel server for the two-phase commit architecture. More...
#include <controller.hpp>
Public Member Functions | |
controller ()=delete | |
controller (const controller &)=delete | |
auto | operator= (const controller &) -> controller &=delete |
controller (controller &&)=delete | |
auto | operator= (controller &&) -> controller &=delete |
controller (uint32_t sentinel_id, const config::options &opts, std::shared_ptr< logging::log > logger) | |
Constructor. | |
~controller () override=default | |
auto | init () -> bool |
Initializes the controller. | |
auto | execute_transaction (transaction::full_tx tx, execute_result_callback_type result_callback) -> bool override |
Statically validates a transaction, submits it the shard coordinator network, and returns the result via a callback function. | |
auto | validate_transaction (transaction::full_tx tx, validate_result_callback_type result_callback) -> bool override |
Statically validates a transaction and generates a sentinel attestation if the transaction is valid. | |
![]() | |
virtual | ~async_interface ()=default |
async_interface ()=default | |
async_interface (const async_interface &)=delete | |
auto | operator= (const async_interface &) -> async_interface &=delete |
async_interface (async_interface &&)=delete | |
auto | operator= (async_interface &&) -> async_interface &=delete |
Additional Inherited Members | |
![]() | |
using | result_callback_type = std::function<void(std::optional<cbdc::sentinel::response>)> |
Callback function for a sentinel response. | |
using | execute_result_callback_type |
Callback function for transaction execution result. | |
using | validate_result = std::optional<cbdc::sentinel::validate_response> |
Result of a validation operation. | |
using | validate_result_callback_type = std::function<void(validate_result)> |
Callback function for providing a transaction validation result. | |
Manages a sentinel server for the two-phase commit architecture.
Definition at line 24 of file uhs/twophase/sentinel_2pc/controller.hpp.
|
delete |
|
delete |
|
delete |
cbdc::sentinel_2pc::controller::controller | ( | uint32_t | sentinel_id, |
const config::options & | opts, | ||
std::shared_ptr< logging::log > | logger ) |
Constructor.
sentinel_id | the running ID of this shard. |
opts | pointer to configuration options. |
logger | pointer shared logger. |
Definition at line 15 of file uhs/twophase/sentinel_2pc/controller.cpp.
|
overridedefault |
|
overridevirtual |
Statically validates a transaction, submits it the shard coordinator network, and returns the result via a callback function.
tx | transaction to submit. |
result_callback | function to call with the execution result. |
Implements cbdc::sentinel::async_interface.
Definition at line 98 of file uhs/twophase/sentinel_2pc/controller.cpp.
References cbdc::transaction::validation::check_tx(), cbdc::sentinel::static_invalid, cbdc::to_string(), cbdc::transaction::validation::to_string(), and cbdc::transaction::tx_id().
auto cbdc::sentinel_2pc::controller::init | ( | ) | -> bool |
Initializes the controller.
Connects to the shard coordinator network and launches a server thread for external clients.
Definition at line 27 of file uhs/twophase/sentinel_2pc/controller.cpp.
References cbdc::client::init(), cbdc::pubkey_from_privkey(), and cbdc::to_string().
|
delete |
|
delete |
|
overridevirtual |
Statically validates a transaction and generates a sentinel attestation if the transaction is valid.
tx | transaction to validate. |
result_callback | function to call with the attestation or std::nullopt if the transaction was invalid. |
Implements cbdc::sentinel::async_interface.
Definition at line 143 of file uhs/twophase/sentinel_2pc/controller.cpp.
References cbdc::transaction::validation::check_tx().