TARAXA
Loading...
Searching...
No Matches
rpc.hpp
Go to the documentation of this file.
2
6#include "plugin/plugin.hpp"
7
8namespace taraxa::net {
9class TaraxaFace;
10class NetFace;
11class EthFace;
12class TestFace;
13class DebugFace;
14} // namespace taraxa::net
15
16namespace taraxa::plugin {
17
18class Rpc : public Plugin {
19 public:
20 explicit Rpc(std::shared_ptr<AppBase> app) : Plugin(app) {}
21
22 std::string name() const override { return "RPC"; }
23 std::string description() const override { return "Includes http, ws and graphql APIs"; }
24
25 void init(const boost::program_options::variables_map& options) override;
26 void addOptions(boost::program_options::options_description& command_line_options) override;
27
28 void start() override;
29 void shutdown() override;
30
31 private:
33
34 // should be destroyed after all components, since they may depend on it through unsafe pointers
35 std::shared_ptr<util::ThreadPool> rpc_thread_pool_;
36 std::shared_ptr<util::ThreadPool> graphql_thread_pool_;
37
38 std::shared_ptr<net::HttpServer> jsonrpc_http_;
39 std::shared_ptr<net::HttpServer> graphql_http_;
40 std::shared_ptr<net::WsServer> jsonrpc_ws_;
41 std::shared_ptr<net::WsServer> graphql_ws_;
42 std::unique_ptr<JsonRpcServer> jsonrpc_api_;
43
44 uint32_t threads_ = 0;
45 bool enable_test_rpc_ = false;
46 bool enable_debug_ = false;
47};
48
49} // namespace taraxa::plugin
Definition ModularServer.h:61
Definition plugin.hpp:9
std::shared_ptr< AppBase > app() const
Definition plugin.hpp:14
Definition rpc.hpp:18
void shutdown() override
Definition rpc.cpp:192
Rpc(std::shared_ptr< AppBase > app)
Definition rpc.hpp:20
std::unique_ptr< JsonRpcServer > jsonrpc_api_
Definition rpc.hpp:42
void init(const boost::program_options::variables_map &options) override
Definition rpc.cpp:24
std::shared_ptr< net::HttpServer > jsonrpc_http_
Definition rpc.hpp:38
bool enable_debug_
Definition rpc.hpp:46
std::string name() const override
Definition rpc.hpp:22
void addOptions(boost::program_options::options_description &command_line_options) override
Definition rpc.cpp:36
std::shared_ptr< net::WsServer > graphql_ws_
Definition rpc.hpp:41
std::shared_ptr< net::HttpServer > graphql_http_
Definition rpc.hpp:39
std::shared_ptr< util::ThreadPool > graphql_thread_pool_
Definition rpc.hpp:36
std::string description() const override
Definition rpc.hpp:23
std::shared_ptr< net::WsServer > jsonrpc_ws_
Definition rpc.hpp:40
bool enable_test_rpc_
Definition rpc.hpp:45
std::shared_ptr< util::ThreadPool > rpc_thread_pool_
Definition rpc.hpp:35
uint32_t threads_
Definition rpc.hpp:44
void start() override
Definition rpc.cpp:44
Definition http_processor.hpp:11
Definition rpc.hpp:16