OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
uhs/atomizer/watchtower/controller.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_WATCHTOWER_CONTROLLER_H_
7#define OPENCBDC_TX_SRC_WATCHTOWER_CONTROLLER_H_
8
13#include "watchtower.hpp"
14
15namespace cbdc::watchtower {
17 class controller {
18 public:
19 controller() = delete;
20 controller(const controller&) = delete;
21 auto operator=(const controller&) -> controller& = delete;
23 auto operator=(controller&&) -> controller& = delete;
24
29 controller(uint32_t watchtower_id,
30 config::options opts,
31 const std::shared_ptr<logging::log>& log);
32
34
37 auto init() -> bool;
38
39 auto get_block_height() const -> uint64_t;
40
41 private:
42 uint32_t m_watchtower_id;
43 cbdc::config::options m_opts;
44 std::shared_ptr<logging::log> m_logger;
45
46 watchtower m_watchtower;
47 std::atomic<uint64_t> m_last_blk_height{0};
48
49 cbdc::network::connection_manager m_internal_network;
50 cbdc::network::connection_manager m_external_network;
51 cbdc::network::connection_manager m_atomizer_network;
52
53 cbdc::archiver::client m_archiver_client;
54
55 std::thread m_internal_server;
56 std::thread m_external_server;
57 std::thread m_atomizer_thread;
58
59 void connect_atomizers();
60 auto atomizer_handler(cbdc::network::message_t&& pkt)
61 -> std::optional<cbdc::buffer>;
62 auto internal_server_handler(cbdc::network::message_t&& pkt)
63 -> std::optional<cbdc::buffer>;
64 auto external_server_handler(cbdc::network::message_t&& pkt)
65 -> std::optional<cbdc::buffer>;
66 };
67}
68
69#endif // OPENCBDC_TX_SRC_WATCHTOWER_CONTROLLER_H_
Retrieves blocks from a remote archiver via the network.
Wrapper for the watchtower executable implementation.
auto init() -> bool
Initializes the controller.
controller(controller &&)=delete
auto operator=(const controller &) -> controller &=delete
controller(const controller &)=delete
auto operator=(controller &&) -> controller &=delete
Service to answer client requests for processing status updates on submitted transactions.
Tools for reading options from a configuration file and building application-specific parameter sets ...
Project-wide configuration options.
Definition config.hpp:132
Received message type.
Watchtower core functionality.