1#include <xrpld/app/paths/RippleLineCache.h>
2#include <xrpld/app/paths/TrustLine.h>
7 : ledger_(ledger), journal_(j)
21 auto const hash =
hasher_(accountID);
28 auto [it, inserted] = [&]() {
29 if (
auto otheriter =
lines_.find(otherkey); otheriter !=
lines_.end())
34 auto const size = otheriter->second ? otheriter->second->size() : 0;
36 <<
" trust lines for account " << accountID <<
" found " << size
40 :
"Returning the superset of outgoing")
49 XRPL_ASSERT(size <=
totalLineCount_,
"xrpl::RippleLineCache::getRippleLines : maximum lines");
64 return lines_.emplace(key,
nullptr);
69 XRPL_ASSERT(it->second ==
nullptr,
"xrpl::RippleLineCache::getRippleLines : null lines");
79 !it->second || (it->second->size() > 0),
"xrpl::RippleLineCache::getRippleLines : null or nonempty lines");
80 auto const size = it->second ? it->second->size() : 0;
81 JLOG(
journal_.
trace()) <<
"getRippleLines for ledger " <<
ledger_->header().seq <<
" found " << size
83 << (inserted ?
"new " :
"existing ") << accountID <<
" out of a total of " <<
lines_.
size()
A generic endpoint for log messages.
Stream trace() const
Severity stream access functions.
static std::vector< PathFindTrustLine > getItems(AccountID const &accountID, ReadView const &view, LineDirection direction)
std::size_t totalLineCount_
hash_map< AccountKey, std::shared_ptr< std::vector< PathFindTrustLine > >, AccountKey::Hash > lines_
std::shared_ptr< ReadView const > ledger_
std::shared_ptr< std::vector< PathFindTrustLine > > getRippleLines(AccountID const &accountID, LineDirection direction)
Find the trust lines associated with an account.
RippleLineCache(std::shared_ptr< ReadView const > const &l, beast::Journal j)
xrpl::hardened_hash hasher_
static constexpr std::size_t size()
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
LineDirection
Describes how an account was found in a path, and how to find the next set of paths.