OpenCBDC Transaction Processor
|
TCP RPC client for sentinels. More...
#include <client.hpp>
Public Types | |
using | execute_result_type = std::optional<cbdc::sentinel::execute_response> |
Result type from execute_transaction. | |
using | validate_result_type = std::optional<validate_response> |
Return type from transaction validation. | |
![]() | |
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. | |
Public Member Functions | |
client (std::vector< network::endpoint_t > endpoints, std::shared_ptr< logging::log > logger) | |
Constructor. | |
~client () override=default | |
client ()=delete | |
client (const client &)=delete | |
auto | operator= (const client &) -> client &=delete |
client (client &&)=delete | |
auto | operator= (client &&) -> client &=delete |
auto | init (std::optional< bool > error_fatal=std::nullopt) -> bool |
Initializes the client. | |
auto | execute_transaction (transaction::full_tx tx) -> execute_result_type override |
Send a transaction to the sentinel and return the response. | |
auto | execute_transaction (transaction::full_tx tx, std::function< void(execute_result_type)> result_callback) -> bool override |
Send a transaction to the sentinel and return the response via a callback function asynchronously. | |
auto | validate_transaction (transaction::full_tx tx) -> validate_result_type override |
Send a transaction to the sentinel for validation and return the response. | |
auto | validate_transaction (transaction::full_tx tx, std::function< void(validate_result_type)> result_callback) -> bool override |
Send a transaction to the sentinel for validation and return the response via a callback function asynchronously. | |
![]() | |
virtual | ~interface ()=default |
interface ()=default | |
interface (const interface &)=delete | |
auto | operator= (const interface &) -> interface &=delete |
interface (interface &&)=delete | |
auto | operator= (interface &&) -> interface &=delete |
![]() | |
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 |
virtual auto | validate_transaction (transaction::full_tx tx, validate_result_callback_type result_callback) -> bool=0 |
Statically validate the given transaction and generate a sentinel attestation if the transaction is valid. | |
TCP RPC client for sentinels.
Definition at line 17 of file uhs/sentinel/client.hpp.
using cbdc::sentinel::rpc::client::execute_result_type = std::optional<cbdc::sentinel::execute_response> |
Result type from execute_transaction.
Definition at line 41 of file uhs/sentinel/client.hpp.
using cbdc::sentinel::rpc::client::validate_result_type = std::optional<validate_response> |
Return type from transaction validation.
Definition at line 60 of file uhs/sentinel/client.hpp.
cbdc::sentinel::rpc::client::client | ( | std::vector< network::endpoint_t > | endpoints, |
std::shared_ptr< logging::log > | logger ) |
Constructor.
endpoints | sentinel cluster RPC endpoints. |
logger | pointer shared logger. |
Definition at line 13 of file uhs/sentinel/client.cpp.
|
overridedefault |
|
delete |
|
delete |
|
delete |
|
overridevirtual |
Send a transaction to the sentinel and return the response.
tx | transaction to send to the sentinel. |
Implements cbdc::sentinel::interface.
Definition at line 26 of file uhs/sentinel/client.cpp.
|
overridevirtual |
Send a transaction to the sentinel and return the response via a callback function asynchronously.
tx | transaction to send to the sentinel. |
result_callback | callback function to call with the result. |
Implements cbdc::sentinel::async_interface.
Definition at line 35 of file uhs/sentinel/client.cpp.
auto cbdc::sentinel::rpc::client::init | ( | std::optional< bool > | error_fatal = std::nullopt | ) | -> bool |
Initializes the client.
Establishes a connection to the sentinel.
error_fatal | treat connection errors as fatal. See tcp_client::init for further explanation. |
Definition at line 18 of file uhs/sentinel/client.cpp.
|
overridevirtual |
Send a transaction to the sentinel for validation and return the response.
tx | transaction to validate and attest to. |
Implements cbdc::sentinel::interface.
Definition at line 49 of file uhs/sentinel/client.cpp.
|
override |
Send a transaction to the sentinel for validation and return the response via a callback function asynchronously.
tx | transaction to validate and attest to. |
result_callback | callback function to call with the result. |
Definition at line 58 of file uhs/sentinel/client.cpp.