Order book offers by quality

This commit is contained in:
Nathan Nichols
2021-04-21 23:27:14 -05:00
parent d9a8ff5399
commit 0bcf3a4601
10 changed files with 232 additions and 239 deletions

View File

@@ -5,6 +5,12 @@ BackendIndexer::BackendIndexer(boost::json::object const& config)
: keyShift_(config.at("keyshift").as_int64())
, bookShift_(config.at("bookshift").as_int64())
{
BOOST_LOG_TRIVIAL(info) << "Indexer - starting with keyShift_ = "
<< std::to_string(keyShift_);
BOOST_LOG_TRIVIAL(info) << "Indexer - starting with keyShift_ = "
<< std::to_string(bookShift_);
work_.emplace(ioc_);
ioThread_ = std::thread{[this]() { ioc_.run(); }};
};
@@ -42,6 +48,25 @@ BackendIndexer::deleteBookOffer(
booksToDeletedOffers[book].insert(offerKey);
}
std::vector<ripple::uint256>
BackendIndexer::getCurrentOffers(ripple::uint256 const& book)
{
std::vector<ripple::uint256> offers;
offers.reserve(booksToOffers[book].size() + booksToOffers[book].size());
for (auto const& offer : booksToOffers[book])
{
offers.push_back(offer);
}
for(auto const& offer : booksToDeletedOffers[book])
{
offers.push_back(offer);
}
return offers;
}
void
BackendIndexer::finish(uint32_t ledgerSequence, BackendInterface const& backend)
{