20#include <xrpld/app/ledger/AcceptedLedger.h>
21#include <xrpld/app/ledger/InboundLedgers.h>
22#include <xrpld/app/ledger/LedgerMaster.h>
23#include <xrpld/app/main/Application.h>
24#include <xrpld/app/misc/NetworkOPs.h>
25#include <xrpld/app/rdb/backend/SQLiteDatabase.h>
26#include <xrpld/ledger/CachedSLEs.h>
27#include <xrpld/nodestore/Database.h>
28#include <xrpld/rpc/Context.h>
29#include <xrpl/basics/UptimeClock.h>
30#include <xrpl/json/json_value.h>
31#include <xrpl/protocol/ErrorCodes.h>
32#include <xrpl/protocol/RPCErr.h>
33#include <xrpl/protocol/jss.h>
49 seconds -= unitVal * i;
69 for (
auto const& [k, v] : objectCounts)
80 Throw<std::runtime_error>(
"Failed to get relational database");
82 auto dbKB = db->getKBUsedAll();
85 ret[jss::dbKBTotal] = dbKB;
87 dbKB = db->getKBUsedLedger();
90 ret[jss::dbKBLedger] = dbKB;
92 dbKB = db->getKBUsedTransaction();
95 ret[jss::dbKBTransaction] = dbKB;
100 ret[jss::local_txs] =
static_cast<Json::UInt>(c);
106 ret[jss::historical_perminute] =
113 ret[jss::fullbelow_size] =
115 ret[jss::treenode_cache_size] =
117 ret[jss::treenode_track_size] =
122 using namespace std::chrono_literals;
123 textTime(uptime, s,
"year", 365 * 24h);
126 textTime(uptime, s,
"minute", 1min);
128 ret[jss::uptime] = uptime;
bool isMember(const char *key) const
Return true if the object has a member named key.
virtual CachedSLEs & cachedSLEs()=0
virtual Config & config()=0
virtual NodeStore::Database & getNodeStore()=0
virtual TaggedCache< uint256, AcceptedLedger > & getAcceptedLedgerCache()=0
virtual NetworkOPs & getOPs()=0
virtual InboundLedgers & getInboundLedgers()=0
virtual Family & getNodeFamily()=0
virtual LedgerMaster & getLedgerMaster()=0
virtual RelationalDatabase & getRelationalDatabase()=0
static CountedObjects & getInstance() noexcept
List getCounts(int minimumThreshold) const
virtual std::shared_ptr< FullBelowCache > getFullBelowCache()=0
Return a pointer to the Family Full Below Cache.
virtual std::shared_ptr< TreeNodeCache > getTreeNodeCache()=0
Return a pointer to the Family Tree Node Cache.
virtual std::size_t fetchRate()=0
Returns the rate of historical ledger fetches per minute.
virtual std::size_t getLocalTxCount()=0
void getCountsJson(Json::Value &obj)
virtual std::int32_t getWriteLoad() const =0
Retrieve the estimated number of pending write operations.
double rate() const
Returns the fraction of cache hits.
@ objectValue
object value (collection of name/value pairs).
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
static void textTime(std::string &text, UptimeClock::time_point &seconds, const char *unitName, std::chrono::seconds unitVal)
Json::Value doGetCounts(RPC::JsonContext &context)
Json::Value getCountsJson(Application &app, int minObjectCount)
T time_since_epoch(T... args)