OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
uhs/twophase/coordinator/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_COORDINATOR_CLIENT_H_
7#define OPENCBDC_TX_SRC_COORDINATOR_CLIENT_H_
8
9#include "interface.hpp"
10#include "messages.hpp"
12
13namespace cbdc::coordinator::rpc {
15 class client : public interface {
16 public:
19 explicit client(std::vector<network::endpoint_t> endpoints);
20
21 client() = delete;
22 ~client() override = default;
23 client(const client&) = delete;
24 auto operator=(const client&) -> client& = delete;
25 client(client&&) = delete;
26 auto operator=(client&&) -> client& = delete;
27
32 auto init() -> bool;
33
42 callback_type result_callback)
43 -> bool override;
44
45 private:
46 std::unique_ptr<cbdc::rpc::tcp_client<request, response>> m_client;
47 };
48}
49
50#endif
std::function< void(std::optional< bool >)> callback_type
Signature of callback function for a transaction execution result.
auto init() -> bool
Initializes the RPC client by connecting to the coordinator cluster and starting a response handler t...
auto operator=(const client &) -> client &=delete
client(const client &)=delete
auto operator=(client &&) -> client &=delete
~client() override=default
auto execute_transaction(transaction::compact_tx tx, callback_type result_callback) -> bool override
Requests execution of the given transaction using the coordinator cluster.
A condensed, hash-only transaction representation.