mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Add RPCService, call the Manager from RPCServerHandler
This commit is contained in:
@@ -108,6 +108,7 @@ public:
|
||||
, m_checkTimer (this)
|
||||
, m_checkSources (true) // true to cause a full scan on start
|
||||
{
|
||||
addRPCHandlers();
|
||||
m_thread.start (this);
|
||||
}
|
||||
|
||||
@@ -126,6 +127,41 @@ public:
|
||||
m_thread.stop (false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// RPCService
|
||||
//
|
||||
|
||||
Json::Value rpcPrint (Json::Value const& args)
|
||||
{
|
||||
return m_logic.rpcPrint (args);
|
||||
}
|
||||
|
||||
Json::Value rpcRebuild (Json::Value const& args)
|
||||
{
|
||||
m_thread.call (&Logic::dirtyChosen, &m_logic);
|
||||
Json::Value result;
|
||||
result ["chosen_list"] = "rebuilding";
|
||||
return result;
|
||||
}
|
||||
|
||||
Json::Value rpcSources (Json::Value const& args)
|
||||
{
|
||||
return m_logic.rpcSources(args);
|
||||
}
|
||||
|
||||
void addRPCHandlers()
|
||||
{
|
||||
addRPCHandler ("validators_print", beast::bind (
|
||||
&ManagerImp::rpcPrint, this, beast::_1));
|
||||
|
||||
addRPCHandler ("validators_rebuild", beast::bind (
|
||||
&ManagerImp::rpcRebuild, this, beast::_1));
|
||||
|
||||
addRPCHandler ("validators_sources", beast::bind (
|
||||
&ManagerImp::rpcSources, this, beast::_1));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void addStrings (String name, std::vector <std::string> const& strings)
|
||||
@@ -267,9 +303,9 @@ private:
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
Manager* Manager::New (Service& parent, Journal journal)
|
||||
Validators::Manager* Validators::Manager::New (Service& parent, Journal journal)
|
||||
{
|
||||
return new ManagerImp (parent, journal);
|
||||
return new Validators::ManagerImp (parent, journal);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user