OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
uhs/atomizer/shard/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_SHARD_CONTROLLER_H_
7#define OPENCBDC_TX_SRC_SHARD_CONTROLLER_H_
8
9#include "shard.hpp"
14
15#include <memory>
16#include <secp256k1.h>
17
18namespace cbdc::shard {
20 class controller {
21 public:
22 controller() = delete;
23 controller(const controller&) = delete;
24 auto operator=(const controller&) -> controller& = delete;
26 auto operator=(controller&&) -> controller& = delete;
27
32 controller(uint32_t shard_id,
33 config::options opts,
34 std::shared_ptr<logging::log> logger);
35
37
43 auto init() -> bool;
44
45 private:
46 uint32_t m_shard_id;
48 std::shared_ptr<logging::log> m_logger;
49 shard m_shard;
50
51 cbdc::network::connection_manager m_watchtower_network;
52 cbdc::network::connection_manager m_atomizer_network;
54
55 std::thread m_shard_server;
56 std::thread m_atomizer_client;
57
58 cbdc::archiver::client m_archiver_client;
59
61 std::vector<std::thread> m_handler_threads;
62
63 auto server_handler(cbdc::network::message_t&& pkt)
64 -> std::optional<cbdc::buffer>;
65 auto atomizer_handler(cbdc::network::message_t&& pkt)
66 -> std::optional<cbdc::buffer>;
67 void request_consumer();
68 };
69}
70
71#endif // OPENCBDC_TX_SRC_SHARD_CONTROLLER_H_
Retrieves blocks from a remote archiver via the network.
Thread-safe producer-consumer FIFO queue supporting multiple concurrent producers and consumers.
Wrapper for the shard executable implementation.
auto init() -> bool
Initializes the controller.
controller(controller &&)=delete
auto operator=(const controller &) -> controller &=delete
auto operator=(controller &&) -> controller &=delete
controller(const controller &)=delete
Database shard representing a fraction of the UTXO set.
Definition shard.hpp:36
Tools for reading options from a configuration file and building application-specific parameter sets ...
Shard core functionality.
Project-wide configuration options.
Definition config.hpp:132
Received message type.