mirror of
https://github.com/XRPLF/clio.git
synced 2026-07-26 16:40:17 +00:00
first half of support for books stream
This commit is contained in:
26
src/rpc/handlers/ServerInfo.cpp
Normal file
26
src/rpc/handlers/ServerInfo.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
#include <backend/BackendInterface.h>
|
||||
#include <rpc/RPCHelpers.h>
|
||||
|
||||
namespace RPC {
|
||||
|
||||
Result
|
||||
doServerInfo(Context const& context)
|
||||
{
|
||||
boost::json::object response = {};
|
||||
|
||||
auto range = context.backend->fetchLedgerRange();
|
||||
if (!range)
|
||||
{
|
||||
return Status{Error::rpcNOT_READY, "rangeNotFound"};
|
||||
}
|
||||
else
|
||||
{
|
||||
response["info"] = boost::json::object{};
|
||||
response["info"].as_object()["complete_ledgers"] =
|
||||
std::to_string(range->minSequence) + " - " +
|
||||
std::to_string(range->maxSequence);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
} // namespace RPC
|
||||
Reference in New Issue
Block a user