OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
uhs/sentinel/client.hpp
Go to the documentation of this file.
1// Copyright (c) 2021 MIT Digital Currency Initiative,
2// Federal Reserve Bank of Boston
3// Distributed under the MIT software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#ifndef OPENCBDC_TX_SRC_SENTINEL_CLIENT_H_
7#define OPENCBDC_TX_SRC_SENTINEL_CLIENT_H_
8
9#include "async_interface.hpp"
14
15namespace cbdc::sentinel::rpc {
17 class client : public interface, public async_interface {
18 public:
22 client(std::vector<network::endpoint_t> endpoints,
23 std::shared_ptr<logging::log> logger);
24
25 ~client() override = default;
26
27 client() = delete;
28 client(const client&) = delete;
29 auto operator=(const client&) -> client& = delete;
30 client(client&&) = delete;
31 auto operator=(client&&) -> client& = delete;
32
38 auto init(std::optional<bool> error_fatal = std::nullopt) -> bool;
39
42 = std::optional<cbdc::sentinel::execute_response>;
43
48 -> execute_result_type override;
49
57 std::function<void(execute_result_type)> result_callback)
58 -> bool override;
59
61 using validate_result_type = std::optional<validate_response>;
62
69 -> validate_result_type override;
70
78 std::function<void(validate_result_type)> result_callback)
79 -> bool override;
80
81 private:
83 std::shared_ptr<logging::log> m_logger;
84
86 };
87}
88#endif // OPENCBDC_TX_SRC_SENTINEL_CLIENT_H_
Implements an RPC client over TCP sockets.
Interface for an asynchronous sentinel.
Interface for a sentinel.
TCP RPC client for sentinels.
client(client &&)=delete
std::optional< validate_response > validate_result_type
Return type from transaction validation.
~client() override=default
auto validate_transaction(transaction::full_tx tx) -> validate_result_type override
Send a transaction to the sentinel for validation and return the response.
auto operator=(const client &) -> client &=delete
auto init(std::optional< bool > error_fatal=std::nullopt) -> bool
Initializes the client.
std::optional< cbdc::sentinel::execute_response > execute_result_type
Result type from execute_transaction.
auto operator=(client &&) -> client &=delete
client(const client &)=delete
auto execute_transaction(transaction::full_tx tx) -> execute_result_type override
Send a transaction to the sentinel and return the response.
Tools for reading options from a configuration file and building application-specific parameter sets ...
Project-wide configuration options.
Definition config.hpp:132
A complete transaction.