20 #include <ripple/app/ledger/AcceptedLedger.h>
21 #include <ripple/app/ledger/InboundLedgers.h>
22 #include <ripple/app/ledger/LedgerMaster.h>
23 #include <ripple/app/main/Application.h>
24 #include <ripple/app/misc/NetworkOPs.h>
25 #include <ripple/app/rdb/backend/SQLiteDatabase.h>
26 #include <ripple/basics/UptimeClock.h>
27 #include <ripple/json/json_value.h>
28 #include <ripple/ledger/CachedSLEs.h>
29 #include <ripple/net/RPCErr.h>
30 #include <ripple/nodestore/Database.h>
31 #include <ripple/nodestore/DatabaseShard.h>
32 #include <ripple/protocol/ErrorCodes.h>
33 #include <ripple/protocol/jss.h>
34 #include <ripple/rpc/Context.h>
35 #include <ripple/shamap/ShardFamily.h>
51 seconds -= unitVal * i;
71 for (
auto const& [k, v] : objectCounts)
82 Throw<std::runtime_error>(
"Failed to get relational database");
84 auto dbKB = db->getKBUsedAll();
87 ret[jss::dbKBTotal] = dbKB;
89 dbKB = db->getKBUsedLedger();
92 ret[jss::dbKBLedger] = dbKB;
94 dbKB = db->getKBUsedTransaction();
97 ret[jss::dbKBTransaction] = dbKB;
102 ret[jss::local_txs] =
static_cast<Json::UInt>(c);
108 ret[jss::historical_perminute] =
115 ret[jss::fullbelow_size] =
117 ret[jss::treenode_cache_size] =
119 ret[jss::treenode_track_size] =
124 using namespace std::chrono_literals;
125 textTime(uptime, s,
"year", 365 * 24h);
128 textTime(uptime, s,
"minute", 1min);
130 ret[jss::uptime] = uptime;
138 jv[jss::fullbelow_size] = shardFamily->getFullBelowCacheSize();
139 jv[jss::treenode_cache_size] = cacheSz;
140 jv[jss::treenode_track_size] = trackSz;
141 ret[jss::write_load] = shardStore->getWriteLoad();
142 jv[jss::node_writes] =
std::to_string(shardStore->getStoreCount());
143 jv[jss::node_reads_total] = shardStore->getFetchTotalCount();
144 jv[jss::node_reads_hit] = shardStore->getFetchHitCount();
145 jv[jss::node_written_bytes] =
147 jv[jss::node_read_bytes] = shardStore->getFetchSize();
virtual Family & getNodeFamily()=0
virtual std::shared_ptr< TreeNodeCache > getTreeNodeCache(std::uint32_t ledgerSeq)=0
Return a pointer to the Family Tree Node Cache.
Json::Value doGetCounts(RPC::JsonContext &context)
virtual std::int32_t getWriteLoad() const =0
Retrieve the estimated number of pending write operations.
virtual TaggedCache< uint256, AcceptedLedger > & getAcceptedLedgerCache()=0
virtual std::size_t fetchRate()=0
Returns the rate of historical ledger fetches per minute.
virtual NodeStore::DatabaseShard * getShardStore()=0
virtual std::shared_ptr< FullBelowCache > getFullBelowCache(std::uint32_t ledgerSeq)=0
Return a pointer to the Family Full Below Cache.
virtual NetworkOPs & getOPs()=0
virtual CachedSLEs & cachedSLEs()=0
static CountedObjects & getInstance() noexcept
virtual InboundLedgers & getInboundLedgers()=0
T time_since_epoch(T... args)
@ objectValue
object value (collection of name/value pairs).
virtual LedgerMaster & getLedgerMaster()=0
virtual Config & config()=0
virtual RelationalDatabase & getRelationalDatabase()=0
bool isMember(const char *key) const
Return true if the object has a member named key.
double rate() const
Returns the fraction of cache hits.
virtual std::size_t getLocalTxCount()=0
Json::Value getCountsJson(Application &app, int minObjectCount)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
virtual NodeStore::Database & getNodeStore()=0
std::pair< int, int > getTreeNodeCacheSize()
Return a pair where the first item is the number of items cached and the second item is the number of...
virtual Family * getShardFamily()=0
void getCountsJson(Json::Value &obj)
List getCounts(int minimumThreshold) const
static void textTime(std::string &text, UptimeClock::time_point &seconds, const char *unitName, std::chrono::seconds unitVal)