add server info

This commit is contained in:
CJ Cobb
2021-06-01 13:33:52 -04:00
parent 46d4ee4548
commit d692f7f675
17 changed files with 200 additions and 61 deletions

View File

@@ -84,6 +84,8 @@ class BackendIndexer
std::optional<boost::asio::io_context::work> work_;
std::thread ioThread_;
std::atomic_uint32_t indexing_ = 0;
uint32_t keyShift_ = 20;
std::unordered_set<ripple::uint256> keys;
@@ -115,6 +117,14 @@ public:
{
return keyShift_;
}
std::optional<uint32_t>
getCurrentlyIndexing()
{
uint32_t cur = indexing_.load();
if (cur != 0)
return cur;
return {};
}
KeyIndex
getKeyIndexOfSeq(uint32_t seq) const
{
@@ -171,16 +181,18 @@ public:
if (commitRes)
{
if (isFirst_)
{
auto rng = fetchLedgerRangeNoThrow();
if (rng && rng->minSequence != ledgerSequence)
isFirst_ = false;
indexer_.doKeysRepairAsync(*this, ledgerSequence);
}
if (indexer_.isKeyFlagLedger(ledgerSequence) || isFirst_)
if (indexer_.isKeyFlagLedger(ledgerSequence))
indexer_.writeKeyFlagLedgerAsync(ledgerSequence, *this);
isFirst_ = false;
}
else
{
// if commitRes is false, we are relinquishing control of ETL. We
// reset isFirst_ to true so that way if we later regain control of
// ETL, we trigger the index repair
isFirst_ = true;
}
return commitRes;
}