1#include <xrpl/nodestore/detail/DatabaseNodeImp.h>
36 JLOG(
j_.
fatal()) <<
"fetchNodeObject " << hash <<
": Exception fetching from backend: " << e.
what();
46 JLOG(
j_.
fatal()) <<
"fetchNodeObject " << hash <<
": nodestore data is corrupted";
49 JLOG(
j_.
warn()) <<
"fetchNodeObject " << hash <<
": backend returns unknown result " << status;
63 auto const before = steady_clock::now();
67 for (
size_t i = 0; i < hashes.
size(); ++i)
69 auto const&
hash = hashes[i];
78 results.size() == hashes.
size() || results.empty(),
79 "number of output objects either matches number of input hashes or is empty");
80 results.resize(hashes.
size());
81 for (
size_t i = 0; i < results.size(); ++i)
85 JLOG(
j_.
error()) <<
"fetchBatch - "
86 <<
"record not found in db. hash = " <<
strHex(hashes[i]);
90 auto fetchDurationUs = 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)
NodeObjectType
The types of node objects.
void Rethrow()
Rethrow the exception currently being handled.
Contains information about a fetch operation.