1#include <xrpl/nodestore/detail/DatabaseNodeImp.h>
3#include <xrpl/basics/Blob.h>
4#include <xrpl/basics/Log.h>
5#include <xrpl/basics/base_uint.h>
6#include <xrpl/basics/contract.h>
7#include <xrpl/nodestore/Database.h>
8#include <xrpl/nodestore/NodeObject.h>
9#include <xrpl/nodestore/Scheduler.h>
10#include <xrpl/nodestore/Types.h>
71 JLOG(
j_.trace()) <<
"fetchNodeObject " << hash <<
": record not "
72 << (
cache_ ?
"cached" :
"found");
77 status =
backend_->fetch(hash, &nodeObject);
81 JLOG(
j_.fatal()) <<
"fetchNodeObject " << hash
82 <<
": Exception fetching from backend: " << e.
what();
93 cache_->canonicalizeReplaceClient(hash, nodeObject);
98 cache_->canonicalizeReplaceClient(hash, notFound);
100 nodeObject = notFound;
107 JLOG(
j_.fatal()) <<
"fetchNodeObject " << hash <<
": nodestore data is corrupted";
110 JLOG(
j_.warn()) <<
"fetchNodeObject " << hash <<
": backend returns unknown result "
111 <<
static_cast<int>(status);
117 JLOG(
j_.trace()) <<
"fetchNodeObject " << hash <<
": record found in cache";
static std::shared_ptr< NodeObject > createObject(NodeObjectType type, Blob &&data, uint256 const &hash)
Create an object from fields.
std::shared_ptr< TaggedCache< uint256, NodeObject > > cache_
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 sweep() override
Remove expired entries from the positive and negative caches.
void asyncFetch(uint256 const &hash, std::uint32_t ledgerSeq, std::function< void(std::shared_ptr< NodeObject > const &)> &&callback) override
Fetch an object without waiting.
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.
Status
Return codes from Backend operations.
NodeObjectType
The types of node objects.
XRPL_NO_SANITIZE_ADDRESS void rethrow()
Rethrow the exception currently being handled.
std::vector< unsigned char > Blob
Storage for linear binary data.
Contains information about a fetch operation.