OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
parsec/agent/client.cpp
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#include "client.hpp"
7
8#include "format.hpp"
10
12 client::client(std::vector<network::endpoint_t> endpoints)
13 : m_client(std::make_unique<decltype(m_client)::element_type>(
14 std::move(endpoints))) {}
15
16 auto client::init() -> bool {
17 return m_client->init();
18 }
19
21 parameter_type param,
22 bool is_readonly_run,
23 const interface::exec_callback_type& result_callback)
24 -> bool {
25 auto req
26 = request{std::move(function), std::move(param), is_readonly_run};
27 return m_client->call(std::move(req),
28 [result_callback](std::optional<response> resp) {
29 assert(resp.has_value());
30 result_callback(resp.value());
31 });
32 }
33}
Buffer to store and retrieve byte data.
Definition buffer.hpp:15
std::function< void(exec_return_type)> exec_callback_type
Callback function type with function execution result.
auto exec(runtime_locking_shard::key_type function, parameter_type param, bool is_readonly_run, const interface::exec_callback_type &result_callback) -> bool
Requests execution of the function at a key with the given parameters.
auto init() -> bool
Intializes the underlying TCP client.
Agent contract execution RPC request message.