mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-24 13:05:53 +00:00
Use injected Logs
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
#include <ripple/app/main/Application.h>
|
#include <ripple/app/main/Application.h>
|
||||||
#include <ripple/app/tx/InboundTransactions.h>
|
#include <ripple/app/tx/InboundTransactions.h>
|
||||||
#include <ripple/app/tx/LocalTxs.h>
|
#include <ripple/app/tx/LocalTxs.h>
|
||||||
|
#include <ripple/basics/Log.h>
|
||||||
#include <ripple/core/Config.h>
|
#include <ripple/core/Config.h>
|
||||||
|
|
||||||
#include <beast/cxx14/memory.h> // <memory>
|
#include <beast/cxx14/memory.h> // <memory>
|
||||||
@@ -85,7 +86,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<Consensus>
|
std::unique_ptr<Consensus>
|
||||||
make_Consensus (Config const& config);
|
make_Consensus (Config const& config, Logs& logs);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -172,9 +172,9 @@ public:
|
|||||||
Ledger::Ledger (create_genesis_t, Config const& config, Family& family)
|
Ledger::Ledger (create_genesis_t, Config const& config, Family& family)
|
||||||
: mImmutable (false)
|
: mImmutable (false)
|
||||||
, txMap_ (std::make_shared <SHAMap> (SHAMapType::TRANSACTION,
|
, txMap_ (std::make_shared <SHAMap> (SHAMapType::TRANSACTION,
|
||||||
family, deprecatedLogs().journal("SHAMap")))
|
family))
|
||||||
, stateMap_ (std::make_shared <SHAMap> (SHAMapType::STATE,
|
, stateMap_ (std::make_shared <SHAMap> (SHAMapType::STATE,
|
||||||
family, deprecatedLogs().journal("SHAMap")))
|
family))
|
||||||
{
|
{
|
||||||
info_.seq = 1;
|
info_.seq = 1;
|
||||||
info_.drops = SYSTEM_CURRENCY_START;
|
info_.drops = SYSTEM_CURRENCY_START;
|
||||||
@@ -208,10 +208,9 @@ Ledger::Ledger (uint256 const& parentHash,
|
|||||||
Family& family)
|
Family& family)
|
||||||
: mImmutable (true)
|
: mImmutable (true)
|
||||||
, txMap_ (std::make_shared <SHAMap> (
|
, txMap_ (std::make_shared <SHAMap> (
|
||||||
SHAMapType::TRANSACTION, transHash, family,
|
SHAMapType::TRANSACTION, transHash, family))
|
||||||
deprecatedLogs().journal("SHAMap")))
|
|
||||||
, stateMap_ (std::make_shared <SHAMap> (SHAMapType::STATE, accountHash,
|
, stateMap_ (std::make_shared <SHAMap> (SHAMapType::STATE, accountHash,
|
||||||
family, deprecatedLogs().journal("SHAMap")))
|
family))
|
||||||
{
|
{
|
||||||
info_.seq = ledgerSeq;
|
info_.seq = ledgerSeq;
|
||||||
info_.parentCloseTime = parentCloseTime;
|
info_.parentCloseTime = parentCloseTime;
|
||||||
@@ -268,7 +267,7 @@ Ledger::Ledger (open_ledger_t, Ledger const& prevLedger,
|
|||||||
NetClock::time_point closeTime)
|
NetClock::time_point closeTime)
|
||||||
: mImmutable (false)
|
: mImmutable (false)
|
||||||
, txMap_ (std::make_shared <SHAMap> (SHAMapType::TRANSACTION,
|
, txMap_ (std::make_shared <SHAMap> (SHAMapType::TRANSACTION,
|
||||||
prevLedger.stateMap_->family(), deprecatedLogs().journal("SHAMap")))
|
prevLedger.stateMap_->family()))
|
||||||
, stateMap_ (prevLedger.stateMap_->snapShot (true))
|
, stateMap_ (prevLedger.stateMap_->snapShot (true))
|
||||||
, fees_(prevLedger.fees_)
|
, fees_(prevLedger.fees_)
|
||||||
{
|
{
|
||||||
@@ -301,11 +300,9 @@ Ledger::Ledger (void const* data,
|
|||||||
Config const& config, Family& family)
|
Config const& config, Family& family)
|
||||||
: mImmutable (true)
|
: mImmutable (true)
|
||||||
, txMap_ (std::make_shared <SHAMap> (
|
, txMap_ (std::make_shared <SHAMap> (
|
||||||
SHAMapType::TRANSACTION, family,
|
SHAMapType::TRANSACTION, family))
|
||||||
deprecatedLogs().journal("SHAMap")))
|
|
||||||
, stateMap_ (std::make_shared <SHAMap> (
|
, stateMap_ (std::make_shared <SHAMap> (
|
||||||
SHAMapType::STATE, family,
|
SHAMapType::STATE, family))
|
||||||
deprecatedLogs().journal("SHAMap")))
|
|
||||||
{
|
{
|
||||||
SerialIter sit (data, size);
|
SerialIter sit (data, size);
|
||||||
setRaw (sit, hasPrefix, family);
|
setRaw (sit, hasPrefix, family);
|
||||||
@@ -317,11 +314,9 @@ Ledger::Ledger (std::uint32_t ledgerSeq,
|
|||||||
Family& family)
|
Family& family)
|
||||||
: mImmutable (false)
|
: mImmutable (false)
|
||||||
, txMap_ (std::make_shared <SHAMap> (
|
, txMap_ (std::make_shared <SHAMap> (
|
||||||
SHAMapType::TRANSACTION, family,
|
SHAMapType::TRANSACTION, family))
|
||||||
deprecatedLogs().journal("SHAMap")))
|
|
||||||
, stateMap_ (std::make_shared <SHAMap> (
|
, stateMap_ (std::make_shared <SHAMap> (
|
||||||
SHAMapType::STATE, family,
|
SHAMapType::STATE, family))
|
||||||
deprecatedLogs().journal("SHAMap")))
|
|
||||||
{
|
{
|
||||||
info_.seq = ledgerSeq;
|
info_.seq = ledgerSeq;
|
||||||
info_.closeTime = closeTime;
|
info_.closeTime = closeTime;
|
||||||
@@ -395,9 +390,9 @@ void Ledger::setRaw (SerialIter& sit, bool hasPrefix, Family& family)
|
|||||||
info_.closeFlags = sit.get8 ();
|
info_.closeFlags = sit.get8 ();
|
||||||
updateHash ();
|
updateHash ();
|
||||||
txMap_ = std::make_shared<SHAMap> (SHAMapType::TRANSACTION, info_.txHash,
|
txMap_ = std::make_shared<SHAMap> (SHAMapType::TRANSACTION, info_.txHash,
|
||||||
family, deprecatedLogs().journal("SHAMap"));
|
family);
|
||||||
stateMap_ = std::make_shared<SHAMap> (SHAMapType::STATE, info_.accountHash,
|
stateMap_ = std::make_shared<SHAMap> (SHAMapType::STATE, info_.accountHash,
|
||||||
family, deprecatedLogs().journal("SHAMap"));
|
family);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ledger::addRaw (Serializer& s) const
|
void Ledger::addRaw (Serializer& s) const
|
||||||
|
|||||||
@@ -45,9 +45,9 @@ LedgerHistory::LedgerHistory (
|
|||||||
, collector_ (collector)
|
, collector_ (collector)
|
||||||
, mismatch_counter_ (collector->make_counter ("ledger.history", "mismatch"))
|
, mismatch_counter_ (collector->make_counter ("ledger.history", "mismatch"))
|
||||||
, m_ledgers_by_hash ("LedgerCache", CACHED_LEDGER_NUM, CACHED_LEDGER_AGE,
|
, m_ledgers_by_hash ("LedgerCache", CACHED_LEDGER_NUM, CACHED_LEDGER_AGE,
|
||||||
stopwatch(), deprecatedLogs().journal("TaggedCache"))
|
stopwatch(), app_.logs().journal("TaggedCache"))
|
||||||
, m_consensus_validated ("ConsensusValidated", 64, 300,
|
, m_consensus_validated ("ConsensusValidated", 64, 300,
|
||||||
stopwatch(), deprecatedLogs().journal("TaggedCache"))
|
stopwatch(), app_.logs().journal("TaggedCache"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,15 +21,15 @@
|
|||||||
#include <ripple/app/ledger/LedgerTiming.h>
|
#include <ripple/app/ledger/LedgerTiming.h>
|
||||||
#include <ripple/app/ledger/impl/ConsensusImp.h>
|
#include <ripple/app/ledger/impl/ConsensusImp.h>
|
||||||
#include <ripple/app/ledger/impl/LedgerConsensusImp.h>
|
#include <ripple/app/ledger/impl/LedgerConsensusImp.h>
|
||||||
#include <ripple/basics/Log.h>
|
|
||||||
#include <beast/utility/Journal.h>
|
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
ConsensusImp::ConsensusImp (FeeVote::Setup const& voteSetup)
|
ConsensusImp::ConsensusImp (
|
||||||
: journal_ (deprecatedLogs().journal("Consensus"))
|
FeeVote::Setup const& voteSetup,
|
||||||
|
Logs& logs)
|
||||||
|
: journal_ (logs.journal("Consensus"))
|
||||||
, feeVote_ (make_FeeVote (voteSetup,
|
, feeVote_ (make_FeeVote (voteSetup,
|
||||||
deprecatedLogs().journal("FeeVote")))
|
logs.journal("FeeVote")))
|
||||||
, proposing_ (false)
|
, proposing_ (false)
|
||||||
, validating_ (false)
|
, validating_ (false)
|
||||||
, lastCloseProposers_ (0)
|
, lastCloseProposers_ (0)
|
||||||
@@ -174,10 +174,11 @@ ConsensusImp::peekStoredProposals ()
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
std::unique_ptr<Consensus>
|
std::unique_ptr<Consensus>
|
||||||
make_Consensus (Config const& config)
|
make_Consensus (Config const& config, Logs& logs)
|
||||||
{
|
{
|
||||||
return std::make_unique<ConsensusImp> (
|
return std::make_unique<ConsensusImp> (
|
||||||
setup_FeeVote (config.section ("voting")));
|
setup_FeeVote (config.section ("voting")),
|
||||||
|
logs);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include <ripple/app/ledger/Consensus.h>
|
#include <ripple/app/ledger/Consensus.h>
|
||||||
#include <ripple/app/ledger/LedgerConsensus.h>
|
#include <ripple/app/ledger/LedgerConsensus.h>
|
||||||
#include <ripple/app/misc/FeeVote.h>
|
#include <ripple/app/misc/FeeVote.h>
|
||||||
|
#include <ripple/basics/Log.h>
|
||||||
#include <ripple/protocol/STValidation.h>
|
#include <ripple/protocol/STValidation.h>
|
||||||
#include <ripple/shamap/SHAMap.h>
|
#include <ripple/shamap/SHAMap.h>
|
||||||
#include <beast/utility/Journal.h>
|
#include <beast/utility/Journal.h>
|
||||||
@@ -35,7 +36,7 @@ class ConsensusImp
|
|||||||
: public Consensus
|
: public Consensus
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ConsensusImp (FeeVote::Setup const& voteSetup);
|
ConsensusImp (FeeVote::Setup const& voteSetup, Logs& logs);
|
||||||
|
|
||||||
~ConsensusImp () = default;
|
~ConsensusImp () = default;
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ enum
|
|||||||
InboundLedger::InboundLedger (
|
InboundLedger::InboundLedger (
|
||||||
Application& app, uint256 const& hash, std::uint32_t seq, fcReason reason, clock_type& clock)
|
Application& app, uint256 const& hash, std::uint32_t seq, fcReason reason, clock_type& clock)
|
||||||
: PeerSet (app, hash, ledgerAcquireTimeoutMillis, false, clock,
|
: PeerSet (app, hash, ledgerAcquireTimeoutMillis, false, clock,
|
||||||
deprecatedLogs().journal("InboundLedger"))
|
app.logs().journal("InboundLedger"))
|
||||||
, mHaveHeader (false)
|
, mHaveHeader (false)
|
||||||
, mHaveState (false)
|
, mHaveState (false)
|
||||||
, mHaveTransactions (false)
|
, mHaveTransactions (false)
|
||||||
|
|||||||
@@ -1083,7 +1083,7 @@ void LedgerConsensusImp::accept (std::shared_ptr<SHAMap> set)
|
|||||||
|
|
||||||
if (mValidating &&
|
if (mValidating &&
|
||||||
! ledgerMaster_.isCompatible (newLCL,
|
! ledgerMaster_.isCompatible (newLCL,
|
||||||
deprecatedLogs().journal("LedgerConsensus").warning,
|
app_.logs().journal("LedgerConsensus").warning,
|
||||||
"Not validating"))
|
"Not validating"))
|
||||||
{
|
{
|
||||||
mValidating = false;
|
mValidating = false;
|
||||||
@@ -1424,7 +1424,7 @@ void LedgerConsensusImp::takeInitialPosition (
|
|||||||
std::shared_ptr<ReadView const> const& initialLedger)
|
std::shared_ptr<ReadView const> const& initialLedger)
|
||||||
{
|
{
|
||||||
std::shared_ptr<SHAMap> initialSet = std::make_shared <SHAMap> (
|
std::shared_ptr<SHAMap> initialSet = std::make_shared <SHAMap> (
|
||||||
SHAMapType::TRANSACTION, app_.family(), deprecatedLogs().journal("SHAMap"));
|
SHAMapType::TRANSACTION, app_.family());
|
||||||
|
|
||||||
// Build SHAMap containing all transactions in our open ledger
|
// Build SHAMap containing all transactions in our open ledger
|
||||||
for (auto const& tx : initialLedger->txs)
|
for (auto const& tx : initialLedger->txs)
|
||||||
@@ -1829,8 +1829,7 @@ applyTransaction (Application& app, OpenView& view,
|
|||||||
{
|
{
|
||||||
auto const result = apply(app, view, *txn, flags,
|
auto const result = apply(app, view, *txn, flags,
|
||||||
app.getHashRouter().sigVerify(),
|
app.getHashRouter().sigVerify(),
|
||||||
app.config(), deprecatedLogs().
|
app.config(), app.logs().journal("LedgerConsensus"));
|
||||||
journal("LedgerConsensus"));
|
|
||||||
if (result.second)
|
if (result.second)
|
||||||
{
|
{
|
||||||
WriteLog (lsDEBUG, LedgerConsensus)
|
WriteLog (lsDEBUG, LedgerConsensus)
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ public:
|
|||||||
, mLedgerHistory (collector, app)
|
, mLedgerHistory (collector, app)
|
||||||
, mHeldTransactions (uint256 ())
|
, mHeldTransactions (uint256 ())
|
||||||
, mLedgerCleaner (make_LedgerCleaner (
|
, mLedgerCleaner (make_LedgerCleaner (
|
||||||
app, *this, deprecatedLogs().journal("LedgerCleaner")))
|
app, *this, app_.logs().journal("LedgerCleaner")))
|
||||||
, mMinValidations (0)
|
, mMinValidations (0)
|
||||||
, mLastValidateSeq (0)
|
, mLastValidateSeq (0)
|
||||||
, mAdvanceThread (false)
|
, mAdvanceThread (false)
|
||||||
@@ -170,7 +170,7 @@ public:
|
|||||||
, ledger_history_ (app_.config().LEDGER_HISTORY)
|
, ledger_history_ (app_.config().LEDGER_HISTORY)
|
||||||
, ledger_fetch_size_ (app_.config().getSize (siLedgerFetch))
|
, ledger_fetch_size_ (app_.config().getSize (siLedgerFetch))
|
||||||
, fetch_packs_ ("FetchPack", 65536, 45, stopwatch,
|
, fetch_packs_ ("FetchPack", 65536, 45, stopwatch,
|
||||||
deprecatedLogs().journal("TaggedCache"))
|
app_.logs().journal("TaggedCache"))
|
||||||
, fetch_seq_ (0)
|
, fetch_seq_ (0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ private:
|
|||||||
TreeNodeCache treecache_;
|
TreeNodeCache treecache_;
|
||||||
FullBelowCache fullbelow_;
|
FullBelowCache fullbelow_;
|
||||||
NodeStore::Database& db_;
|
NodeStore::Database& db_;
|
||||||
|
beast::Journal j_;
|
||||||
|
|
||||||
// missing node handler
|
// missing node handler
|
||||||
std::uint32_t maxSeq = 0;
|
std::uint32_t maxSeq = 0;
|
||||||
@@ -130,14 +131,21 @@ public:
|
|||||||
CollectorManager& collectorManager)
|
CollectorManager& collectorManager)
|
||||||
: app_ (app)
|
: app_ (app)
|
||||||
, treecache_ ("TreeNodeCache", 65536, 60, stopwatch(),
|
, treecache_ ("TreeNodeCache", 65536, 60, stopwatch(),
|
||||||
deprecatedLogs().journal("TaggedCache"))
|
app.logs().journal("TaggedCache"))
|
||||||
, fullbelow_ ("full_below", stopwatch(),
|
, fullbelow_ ("full_below", stopwatch(),
|
||||||
collectorManager.collector(),
|
collectorManager.collector(),
|
||||||
fullBelowTargetSize, fullBelowExpirationSeconds)
|
fullBelowTargetSize, fullBelowExpirationSeconds)
|
||||||
, db_ (db)
|
, db_ (db)
|
||||||
|
, j_ (app.logs().journal("SHAMap"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
beast::Journal const&
|
||||||
|
journal() override
|
||||||
|
{
|
||||||
|
return j_;
|
||||||
|
}
|
||||||
|
|
||||||
FullBelowCache&
|
FullBelowCache&
|
||||||
fullbelow() override
|
fullbelow() override
|
||||||
{
|
{
|
||||||
@@ -302,7 +310,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
std::unique_ptr<Config const> config_;
|
std::unique_ptr<Config const> config_;
|
||||||
Logs& m_logs;
|
std::unique_ptr<Logs> logs_;
|
||||||
beast::Journal m_journal;
|
beast::Journal m_journal;
|
||||||
Application::MutexType m_masterMutex;
|
Application::MutexType m_masterMutex;
|
||||||
|
|
||||||
@@ -375,16 +383,18 @@ public:
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
ApplicationImp (std::unique_ptr<Config const> config, Logs& logs)
|
ApplicationImp (
|
||||||
|
std::unique_ptr<Config const> config,
|
||||||
|
std::unique_ptr<Logs> logs)
|
||||||
: RootStoppable ("Application")
|
: RootStoppable ("Application")
|
||||||
, BasicApp (numberOfThreads(*config))
|
, BasicApp (numberOfThreads(*config))
|
||||||
, config_ (std::move(config))
|
, config_ (std::move(config))
|
||||||
, m_logs (logs)
|
, logs_ (std::move(logs))
|
||||||
|
|
||||||
, m_journal (m_logs.journal("Application"))
|
, m_journal (logs_->journal("Application"))
|
||||||
|
|
||||||
, timeKeeper_ (make_TimeKeeper(
|
, timeKeeper_ (make_TimeKeeper(
|
||||||
deprecatedLogs().journal("TimeKeeper")))
|
logs_->journal("TimeKeeper")))
|
||||||
|
|
||||||
, m_txMaster (*this)
|
, m_txMaster (*this)
|
||||||
|
|
||||||
@@ -392,7 +402,7 @@ public:
|
|||||||
|
|
||||||
, m_shaMapStore (make_SHAMapStore (*this, setup_SHAMapStore (*config_),
|
, m_shaMapStore (make_SHAMapStore (*this, setup_SHAMapStore (*config_),
|
||||||
*this, m_nodeStoreScheduler,
|
*this, m_nodeStoreScheduler,
|
||||||
m_logs.journal ("SHAMapStore"), m_logs.journal ("NodeObject"),
|
logs_->journal ("SHAMapStore"), logs_->journal ("NodeObject"),
|
||||||
m_txMaster, *config_))
|
m_txMaster, *config_))
|
||||||
|
|
||||||
, m_nodeStore (m_shaMapStore->makeDatabase ("NodeStore.main", 4))
|
, m_nodeStore (m_shaMapStore->makeDatabase ("NodeStore.main", 4))
|
||||||
@@ -400,10 +410,10 @@ public:
|
|||||||
, accountIDCache_(128000)
|
, accountIDCache_(128000)
|
||||||
|
|
||||||
, m_tempNodeCache ("NodeCache", 16384, 90, stopwatch(),
|
, m_tempNodeCache ("NodeCache", 16384, 90, stopwatch(),
|
||||||
m_logs.journal("TaggedCache"))
|
logs_->journal("TaggedCache"))
|
||||||
|
|
||||||
, m_collectorManager (CollectorManager::New (
|
, m_collectorManager (CollectorManager::New (
|
||||||
config_->section (SECTION_INSIGHT), m_logs.journal("Collector")))
|
config_->section (SECTION_INSIGHT), logs_->journal("Collector")))
|
||||||
|
|
||||||
, family_ (*this, *m_nodeStore, *m_collectorManager)
|
, family_ (*this, *m_nodeStore, *m_collectorManager)
|
||||||
|
|
||||||
@@ -412,13 +422,13 @@ public:
|
|||||||
, m_localCredentials (*this)
|
, m_localCredentials (*this)
|
||||||
|
|
||||||
, m_resourceManager (Resource::make_Manager (
|
, m_resourceManager (Resource::make_Manager (
|
||||||
m_collectorManager->collector(), m_logs.journal("Resource")))
|
m_collectorManager->collector(), logs_->journal("Resource")))
|
||||||
|
|
||||||
// The JobQueue has to come pretty early since
|
// The JobQueue has to come pretty early since
|
||||||
// almost everything is a Stoppable child of the JobQueue.
|
// almost everything is a Stoppable child of the JobQueue.
|
||||||
//
|
//
|
||||||
, m_jobQueue (make_JobQueue (m_collectorManager->group ("jobq"),
|
, m_jobQueue (make_JobQueue (m_collectorManager->group ("jobq"),
|
||||||
m_nodeStoreScheduler, m_logs.journal("JobQueue")))
|
m_nodeStoreScheduler, logs_->journal("JobQueue")))
|
||||||
|
|
||||||
//
|
//
|
||||||
// Anything which calls addJob must be a descendant of the JobQueue
|
// Anything which calls addJob must be a descendant of the JobQueue
|
||||||
@@ -427,11 +437,11 @@ public:
|
|||||||
, m_orderBookDB (*this, *m_jobQueue)
|
, m_orderBookDB (*this, *m_jobQueue)
|
||||||
|
|
||||||
, m_pathRequests (std::make_unique<PathRequests> (
|
, m_pathRequests (std::make_unique<PathRequests> (
|
||||||
*this, m_logs.journal("PathRequest"), m_collectorManager->collector ()))
|
*this, logs_->journal("PathRequest"), m_collectorManager->collector ()))
|
||||||
|
|
||||||
, m_ledgerMaster (make_LedgerMaster (*this, stopwatch (),
|
, m_ledgerMaster (make_LedgerMaster (*this, stopwatch (),
|
||||||
*m_jobQueue, m_collectorManager->collector (),
|
*m_jobQueue, m_collectorManager->collector (),
|
||||||
m_logs.journal("LedgerMaster")))
|
logs_->journal("LedgerMaster")))
|
||||||
|
|
||||||
// VFALCO NOTE must come before NetworkOPs to prevent a crash due
|
// VFALCO NOTE must come before NetworkOPs to prevent a crash due
|
||||||
// to dependencies in the destructor.
|
// to dependencies in the destructor.
|
||||||
@@ -450,12 +460,12 @@ public:
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
, m_acceptedLedgerCache ("AcceptedLedger", 4, 60, stopwatch(),
|
, m_acceptedLedgerCache ("AcceptedLedger", 4, 60, stopwatch(),
|
||||||
m_logs.journal("TaggedCache"))
|
logs_->journal("TaggedCache"))
|
||||||
|
|
||||||
, m_networkOPs (make_NetworkOPs (*this, stopwatch(),
|
, m_networkOPs (make_NetworkOPs (*this, stopwatch(),
|
||||||
config_->RUN_STANDALONE, config_->NETWORK_QUORUM,
|
config_->RUN_STANDALONE, config_->NETWORK_QUORUM,
|
||||||
*m_jobQueue, *m_ledgerMaster, *m_jobQueue,
|
*m_jobQueue, *m_ledgerMaster, *m_jobQueue,
|
||||||
m_logs.journal("NetworkOPs")))
|
logs_->journal("NetworkOPs")))
|
||||||
|
|
||||||
// VFALCO NOTE LocalCredentials starts the deprecated UNL service
|
// VFALCO NOTE LocalCredentials starts the deprecated UNL service
|
||||||
, m_deprecatedUNL (make_UniqueNodeList (*this, *m_jobQueue))
|
, m_deprecatedUNL (make_UniqueNodeList (*this, *m_jobQueue))
|
||||||
@@ -465,16 +475,16 @@ public:
|
|||||||
|
|
||||||
, m_amendmentTable (make_AmendmentTable
|
, m_amendmentTable (make_AmendmentTable
|
||||||
(weeks(2), MAJORITY_FRACTION,
|
(weeks(2), MAJORITY_FRACTION,
|
||||||
m_logs.journal("AmendmentTable")))
|
logs_->journal("AmendmentTable")))
|
||||||
|
|
||||||
, mFeeTrack (std::make_unique<LoadFeeTrack>(m_logs.journal("LoadManager")))
|
, mFeeTrack (std::make_unique<LoadFeeTrack>(logs_->journal("LoadManager")))
|
||||||
|
|
||||||
, mHashRouter (std::make_unique<HashRouter>(
|
, mHashRouter (std::make_unique<HashRouter>(
|
||||||
HashRouter::getDefaultHoldTime ()))
|
HashRouter::getDefaultHoldTime ()))
|
||||||
|
|
||||||
, mValidations (make_Validations (*this))
|
, mValidations (make_Validations (*this))
|
||||||
|
|
||||||
, m_loadManager (make_LoadManager (*this, *this, m_logs.journal("LoadManager")))
|
, m_loadManager (make_LoadManager (*this, *this, logs_->journal("LoadManager")))
|
||||||
|
|
||||||
, m_sweepTimer (this)
|
, m_sweepTimer (this)
|
||||||
|
|
||||||
@@ -482,10 +492,10 @@ public:
|
|||||||
|
|
||||||
, m_signals (get_io_service())
|
, m_signals (get_io_service())
|
||||||
|
|
||||||
, m_resolver (ResolverAsio::New (get_io_service(), m_logs.journal("Resolver")))
|
, m_resolver (ResolverAsio::New (get_io_service(), logs_->journal("Resolver")))
|
||||||
|
|
||||||
, m_io_latency_sampler (m_collectorManager->collector()->make_event ("ios_latency"),
|
, m_io_latency_sampler (m_collectorManager->collector()->make_event ("ios_latency"),
|
||||||
m_logs.journal("Application"), std::chrono::milliseconds (100), get_io_service())
|
logs_->journal("Application"), std::chrono::milliseconds (100), get_io_service())
|
||||||
{
|
{
|
||||||
add (m_resourceManager.get ());
|
add (m_resourceManager.get ());
|
||||||
|
|
||||||
@@ -551,6 +561,12 @@ public:
|
|||||||
return *config_;
|
return *config_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logs&
|
||||||
|
logs() override
|
||||||
|
{
|
||||||
|
return *logs_;
|
||||||
|
}
|
||||||
|
|
||||||
boost::asio::io_service& getIOService () override
|
boost::asio::io_service& getIOService () override
|
||||||
{
|
{
|
||||||
return get_io_service();
|
return get_io_service();
|
||||||
@@ -780,11 +796,11 @@ public:
|
|||||||
// Let debug messages go to the file but only WARNING or higher to
|
// Let debug messages go to the file but only WARNING or higher to
|
||||||
// regular output (unless verbose)
|
// regular output (unless verbose)
|
||||||
|
|
||||||
if (!m_logs.open(debug_log))
|
if (!logs_->open(debug_log))
|
||||||
std::cerr << "Can't open log file " << debug_log << '\n';
|
std::cerr << "Can't open log file " << debug_log << '\n';
|
||||||
|
|
||||||
if (m_logs.severity() > beast::Journal::kDebug)
|
if (logs_->severity() > beast::Journal::kDebug)
|
||||||
m_logs.severity (beast::Journal::kDebug);
|
logs_->severity (beast::Journal::kDebug);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config_->RUN_STANDALONE)
|
if (!config_->RUN_STANDALONE)
|
||||||
@@ -1101,8 +1117,6 @@ private:
|
|||||||
Ledger::pointer getLastFullLedger();
|
Ledger::pointer getLastFullLedger();
|
||||||
bool loadOldLedger (
|
bool loadOldLedger (
|
||||||
std::string const& ledgerID, bool replay, bool isFilename);
|
std::string const& ledgerID, bool replay, bool isFilename);
|
||||||
|
|
||||||
void onAnnounceAddress ();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -1121,7 +1135,7 @@ void ApplicationImp::startGenesisLedger ()
|
|||||||
next->setImmutable (*config_);
|
next->setImmutable (*config_);
|
||||||
m_networkOPs->setLastCloseTime (next->info().closeTime);
|
m_networkOPs->setLastCloseTime (next->info().closeTime);
|
||||||
openLedger_.emplace(next, *config_,
|
openLedger_.emplace(next, *config_,
|
||||||
cachedSLEs_, deprecatedLogs().journal("OpenLedger"));
|
cachedSLEs_, logs_->journal("OpenLedger"));
|
||||||
m_ledgerMaster->switchLCL (next);
|
m_ledgerMaster->switchLCL (next);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1375,7 +1389,7 @@ bool ApplicationImp::loadOldLedger (
|
|||||||
m_ledgerMaster->forceValid(loadLedger);
|
m_ledgerMaster->forceValid(loadLedger);
|
||||||
m_networkOPs->setLastCloseTime (loadLedger->info().closeTime);
|
m_networkOPs->setLastCloseTime (loadLedger->info().closeTime);
|
||||||
openLedger_.emplace(loadLedger, *config_,
|
openLedger_.emplace(loadLedger, *config_,
|
||||||
cachedSLEs_, deprecatedLogs().journal("OpenLedger"));
|
cachedSLEs_, logs_->journal("OpenLedger"));
|
||||||
|
|
||||||
if (replay)
|
if (replay)
|
||||||
{
|
{
|
||||||
@@ -1610,7 +1624,7 @@ void ApplicationImp::updateTables ()
|
|||||||
NodeStore::DummyScheduler scheduler;
|
NodeStore::DummyScheduler scheduler;
|
||||||
std::unique_ptr <NodeStore::Database> source =
|
std::unique_ptr <NodeStore::Database> source =
|
||||||
NodeStore::Manager::instance().make_Database ("NodeStore.import", scheduler,
|
NodeStore::Manager::instance().make_Database ("NodeStore.import", scheduler,
|
||||||
deprecatedLogs().journal("NodeObject"), 0,
|
logs_->journal("NodeObject"), 0,
|
||||||
config_->section(ConfigSection::importNodeDatabase ()));
|
config_->section(ConfigSection::importNodeDatabase ()));
|
||||||
|
|
||||||
WriteLog (lsWARNING, NodeObject) <<
|
WriteLog (lsWARNING, NodeObject) <<
|
||||||
@@ -1621,11 +1635,6 @@ void ApplicationImp::updateTables ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationImp::onAnnounceAddress ()
|
|
||||||
{
|
|
||||||
// NIKB CODEME
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
Application::Application ()
|
Application::Application ()
|
||||||
@@ -1634,10 +1643,12 @@ Application::Application ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Application>
|
std::unique_ptr<Application>
|
||||||
make_Application (std::unique_ptr<Config const> config, Logs& logs)
|
make_Application (
|
||||||
|
std::unique_ptr<Config const> config,
|
||||||
|
std::unique_ptr<Logs> logs)
|
||||||
{
|
{
|
||||||
return std::make_unique<ApplicationImp> (
|
return std::make_unique<ApplicationImp> (
|
||||||
std::move(config), logs);
|
std::move(config), std::move(logs));
|
||||||
}
|
}
|
||||||
|
|
||||||
Application& getApp ()
|
Application& getApp ()
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ public:
|
|||||||
|
|
||||||
virtual ~Application () = default;
|
virtual ~Application () = default;
|
||||||
virtual Config const& config() const = 0;
|
virtual Config const& config() const = 0;
|
||||||
|
virtual Logs& logs() = 0;
|
||||||
virtual boost::asio::io_service& getIOService () = 0;
|
virtual boost::asio::io_service& getIOService () = 0;
|
||||||
virtual CollectorManager& getCollectorManager () = 0;
|
virtual CollectorManager& getCollectorManager () = 0;
|
||||||
virtual Family& family() = 0;
|
virtual Family& family() = 0;
|
||||||
@@ -145,7 +146,9 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr <Application>
|
std::unique_ptr <Application>
|
||||||
make_Application(std::unique_ptr<Config const> config, Logs& logs);
|
make_Application(
|
||||||
|
std::unique_ptr<Config const> config,
|
||||||
|
std::unique_ptr<Logs> logs);
|
||||||
|
|
||||||
// DEPRECATED
|
// DEPRECATED
|
||||||
extern Application& getApp ();
|
extern Application& getApp ();
|
||||||
|
|||||||
@@ -186,7 +186,9 @@ static int runShutdownTests (std::unique_ptr<Config> config)
|
|||||||
{
|
{
|
||||||
std::cerr << "\n\nStarting server. Iteration: " << i << "\n"
|
std::cerr << "\n\nStarting server. Iteration: " << i << "\n"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
auto app = make_Application (std::move(config), deprecatedLogs());
|
auto app = make_Application (
|
||||||
|
std::move(config),
|
||||||
|
std::make_unique<Logs>());
|
||||||
auto shutdownApp = [&app](std::chrono::seconds sleepTime, int iteration)
|
auto shutdownApp = [&app](std::chrono::seconds sleepTime, int iteration)
|
||||||
{
|
{
|
||||||
std::this_thread::sleep_for (sleepTime);
|
std::this_thread::sleep_for (sleepTime);
|
||||||
@@ -210,8 +212,9 @@ static int runUnitTests (
|
|||||||
// Config needs to be set up before creating Application
|
// Config needs to be set up before creating Application
|
||||||
setupConfigForUnitTests (*config);
|
setupConfigForUnitTests (*config);
|
||||||
|
|
||||||
// VFALCO TODO Remove dependence on constructing Application object
|
auto app = make_Application (
|
||||||
auto app = make_Application (std::move(config), deprecatedLogs());
|
std::move(config),
|
||||||
|
std::make_unique<Logs>());
|
||||||
|
|
||||||
using namespace beast::unit_test;
|
using namespace beast::unit_test;
|
||||||
beast::debug_ostream stream;
|
beast::debug_ostream stream;
|
||||||
@@ -348,13 +351,6 @@ int run (int argc, char** argv)
|
|||||||
std::cerr << logMe;
|
std::cerr << logMe;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vm.count ("quiet"))
|
|
||||||
deprecatedLogs().severity(beast::Journal::kFatal);
|
|
||||||
else if (vm.count ("verbose"))
|
|
||||||
deprecatedLogs().severity(beast::Journal::kTrace);
|
|
||||||
else
|
|
||||||
deprecatedLogs().severity(beast::Journal::kInfo);
|
|
||||||
|
|
||||||
// Run the unit tests if requested.
|
// Run the unit tests if requested.
|
||||||
// The unit tests will exit the application with an appropriate return code.
|
// The unit tests will exit the application with an appropriate return code.
|
||||||
//
|
//
|
||||||
@@ -478,10 +474,21 @@ int run (int argc, char** argv)
|
|||||||
if (vm.count ("shutdowntest"))
|
if (vm.count ("shutdowntest"))
|
||||||
return runShutdownTests (std::move(config));
|
return runShutdownTests (std::move(config));
|
||||||
|
|
||||||
|
// No arguments. Run server.
|
||||||
if (!vm.count ("parameters"))
|
if (!vm.count ("parameters"))
|
||||||
{
|
{
|
||||||
// No arguments. Run server.
|
auto logs = std::make_unique<Logs>();
|
||||||
auto app = make_Application (std::move(config), deprecatedLogs());
|
|
||||||
|
if (vm.count ("quiet"))
|
||||||
|
logs->severity (beast::Journal::kFatal);
|
||||||
|
else if (vm.count ("verbose"))
|
||||||
|
logs->severity (beast::Journal::kTrace);
|
||||||
|
else
|
||||||
|
logs->severity (beast::Journal::kInfo);
|
||||||
|
|
||||||
|
auto app = make_Application (
|
||||||
|
std::move(config),
|
||||||
|
std::move (logs));
|
||||||
setupServer (*app);
|
setupServer (*app);
|
||||||
startServer (*app);
|
startServer (*app);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -116,8 +116,9 @@ public:
|
|||||||
// VFALCO TODO Make LedgerMaster a SharedPtr or a reference.
|
// VFALCO TODO Make LedgerMaster a SharedPtr or a reference.
|
||||||
//
|
//
|
||||||
NetworkOPsImp (
|
NetworkOPsImp (
|
||||||
Application& app, clock_type& clock, bool standalone, std::size_t network_quorum,
|
Application& app, clock_type& clock, bool standalone,
|
||||||
JobQueue& job_queue, LedgerMaster& ledgerMaster, Stoppable& parent,
|
std::size_t network_quorum, JobQueue& job_queue,
|
||||||
|
LedgerMaster& ledgerMaster, Stoppable& parent,
|
||||||
beast::Journal journal)
|
beast::Journal journal)
|
||||||
: NetworkOPs (parent)
|
: NetworkOPs (parent)
|
||||||
, app_ (app)
|
, app_ (app)
|
||||||
@@ -129,7 +130,7 @@ public:
|
|||||||
, m_amendmentBlocked (false)
|
, m_amendmentBlocked (false)
|
||||||
, m_heartbeatTimer (this)
|
, m_heartbeatTimer (this)
|
||||||
, m_clusterTimer (this)
|
, m_clusterTimer (this)
|
||||||
, mConsensus (make_Consensus (app_.config()))
|
, mConsensus (make_Consensus (app_.config(), app_.logs()))
|
||||||
, m_ledgerMaster (ledgerMaster)
|
, m_ledgerMaster (ledgerMaster)
|
||||||
, mLastLoadBase (256)
|
, mLastLoadBase (256)
|
||||||
, mLastLoadFactor (256)
|
, mLastLoadFactor (256)
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public:
|
|||||||
ValidationsImp (Application& app)
|
ValidationsImp (Application& app)
|
||||||
: app_ (app)
|
: app_ (app)
|
||||||
, mValidations ("Validations", 128, 600, stopwatch(),
|
, mValidations ("Validations", 128, 600, stopwatch(),
|
||||||
deprecatedLogs().journal("TaggedCache"))
|
app.logs().journal("TaggedCache"))
|
||||||
, mWriting (false)
|
, mWriting (false)
|
||||||
{
|
{
|
||||||
mStaleValidations.reserve (512);
|
mStaleValidations.reserve (512);
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ private:
|
|||||||
return make_AmendmentTable (
|
return make_AmendmentTable (
|
||||||
weeks (w),
|
weeks (w),
|
||||||
majorityFraction,
|
majorityFraction,
|
||||||
deprecatedLogs().journal("TestAmendmentTable"));
|
beast::Journal{});
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create the amendments by string pairs instead of AmendmentNames
|
// Create the amendments by string pairs instead of AmendmentNames
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public:
|
|||||||
{
|
{
|
||||||
m_zeroSet.mSet = std::make_shared<SHAMap> (
|
m_zeroSet.mSet = std::make_shared<SHAMap> (
|
||||||
SHAMapType::TRANSACTION, uint256(),
|
SHAMapType::TRANSACTION, uint256(),
|
||||||
app_.family(), deprecatedLogs().journal("SHAMap"));
|
app_.family());
|
||||||
m_zeroSet.mSet->setUnbacked();
|
m_zeroSet.mSet->setUnbacked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,11 +41,11 @@ enum
|
|||||||
|
|
||||||
TransactionAcquire::TransactionAcquire (Application& app, uint256 const& hash, clock_type& clock)
|
TransactionAcquire::TransactionAcquire (Application& app, uint256 const& hash, clock_type& clock)
|
||||||
: PeerSet (app, hash, TX_ACQUIRE_TIMEOUT, true, clock,
|
: PeerSet (app, hash, TX_ACQUIRE_TIMEOUT, true, clock,
|
||||||
deprecatedLogs().journal("TransactionAcquire"))
|
app.logs().journal("TransactionAcquire"))
|
||||||
, mHaveRoot (false)
|
, mHaveRoot (false)
|
||||||
{
|
{
|
||||||
mMap = std::make_shared<SHAMap> (SHAMapType::TRANSACTION, hash,
|
mMap = std::make_shared<SHAMap> (SHAMapType::TRANSACTION, hash,
|
||||||
app_.family(), deprecatedLogs().journal("SHAMap"));
|
app_.family());
|
||||||
mMap->setUnbacked ();
|
mMap->setUnbacked ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace ripple {
|
|||||||
TransactionMaster::TransactionMaster (Application& app)
|
TransactionMaster::TransactionMaster (Application& app)
|
||||||
: mApp (app)
|
: mApp (app)
|
||||||
, mCache ("TransactionCache", 65536, 1800, stopwatch(),
|
, mCache ("TransactionCache", 65536, 1800, stopwatch(),
|
||||||
deprecatedLogs().journal("TaggedCache"))
|
mApp.logs().journal("TaggedCache"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <ripple/nodestore/Factory.h>
|
#include <ripple/nodestore/Factory.h>
|
||||||
#include <ripple/nodestore/DatabaseRotating.h>
|
#include <ripple/nodestore/DatabaseRotating.h>
|
||||||
#include <ripple/basics/BasicConfig.h>
|
#include <ripple/basics/BasicConfig.h>
|
||||||
|
#include <ripple/basics/Log.h>
|
||||||
#include <beast/utility/Journal.h>
|
#include <beast/utility/Journal.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public:
|
|||||||
, m_scheduler (scheduler)
|
, m_scheduler (scheduler)
|
||||||
, m_backend (std::move (backend))
|
, m_backend (std::move (backend))
|
||||||
, m_cache ("NodeStore", cacheTargetSize, cacheTargetSeconds,
|
, m_cache ("NodeStore", cacheTargetSize, cacheTargetSeconds,
|
||||||
stopwatch(), deprecatedLogs().journal("TaggedCache"))
|
stopwatch(), journal)
|
||||||
, m_negCache ("NodeStore", stopwatch(),
|
, m_negCache ("NodeStore", stopwatch(),
|
||||||
cacheTargetSize, cacheTargetSeconds)
|
cacheTargetSize, cacheTargetSeconds)
|
||||||
, m_readShut (false)
|
, m_readShut (false)
|
||||||
|
|||||||
@@ -53,8 +53,12 @@ public:
|
|||||||
std::shared_ptr <Backend> writableBackend,
|
std::shared_ptr <Backend> writableBackend,
|
||||||
std::shared_ptr <Backend> archiveBackend,
|
std::shared_ptr <Backend> archiveBackend,
|
||||||
beast::Journal journal)
|
beast::Journal journal)
|
||||||
: DatabaseImp (name, scheduler, readThreads,
|
: DatabaseImp (
|
||||||
std::unique_ptr <Backend>(), journal)
|
name,
|
||||||
|
scheduler,
|
||||||
|
readThreads,
|
||||||
|
std::unique_ptr <Backend>(),
|
||||||
|
journal)
|
||||||
, writableBackend_ (writableBackend)
|
, writableBackend_ (writableBackend)
|
||||||
, archiveBackend_ (archiveBackend)
|
, archiveBackend_ (archiveBackend)
|
||||||
{}
|
{}
|
||||||
|
|||||||
@@ -93,11 +93,15 @@ ManagerImp::make_Database (
|
|||||||
int readThreads,
|
int readThreads,
|
||||||
Section const& backendParameters)
|
Section const& backendParameters)
|
||||||
{
|
{
|
||||||
std::unique_ptr <Backend> backend (make_Backend (
|
return std::make_unique <DatabaseImp> (
|
||||||
backendParameters, scheduler, journal));
|
name,
|
||||||
|
scheduler,
|
||||||
return std::make_unique <DatabaseImp> (name, scheduler, readThreads,
|
readThreads,
|
||||||
std::move (backend), journal);
|
make_Backend (
|
||||||
|
backendParameters,
|
||||||
|
scheduler,
|
||||||
|
journal),
|
||||||
|
journal);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr <DatabaseRotating>
|
std::unique_ptr <DatabaseRotating>
|
||||||
@@ -109,8 +113,13 @@ ManagerImp::make_DatabaseRotating (
|
|||||||
std::shared_ptr <Backend> archiveBackend,
|
std::shared_ptr <Backend> archiveBackend,
|
||||||
beast::Journal journal)
|
beast::Journal journal)
|
||||||
{
|
{
|
||||||
return std::make_unique <DatabaseRotatingImp> (name, scheduler,
|
return std::make_unique <DatabaseRotatingImp> (
|
||||||
readThreads, writableBackend, archiveBackend, journal);
|
name,
|
||||||
|
scheduler,
|
||||||
|
readThreads,
|
||||||
|
writableBackend,
|
||||||
|
archiveBackend,
|
||||||
|
journal);
|
||||||
}
|
}
|
||||||
|
|
||||||
Factory*
|
Factory*
|
||||||
|
|||||||
@@ -139,11 +139,11 @@ OverlayImpl::OverlayImpl (
|
|||||||
, work_ (boost::in_place(std::ref(io_service_)))
|
, work_ (boost::in_place(std::ref(io_service_)))
|
||||||
, strand_ (io_service_)
|
, strand_ (io_service_)
|
||||||
, setup_(setup)
|
, setup_(setup)
|
||||||
, journal_ (deprecatedLogs().journal("Overlay"))
|
, journal_ (app_.logs().journal("Overlay"))
|
||||||
, serverHandler_(serverHandler)
|
, serverHandler_(serverHandler)
|
||||||
, m_resourceManager (resourceManager)
|
, m_resourceManager (resourceManager)
|
||||||
, m_peerFinder (PeerFinder::make_Manager (*this, io_service,
|
, m_peerFinder (PeerFinder::make_Manager (*this, io_service,
|
||||||
stopwatch(), deprecatedLogs().journal("PeerFinder"), config))
|
stopwatch(), app_.logs().journal("PeerFinder"), config))
|
||||||
, m_resolver (resolver)
|
, m_resolver (resolver)
|
||||||
, next_id_(1)
|
, next_id_(1)
|
||||||
, timer_count_(0)
|
, timer_count_(0)
|
||||||
@@ -170,7 +170,7 @@ OverlayImpl::onHandoff (std::unique_ptr <beast::asio::ssl_bundle>&& ssl_bundle,
|
|||||||
endpoint_type remote_endpoint)
|
endpoint_type remote_endpoint)
|
||||||
{
|
{
|
||||||
auto const id = next_id_++;
|
auto const id = next_id_++;
|
||||||
beast::WrappedSink sink (deprecatedLogs()["Peer"], makePrefix(id));
|
beast::WrappedSink sink (app_.logs()["Peer"], makePrefix(id));
|
||||||
beast::Journal journal (sink);
|
beast::Journal journal (sink);
|
||||||
|
|
||||||
Handoff handoff;
|
Handoff handoff;
|
||||||
@@ -356,7 +356,7 @@ OverlayImpl::connect (beast::IP::Endpoint const& remote_endpoint)
|
|||||||
auto const p = std::make_shared<ConnectAttempt>(app_,
|
auto const p = std::make_shared<ConnectAttempt>(app_,
|
||||||
io_service_, beast::IPAddressConversion::to_asio_endpoint(remote_endpoint),
|
io_service_, beast::IPAddressConversion::to_asio_endpoint(remote_endpoint),
|
||||||
usage, setup_.context, next_id_++, slot,
|
usage, setup_.context, next_id_++, slot,
|
||||||
deprecatedLogs().journal("Peer"), *this);
|
app_.logs().journal("Peer"), *this);
|
||||||
|
|
||||||
std::lock_guard<decltype(mutex_)> lock(mutex_);
|
std::lock_guard<decltype(mutex_)> lock(mutex_);
|
||||||
list_.emplace(p.get(), p);
|
list_.emplace(p.get(), p);
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ PeerImp::PeerImp (Application& app, id_t id, endpoint_type remote_endpoint,
|
|||||||
: Child (overlay)
|
: Child (overlay)
|
||||||
, app_ (app)
|
, app_ (app)
|
||||||
, id_(id)
|
, id_(id)
|
||||||
, sink_(deprecatedLogs().journal("Peer"), makePrefix(id))
|
, sink_(app_.logs().journal("Peer"), makePrefix(id))
|
||||||
, p_sink_(deprecatedLogs().journal("Protocol"), makePrefix(id))
|
, p_sink_(app_.logs().journal("Protocol"), makePrefix(id))
|
||||||
, journal_ (sink_)
|
, journal_ (sink_)
|
||||||
, p_journal_(p_sink_)
|
, p_journal_(p_sink_)
|
||||||
, ssl_bundle_(std::move(ssl_bundle))
|
, ssl_bundle_(std::move(ssl_bundle))
|
||||||
|
|||||||
@@ -489,8 +489,8 @@ PeerImp::PeerImp (Application& app, std::unique_ptr<beast::asio::ssl_bundle>&& s
|
|||||||
: Child (overlay)
|
: Child (overlay)
|
||||||
, app_ (app)
|
, app_ (app)
|
||||||
, id_ (id)
|
, id_ (id)
|
||||||
, sink_ (deprecatedLogs().journal("Peer"), makePrefix(id))
|
, sink_ (app_.logs().journal("Peer"), makePrefix(id))
|
||||||
, p_sink_ (deprecatedLogs().journal("Protocol"), makePrefix(id))
|
, p_sink_ (app_.logs().journal("Protocol"), makePrefix(id))
|
||||||
, journal_ (sink_)
|
, journal_ (sink_)
|
||||||
, p_journal_ (p_sink_)
|
, p_journal_ (p_sink_)
|
||||||
, ssl_bundle_(std::move(ssl_bundle))
|
, ssl_bundle_(std::move(ssl_bundle))
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ Json::Value doLedgerRequest (RPC::Context& context)
|
|||||||
if (ledgerIndex >= ledger->info().seq)
|
if (ledgerIndex >= ledger->info().seq)
|
||||||
return RPC::make_param_error("Ledger index too large");
|
return RPC::make_param_error("Ledger index too large");
|
||||||
|
|
||||||
auto const j = deprecatedLogs().journal("RPCHandler");
|
auto const j = context.app.logs().journal("RPCHandler");
|
||||||
// Try to get the hash of the desired ledger from the validated ledger
|
// Try to get the hash of the desired ledger from the validated ledger
|
||||||
auto neededHash = hashOfSeq(*ledger, ledgerIndex, j);
|
auto neededHash = hashOfSeq(*ledger, ledgerIndex, j);
|
||||||
if (! neededHash)
|
if (! neededHash)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <BeastConfig.h>
|
#include <BeastConfig.h>
|
||||||
|
#include <ripple/app/main/Application.h>
|
||||||
#include <ripple/basics/Log.h>
|
#include <ripple/basics/Log.h>
|
||||||
#include <ripple/json/json_value.h>
|
#include <ripple/json/json_value.h>
|
||||||
#include <ripple/net/RPCErr.h>
|
#include <ripple/net/RPCErr.h>
|
||||||
@@ -38,9 +39,9 @@ Json::Value doLogLevel (RPC::Context& context)
|
|||||||
Json::Value lev (Json::objectValue);
|
Json::Value lev (Json::objectValue);
|
||||||
|
|
||||||
lev[jss::base] =
|
lev[jss::base] =
|
||||||
Logs::toString(Logs::fromSeverity(deprecatedLogs().severity()));
|
Logs::toString(Logs::fromSeverity(context.app.logs().severity()));
|
||||||
std::vector< std::pair<std::string, std::string> > logTable (
|
std::vector< std::pair<std::string, std::string> > logTable (
|
||||||
deprecatedLogs().partition_severities());
|
context.app.logs().partition_severities());
|
||||||
using stringPair = std::map<std::string, std::string>::value_type;
|
using stringPair = std::map<std::string, std::string>::value_type;
|
||||||
for (auto const& it : logTable)
|
for (auto const& it : logTable)
|
||||||
lev[it.first] = it.second;
|
lev[it.first] = it.second;
|
||||||
@@ -60,7 +61,7 @@ Json::Value doLogLevel (RPC::Context& context)
|
|||||||
if (!context.params.isMember (jss::partition))
|
if (!context.params.isMember (jss::partition))
|
||||||
{
|
{
|
||||||
// set base log severity
|
// set base log severity
|
||||||
deprecatedLogs().severity(severity);
|
context.app.logs().severity(severity);
|
||||||
return Json::objectValue;
|
return Json::objectValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,9 +72,9 @@ Json::Value doLogLevel (RPC::Context& context)
|
|||||||
std::string partition (context.params[jss::partition].asString ());
|
std::string partition (context.params[jss::partition].asString ());
|
||||||
|
|
||||||
if (boost::iequals (partition, "base"))
|
if (boost::iequals (partition, "base"))
|
||||||
deprecatedLogs().severity (severity);
|
context.app.logs().severity (severity);
|
||||||
else
|
else
|
||||||
deprecatedLogs().get(partition).severity(severity);
|
context.app.logs().get(partition).severity(severity);
|
||||||
|
|
||||||
return Json::objectValue;
|
return Json::objectValue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <BeastConfig.h>
|
#include <BeastConfig.h>
|
||||||
|
#include <ripple/app/main/Application.h>
|
||||||
#include <ripple/basics/Log.h>
|
#include <ripple/basics/Log.h>
|
||||||
#include <ripple/rpc/impl/Handler.h>
|
#include <ripple/rpc/impl/Handler.h>
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ namespace ripple {
|
|||||||
|
|
||||||
Json::Value doLogRotate (RPC::Context& context)
|
Json::Value doLogRotate (RPC::Context& context)
|
||||||
{
|
{
|
||||||
return RPC::makeObjectValue (deprecatedLogs().rotate());
|
return RPC::makeObjectValue (context.app.logs().rotate());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // ripple
|
} // ripple
|
||||||
|
|||||||
@@ -61,10 +61,10 @@ ServerHandlerImp::ServerHandlerImp (Application& app, Stoppable& parent,
|
|||||||
: ServerHandler (parent)
|
: ServerHandler (parent)
|
||||||
, app_ (app)
|
, app_ (app)
|
||||||
, m_resourceManager (resourceManager)
|
, m_resourceManager (resourceManager)
|
||||||
, m_journal (deprecatedLogs().journal("Server"))
|
, m_journal (app_.logs().journal("Server"))
|
||||||
, m_networkOPs (networkOPs)
|
, m_networkOPs (networkOPs)
|
||||||
, m_server (HTTP::make_Server(
|
, m_server (HTTP::make_Server(
|
||||||
*this, io_service, deprecatedLogs().journal("Server")))
|
*this, io_service, app_.logs().journal("Server")))
|
||||||
, m_jobQueue (jobQueue)
|
, m_jobQueue (jobQueue)
|
||||||
{
|
{
|
||||||
auto const& group (cm.group ("rpc"));
|
auto const& group (cm.group ("rpc"));
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <ripple/shamap/FullBelowCache.h>
|
#include <ripple/shamap/FullBelowCache.h>
|
||||||
#include <ripple/shamap/TreeNodeCache.h>
|
#include <ripple/shamap/TreeNodeCache.h>
|
||||||
#include <ripple/nodestore/Database.h>
|
#include <ripple/nodestore/Database.h>
|
||||||
|
#include <beast/utility/Journal.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
@@ -32,6 +33,10 @@ class Family
|
|||||||
public:
|
public:
|
||||||
virtual ~Family() = default;
|
virtual ~Family() = default;
|
||||||
|
|
||||||
|
virtual
|
||||||
|
beast::Journal const&
|
||||||
|
journal() = 0;
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
FullBelowCache&
|
FullBelowCache&
|
||||||
fullbelow() = 0;
|
fullbelow() = 0;
|
||||||
|
|||||||
@@ -104,15 +104,13 @@ public:
|
|||||||
SHAMap (
|
SHAMap (
|
||||||
SHAMapType t,
|
SHAMapType t,
|
||||||
Family& f,
|
Family& f,
|
||||||
beast::Journal journal,
|
|
||||||
std::uint32_t seq = 1
|
std::uint32_t seq = 1
|
||||||
);
|
);
|
||||||
|
|
||||||
SHAMap (
|
SHAMap (
|
||||||
SHAMapType t,
|
SHAMapType t,
|
||||||
uint256 const& hash,
|
uint256 const& hash,
|
||||||
Family& f,
|
Family& f);
|
||||||
beast::Journal journal);
|
|
||||||
|
|
||||||
Family&
|
Family&
|
||||||
family()
|
family()
|
||||||
|
|||||||
@@ -26,10 +26,9 @@ namespace ripple {
|
|||||||
SHAMap::SHAMap (
|
SHAMap::SHAMap (
|
||||||
SHAMapType t,
|
SHAMapType t,
|
||||||
Family& f,
|
Family& f,
|
||||||
beast::Journal journal,
|
|
||||||
std::uint32_t seq)
|
std::uint32_t seq)
|
||||||
: f_ (f)
|
: f_ (f)
|
||||||
, journal_(journal)
|
, journal_(f.journal())
|
||||||
, seq_ (seq)
|
, seq_ (seq)
|
||||||
, ledgerSeq_ (0)
|
, ledgerSeq_ (0)
|
||||||
, state_ (SHAMapState::Modifying)
|
, state_ (SHAMapState::Modifying)
|
||||||
@@ -43,10 +42,9 @@ SHAMap::SHAMap (
|
|||||||
SHAMap::SHAMap (
|
SHAMap::SHAMap (
|
||||||
SHAMapType t,
|
SHAMapType t,
|
||||||
uint256 const& hash,
|
uint256 const& hash,
|
||||||
Family& f,
|
Family& f)
|
||||||
beast::Journal journal)
|
|
||||||
: f_ (f)
|
: f_ (f)
|
||||||
, journal_(journal)
|
, journal_(f.journal())
|
||||||
, seq_ (1)
|
, seq_ (1)
|
||||||
, ledgerSeq_ (0)
|
, ledgerSeq_ (0)
|
||||||
, state_ (SHAMapState::Synching)
|
, state_ (SHAMapState::Synching)
|
||||||
@@ -63,7 +61,7 @@ SHAMap::~SHAMap ()
|
|||||||
std::shared_ptr<SHAMap>
|
std::shared_ptr<SHAMap>
|
||||||
SHAMap::snapShot (bool isMutable) const
|
SHAMap::snapShot (bool isMutable) const
|
||||||
{
|
{
|
||||||
auto ret = std::make_shared<SHAMap> (type_, f_, journal_);
|
auto ret = std::make_shared<SHAMap> (type_, f_);
|
||||||
SHAMap& newMap = *ret;
|
SHAMap& newMap = *ret;
|
||||||
|
|
||||||
if (!isMutable)
|
if (!isMutable)
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public:
|
|||||||
beast::Journal const j; // debug journal
|
beast::Journal const j; // debug journal
|
||||||
TestFamily f(j);
|
TestFamily f(j);
|
||||||
std::shared_ptr <Table> t1 (std::make_shared <Table> (
|
std::shared_ptr <Table> t1 (std::make_shared <Table> (
|
||||||
SHAMapType::FREE, f, beast::Journal()));
|
SHAMapType::FREE, f));
|
||||||
|
|
||||||
pass ();
|
pass ();
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public:
|
|||||||
h4.SetHex ("b92891fe4ef6cee585fdc6fda2e09eb4d386363158ec3321b8123e5a772c6ca8");
|
h4.SetHex ("b92891fe4ef6cee585fdc6fda2e09eb4d386363158ec3321b8123e5a772c6ca8");
|
||||||
h5.SetHex ("a92891fe4ef6cee585fdc6fda0e09eb4d386363158ec3321b8123e5a772c6ca7");
|
h5.SetHex ("a92891fe4ef6cee585fdc6fda0e09eb4d386363158ec3321b8123e5a772c6ca7");
|
||||||
|
|
||||||
SHAMap sMap (SHAMapType::FREE, f, beast::Journal());
|
SHAMap sMap (SHAMapType::FREE, f);
|
||||||
SHAMapItem i1 (h1, IntToVUC (1)), i2 (h2, IntToVUC (2)), i3 (h3, IntToVUC (3)), i4 (h4, IntToVUC (4)), i5 (h5, IntToVUC (5));
|
SHAMapItem i1 (h1, IntToVUC (1)), i2 (h2, IntToVUC (2)), i3 (h3, IntToVUC (3)), i4 (h4, IntToVUC (4)), i5 (h5, IntToVUC (5));
|
||||||
unexpected (!sMap.addItem (i2, true, false), "no add");
|
unexpected (!sMap.addItem (i2, true, false), "no add");
|
||||||
unexpected (!sMap.addItem (i1, true, false), "no add");
|
unexpected (!sMap.addItem (i1, true, false), "no add");
|
||||||
@@ -118,7 +118,7 @@ public:
|
|||||||
hashes[6].SetHex ("76DCC77C4027309B5A91AD164083264D70B77B5E43E08AEDA5EBF94361143615");
|
hashes[6].SetHex ("76DCC77C4027309B5A91AD164083264D70B77B5E43E08AEDA5EBF94361143615");
|
||||||
hashes[7].SetHex ("DF4220E93ADC6F5569063A01B4DC79F8DB9553B6A3222ADE23DEA02BBE7230E5");
|
hashes[7].SetHex ("DF4220E93ADC6F5569063A01B4DC79F8DB9553B6A3222ADE23DEA02BBE7230E5");
|
||||||
|
|
||||||
SHAMap map (SHAMapType::FREE, f, beast::Journal());
|
SHAMap map (SHAMapType::FREE, f);
|
||||||
|
|
||||||
expect (map.getHash() == uint256(), "bad initial empty map hash");
|
expect (map.getHash() == uint256(), "bad initial empty map hash");
|
||||||
for (int i = 0; i < keys.size(); ++i)
|
for (int i = 0; i < keys.size(); ++i)
|
||||||
|
|||||||
@@ -101,8 +101,8 @@ public:
|
|||||||
beast::Journal const j; // debug journal
|
beast::Journal const j; // debug journal
|
||||||
|
|
||||||
TestFamily f(j);
|
TestFamily f(j);
|
||||||
SHAMap source (SHAMapType::FREE, f, j);
|
SHAMap source (SHAMapType::FREE, f);
|
||||||
SHAMap destination (SHAMapType::FREE, f, j);
|
SHAMap destination (SHAMapType::FREE, f);
|
||||||
|
|
||||||
int items = 10000;
|
int items = 10000;
|
||||||
for (int i = 0; i < items; ++i)
|
for (int i = 0; i < items; ++i)
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ private:
|
|||||||
TreeNodeCache treecache_;
|
TreeNodeCache treecache_;
|
||||||
FullBelowCache fullbelow_;
|
FullBelowCache fullbelow_;
|
||||||
std::unique_ptr<NodeStore::Database> db_;
|
std::unique_ptr<NodeStore::Database> db_;
|
||||||
|
beast::Journal j_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit
|
explicit
|
||||||
@@ -63,6 +64,12 @@ public:
|
|||||||
return clock_;
|
return clock_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
beast::Journal const&
|
||||||
|
journal() override
|
||||||
|
{
|
||||||
|
return j_;
|
||||||
|
}
|
||||||
|
|
||||||
FullBelowCache&
|
FullBelowCache&
|
||||||
fullbelow() override
|
fullbelow() override
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user