OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
status_server.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 "status_server.hpp"
7
9
12 std::shared_ptr<status_interface> impl,
13 std::unique_ptr<
15 : m_impl(std::move(impl)),
16 m_srv(std::move(srv)) {
17 m_srv->register_handler_callback([&](status_request req) {
18 return request_handler(req);
19 });
20 }
21
22 auto status_server::request_handler(status_request req)
23 -> std::optional<status_response> {
24 return std::visit(overloaded{[&](const uhs_status_request& r) {
25 return m_impl->check_unspent(
26 r.m_uhs_id);
27 },
28 [&](const tx_status_request& r) {
29 return m_impl->check_tx_id(r.m_tx_id);
30 }},
31 req);
32 }
33}
status_server(std::shared_ptr< status_interface > impl, std::unique_ptr< cbdc::rpc::blocking_server< status_request, status_response > > srv)
Constructor.
Generic synchronous RPC server.
std::variant< uhs_status_request, tx_status_request > status_request
Status request RPC message wrapper, holding either a UHS ID or TX ID query request.
RPC message for clients to use to request the status of a UHS ID.
Variant handler template.