1#include <xrpl/nodestore/detail/DatabaseNodeImp.h> 
   38            callback(obj->getType() == 
hotDUMMY ? 
nullptr : obj);
 
 
   64        JLOG(
j_.
trace()) << 
"fetchNodeObject " << hash << 
": record not " 
   65                         << (
cache_ ? 
"cached" : 
"found");
 
   76                << 
"fetchNodeObject " << hash
 
   77                << 
": Exception fetching from backend: " << e.
what();
 
   87                        cache_->canonicalize_replace_client(hash, nodeObject);
 
  101                JLOG(
j_.
fatal()) << 
"fetchNodeObject " << hash
 
  102                                 << 
": nodestore data is corrupted";
 
  106                    << 
"fetchNodeObject " << hash
 
  107                    << 
": backend returns unknown result " << status;
 
  113        JLOG(
j_.
trace()) << 
"fetchNodeObject " << hash
 
  114                         << 
": record found in cache";
 
  115        if (nodeObject->getType() == 
hotDUMMY)
 
 
  130    auto const before = steady_clock::now();
 
  135    for (
size_t i = 0; i < hashes.
size(); ++i)
 
  137        auto const& 
hash = hashes[i];
 
  149            results[i] = nObj->getType() == 
hotDUMMY ? nullptr : nObj;
 
  155    JLOG(
j_.
debug()) << 
"fetchBatch - cache hits = " 
  156                     << (hashes.
size() - cacheMisses.
size())
 
  157                     << 
" - cache misses = " << cacheMisses.
size();
 
  158    auto dbResults = 
backend_->fetchBatch(cacheMisses).first;
 
  160    for (
size_t i = 0; i < dbResults.size(); ++i)
 
  162        auto nObj = std::move(dbResults[i]);
 
  163        size_t index = indexMap[cacheMisses[i]];
 
  164        auto const& 
hash = hashes[index];
 
  170                cache_->canonicalize_replace_client(
hash, nObj);
 
  176                << 
"record not found in db or cache. hash = " << 
strHex(
hash);
 
  185        results[index] = std::move(nObj);
 
  188    auto fetchDurationUs =
 
  189        std::chrono::duration_cast<std::chrono::microseconds>(
 
  190            steady_clock::now() - before)
 
 
Stream trace() const
Severity stream access functions.
 
static std::shared_ptr< NodeObject > createObject(NodeObjectType type, Blob &&data, uint256 const &hash)
Create an object from fields.
 
std::shared_ptr< Backend > backend_
 
std::shared_ptr< TaggedCache< uint256, NodeObject > > cache_
 
std::vector< std::shared_ptr< NodeObject > > fetchBatch(std::vector< uint256 > const &hashes)
 
void store(NodeObjectType type, Blob &&data, uint256 const &hash, std::uint32_t) override
Store the object.
 
void asyncFetch(uint256 const &hash, std::uint32_t ledgerSeq, std::function< void(std::shared_ptr< NodeObject > const &)> &&callback) override
Fetch an object without waiting.
 
std::shared_ptr< NodeObject > fetchNodeObject(uint256 const &hash, std::uint32_t, FetchReport &fetchReport, bool duplicate) override
 
void sweep() override
Remove expired entries from the positive and negative caches.
 
void storeStats(std::uint64_t count, std::uint64_t sz)
 
virtual void asyncFetch(uint256 const &hash, std::uint32_t ledgerSeq, std::function< void(std::shared_ptr< NodeObject > const &)> &&callback)
Fetch an object without waiting.
 
void updateFetchMetrics(uint64_t fetches, uint64_t hits, uint64_t duration)
 
Status
Return codes from Backend operations.
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
NodeObjectType
The types of node objects.
 
std::string strHex(FwdIt begin, FwdIt end)
 
void Rethrow()
Rethrow the exception currently being handled.
 
Contains information about a fetch operation.