OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
uhs/atomizer/archiver/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_ARCHIVER_CLIENT_H_
7#define OPENCBDC_TX_SRC_ARCHIVER_CLIENT_H_
8
12
13namespace cbdc::archiver {
15 using request = uint64_t;
16
18 using response = std::optional<cbdc::atomizer::block>;
19
24 class client {
25 public:
30 std::shared_ptr<logging::log> logger);
31 client() = delete;
32
35 auto init() -> bool;
36
40 auto get_block(uint64_t height)
41 -> std::optional<cbdc::atomizer::block>;
42
43 private:
45 network::endpoint_t m_endpoint;
46 std::shared_ptr<logging::log> m_logger;
47 };
48}
49
50#endif // OPENCBDC_TX_SRC_ARCHIVER_CLIENT_H_
Retrieves blocks from a remote archiver via the network.
auto init() -> bool
Attempts to connect to the archiver.
auto get_block(uint64_t height) -> std::optional< cbdc::atomizer::block >
Retrieves the block at the given height from the archiver.
Wrapper for a TCP socket.
std::optional< cbdc::atomizer::block > response
The requested block, or std::nullopt if not found.
uint64_t request
Height of the block to fetch from the archiver.
std::pair< ip_address, port_number_t > endpoint_t
[host name, port number].
Definition socket.hpp:19