mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Insight support for ResourceManager
This commit is contained in:
@@ -53,19 +53,34 @@ public:
|
||||
|
||||
typedef SharedData <State> SharedState;
|
||||
|
||||
struct Stats
|
||||
{
|
||||
Stats (insight::Collector::ptr const& collector)
|
||||
{
|
||||
warn = collector->make_meter ("warn");
|
||||
drop = collector->make_meter ("drop");
|
||||
}
|
||||
|
||||
insight::Meter warn;
|
||||
insight::Meter drop;
|
||||
};
|
||||
|
||||
SharedState m_state;
|
||||
Stats m_stats;
|
||||
abstract_clock <std::chrono::seconds>& m_clock;
|
||||
Journal m_journal;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
Logic (clock_type& clock, Journal journal)
|
||||
: m_clock (clock)
|
||||
Logic (insight::Collector::ptr const& collector,
|
||||
clock_type& clock, Journal journal)
|
||||
: m_stats (collector)
|
||||
, m_clock (clock)
|
||||
, m_journal (journal)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~Logic ()
|
||||
~Logic ()
|
||||
{
|
||||
// These have to be cleared before the Logic is destroyed
|
||||
// since their destructors call back into the class.
|
||||
@@ -179,7 +194,8 @@ public:
|
||||
key.kind = kindAdmin;
|
||||
key.name = name;
|
||||
|
||||
m_journal.info << "Elevate " << prior << " to " << name;
|
||||
m_journal.info <<
|
||||
"Elevate " << prior << " to " << name;
|
||||
|
||||
Entry* entry (nullptr);
|
||||
|
||||
@@ -478,6 +494,9 @@ public:
|
||||
m_journal.info <<
|
||||
"Load warning: " << entry;
|
||||
|
||||
if (notify)
|
||||
++m_stats.warn;
|
||||
|
||||
return notify;
|
||||
}
|
||||
|
||||
@@ -490,6 +509,8 @@ public:
|
||||
charge (entry, feeDrop, state);
|
||||
drop = true;
|
||||
}
|
||||
if (drop)
|
||||
++m_stats.drop;
|
||||
return drop;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include "beast/beast/make_unique.h"
|
||||
|
||||
namespace ripple {
|
||||
namespace Resource {
|
||||
|
||||
@@ -28,11 +30,13 @@ public:
|
||||
Journal m_journal;
|
||||
Logic m_logic;
|
||||
|
||||
ManagerImp (Journal journal)
|
||||
ManagerImp (insight::Collector::ptr const& collector,
|
||||
Journal journal)
|
||||
: Thread ("Resource::Manager")
|
||||
, m_journal (journal)
|
||||
, m_logic (get_abstract_clock <
|
||||
std::chrono::steady_clock, std::chrono::seconds> (), journal)
|
||||
, m_logic (collector,
|
||||
get_abstract_clock <std::chrono::steady_clock, std::chrono::seconds> (),
|
||||
journal)
|
||||
{
|
||||
startThread ();
|
||||
}
|
||||
@@ -106,11 +110,17 @@ Manager::Manager ()
|
||||
{
|
||||
}
|
||||
|
||||
Manager::~Manager ()
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
Manager* Manager::New (Journal journal)
|
||||
std::unique_ptr <Manager> make_Manager (
|
||||
insight::Collector::ptr const& collector,
|
||||
Journal journal)
|
||||
{
|
||||
return new ManagerImp (journal);
|
||||
return std::make_unique <ManagerImp> (collector, journal);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
|
||||
public:
|
||||
explicit TestLogic (Journal journal)
|
||||
: Logic (member, journal)
|
||||
: Logic (insight::NullCollector::New(), member, journal)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user