1#include <xrpl/nodestore/detail/DatabaseNodeImp.h>
36 status =
backend_->fetch(hash, &nodeObject);
40 JLOG(
j_.
fatal()) <<
"fetchNodeObject " << hash
41 <<
": Exception fetching from backend: " << e.
what();
51 JLOG(
j_.
fatal()) <<
"fetchNodeObject " << hash <<
": nodestore data is corrupted";
54 JLOG(
j_.
warn()) <<
"fetchNodeObject " << hash <<
": backend returns unknown result "
69 auto const before = steady_clock::now();
74 auto results =
backend_->fetchBatch(hashes).first;
76 results.size() == hashes.
size() || results.empty(),
77 "number of output objects either matches number of input hashes or is empty");
78 results.resize(hashes.
size());
79 for (
size_t i = 0; i < results.size(); ++i)
83 JLOG(
j_.
error()) <<
"fetchBatch - "
84 <<
"record not found in db. hash = " <<
strHex(hashes[i]);
88 auto fetchDurationUs =
89 std::chrono::duration_cast<std::chrono::microseconds>(steady_clock::now() - before).count();
static std::shared_ptr< NodeObject > createObject(NodeObjectType type, Blob &&data, uint256 const &hash)
Create an object from fields.
void store(NodeObjectType type, Blob &&data, uint256 const &hash, std::uint32_t) override
Store the object.
std::shared_ptr< Backend > backend_
std::shared_ptr< NodeObject > fetchNodeObject(uint256 const &hash, std::uint32_t, FetchReport &fetchReport, bool duplicate) override
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::vector< std::shared_ptr< NodeObject > > fetchBatch(std::vector< uint256 > const &hashes)
void storeStats(std::uint64_t count, std::uint64_t sz)
void updateFetchMetrics(uint64_t fetches, uint64_t hits, uint64_t duration)
virtual void asyncFetch(uint256 const &hash, std::uint32_t ledgerSeq, std::function< void(std::shared_ptr< NodeObject > const &)> &&callback)
Fetch an object without waiting.
Status
Return codes from Backend operations.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::string strHex(FwdIt begin, FwdIt end)
XRPL_NO_SANITIZE_ADDRESS void Rethrow()
Rethrow the exception currently being handled.
NodeObjectType
The types of node objects.
Contains information about a fetch operation.