本文整理汇总了C++中beast::Journal::info方法的典型用法代码示例。如果您正苦于以下问题:C++ Journal::info方法的具体用法?C++ Journal::info怎么用?C++ Journal::info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类beast::Journal
的用法示例。
在下文中一共展示了Journal::info方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: walkLedger
//------------------------------------------------------------------------------
bool Ledger::walkLedger (beast::Journal j) const
{
std::vector <SHAMapMissingNode> missingNodes1;
std::vector <SHAMapMissingNode> missingNodes2;
if (stateMap_->getHash().isZero() &&
! info_.accountHash.isZero() &&
! stateMap_->fetchRoot (SHAMapHash{info_.accountHash}, nullptr))
{
missingNodes1.emplace_back (SHAMapType::STATE, SHAMapHash{info_.accountHash});
}
else
{
stateMap_->walkMap (missingNodes1, 32);
}
if (!missingNodes1.empty ())
{
if (auto stream = j.info())
{
stream << missingNodes1.size () << " missing account node(s)";
stream << "First: " << missingNodes1[0];
}
}
if (txMap_->getHash().isZero() &&
info_.txHash.isNonZero() &&
! txMap_->fetchRoot (SHAMapHash{info_.txHash}, nullptr))
{
missingNodes2.emplace_back (SHAMapType::TRANSACTION, SHAMapHash{info_.txHash});
}
else
{
txMap_->walkMap (missingNodes2, 32);
}
if (!missingNodes2.empty ())
{
if (auto stream = j.info())
{
stream << missingNodes2.size () << " missing transaction node(s)";
stream << "First: " << missingNodes2[0];
}
}
return missingNodes1.empty () && missingNodes2.empty ();
}
示例2: onStop
void onStop () override
{
JLOG (j_.info()) << "Stopping";
{
std::lock_guard<std::mutex> lock (mutex_);
shouldExit_ = true;
wakeup_.notify_one();
}
thread_.join();
}
示例3: doLedgerCleaner
/** Run the ledger cleaner. */
void doLedgerCleaner()
{
auto shouldExit = [this]()
{
std::lock_guard<std::mutex> lock(mutex_);
return shouldExit_;
};
std::shared_ptr<ReadView const> goodLedger;
while (! shouldExit())
{
LedgerIndex ledgerIndex;
LedgerHash ledgerHash;
bool doNodes;
bool doTxns;
while (app_.getFeeTrack().isLoadedLocal())
{
JLOG (j_.debug()) << "Waiting for load to subside";
std::this_thread::sleep_for(std::chrono::seconds(5));
if (shouldExit())
return;
}
{
std::lock_guard<std::mutex> lock (mutex_);
if ((minRange_ > maxRange_) ||
(maxRange_ == 0) || (minRange_ == 0))
{
minRange_ = maxRange_ = 0;
state_ = State::readyToClean;
return;
}
ledgerIndex = maxRange_;
doNodes = checkNodes_;
doTxns = fixTxns_;
}
ledgerHash = getHash(ledgerIndex, goodLedger);
bool fail = false;
if (ledgerHash.isZero())
{
JLOG (j_.info()) << "Unable to get hash for ledger "
<< ledgerIndex;
fail = true;
}
else if (!doLedger(ledgerIndex, ledgerHash, doNodes, doTxns))
{
JLOG (j_.info()) << "Failed to process ledger " << ledgerIndex;
fail = true;
}
if (fail)
{
{
std::lock_guard<std::mutex> lock (mutex_);
++failures_;
}
// Wait for acquiring to catch up to us
std::this_thread::sleep_for(std::chrono::seconds(2));
}
else
{
{
std::lock_guard<std::mutex> lock (mutex_);
if (ledgerIndex == minRange_)
++minRange_;
if (ledgerIndex == maxRange_)
--maxRange_;
failures_ = 0;
}
// Reduce I/O pressure and wait for acquiring to catch up to us
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}
}