OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
parsec/runtime_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_PARSEC_RUNTIME_LOCKING_SHARD_CONTROLLER_H_
7#define OPENCBDC_TX_SRC_PARSEC_RUNTIME_LOCKING_SHARD_CONTROLLER_H_
8
9#include "impl.hpp"
11#include "server.hpp"
12#include "state_machine.hpp"
13#include "util/raft/node.hpp"
15
18 class controller {
19 public:
27 controller(size_t component_id,
28 size_t node_id,
29 network::endpoint_t server_endpoint,
30 std::vector<network::endpoint_t> raft_endpoints,
31 std::shared_ptr<logging::log> logger);
32 ~controller() = default;
33
34 controller() = delete;
35 controller(const controller&) = delete;
36 auto operator=(const controller&) -> controller& = delete;
38 auto operator=(controller&&) -> controller& = delete;
39
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 void do_recovery();
51
52 void handle_get_tickets(
54
55 std::shared_ptr<logging::log> m_logger;
56
57 std::shared_ptr<state_machine> m_state_machine;
58 std::shared_ptr<raft::node> m_raft_serv;
59 std::shared_ptr<replicated_shard_client> m_raft_client;
60 std::unique_ptr<rpc::server> m_server;
61 std::shared_ptr<impl> m_shard;
62
63 std::vector<network::endpoint_t> m_raft_endpoints;
64 network::endpoint_t m_server_endpoint;
65 };
66}
67
68#endif
Manages a replicated runtime locking shard using Raft.
auto operator=(const controller &) -> controller &=delete
auto operator=(controller &&) -> controller &=delete
std::variant< tickets_type, error_code > get_tickets_return_type
Return type from a get tickets operation.
std::pair< ip_address, port_number_t > endpoint_t
[host name, port number].
Definition socket.hpp:19