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/nodestore/Database.h>
27#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/jss.h>
48 seconds -= unitVal * i;
68 for (
auto const& [k, v] : objectCounts)
79 Throw<std::runtime_error>(
"Failed to get relational database");
81 auto dbKB = db->getKBUsedAll();
84 ret[jss::dbKBTotal] = dbKB;
86 dbKB = db->getKBUsedLedger();
89 ret[jss::dbKBLedger] = dbKB;
91 dbKB = db->getKBUsedTransaction();
94 ret[jss::dbKBTransaction] = dbKB;
99 ret[jss::local_txs] =
static_cast<Json::UInt>(c);
105 ret[jss::historical_perminute] =
112 ret[jss::fullbelow_size] =
114 ret[jss::treenode_cache_size] =
116 ret[jss::treenode_track_size] =
121 using namespace std::chrono_literals;
122 textTime(uptime, s,
"year", 365 * 24h);
125 textTime(uptime, s,
"minute", 1min);
127 ret[jss::uptime] = uptime;
bool isMember(char const *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.
Json::Value doGetCounts(RPC::JsonContext &context)
Json::Value getCountsJson(Application &app, int minObjectCount)
static void textTime(std::string &text, UptimeClock::time_point &seconds, char const *unitName, std::chrono::seconds unitVal)
T time_since_epoch(T... args)