OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
uhs/twophase/locking_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_LOCKING_SHARD_CONTROLLER_H_
7#define OPENCBDC_TX_SRC_LOCKING_SHARD_CONTROLLER_H_
8
9#include "client.hpp"
10#include "locking_shard.hpp"
11#include "state_machine.hpp"
12#include "status_server.hpp"
13#include "util/raft/node.hpp"
16
17namespace cbdc::locking_shard {
19 class controller {
20 public:
26 controller(size_t shard_id,
27 size_t node_id,
28 config::options opts,
29 std::shared_ptr<logging::log> logger);
30 ~controller() = default;
31
32 controller() = delete;
33 controller(const controller&) = delete;
34 auto operator=(const controller&) -> controller& = delete;
36 auto operator=(controller&&) -> controller& = delete;
37
43 auto init() -> bool;
44
45 private:
46 auto raft_callback(nuraft::cb_func::Type type,
47 nuraft::cb_func::Param* param)
48 -> nuraft::cb_func::ReturnCode;
49
50 config::options m_opts;
51 std::shared_ptr<logging::log> m_logger;
52 size_t m_shard_id;
53 size_t m_node_id;
54 std::string m_preseed_dir;
55
56 std::shared_ptr<state_machine> m_state_machine;
57 std::shared_ptr<locking_shard> m_shard;
58 std::shared_ptr<raft::node> m_raft_serv;
59 std::unique_ptr<rpc::status_server> m_status_server;
60 std::unique_ptr<cbdc::rpc::tcp_server<raft::rpc::server>> m_server;
61 };
62}
63
64#endif // OPENCBDC_TX_SRC_LOCKING_SHARD_CONTROLLER_H_
Manages a replicated locking shard using Raft.
controller(const controller &)=delete
auto operator=(controller &&) -> controller &=delete
controller(controller &&)=delete
auto init() -> bool
Initializes the locking shard by reading the pre-seed file if applicable, initializing the raft clust...
auto operator=(const controller &) -> controller &=delete
Project-wide configuration options.
Definition config.hpp:132