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
"
9
#include "
util/serialization/format.hpp
"
10
11
namespace
cbdc::parsec::agent::rpc
{
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
20
auto
client::exec
(
runtime_locking_shard::key_type
function,
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
}
cbdc::buffer
Buffer to store and retrieve byte data.
Definition
buffer.hpp:15
cbdc::parsec::agent::interface::exec_callback_type
std::function< void(exec_return_type)> exec_callback_type
Callback function type with function execution result.
Definition
parsec/agent/interface.hpp:52
cbdc::parsec::agent::rpc::client::exec
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.
Definition
parsec/agent/client.cpp:20
cbdc::parsec::agent::rpc::client::client
client()=delete
cbdc::parsec::agent::rpc::client::init
auto init() -> bool
Intializes the underlying TCP client.
Definition
parsec/agent/client.cpp:16
cbdc::parsec::agent::rpc
Definition
parsec/agent/client.cpp:11
client.hpp
format.hpp
cbdc::parsec::agent::rpc::exec_request
Agent contract execution RPC request message.
Definition
parsec/agent/messages.hpp:13
format.hpp
src
parsec
agent
client.cpp
Generated by
1.12.0