20 #include <ripple/app/ledger/Ledger.h>
21 #include <ripple/nodestore/impl/DatabaseNodeImp.h>
22 #include <ripple/protocol/HashPrefix.h>
35 pCache_->canonicalize_replace_cache(hash, nObj);
48 nodeObject =
pCache_->fetch(hash);
49 if (nodeObject ||
nCache_->touch_if_exists(hash))
80 auto nodeObject{
pCache_->fetch(hash)};
81 if (!nodeObject && !
nCache_->touch_if_exists(hash))
102 fetchSz_ += nodeObject->getData().size();
107 JLOG(
j_.
fatal()) <<
"Corrupt NodeObject #" << hash;
110 JLOG(
j_.
warn()) <<
"Unknown status=" << status;
117 nodeObject =
pCache_->fetch(hash);
127 pCache_->canonicalize_replace_client(hash, nodeObject);
130 JLOG(
j_.
trace()) <<
"HOS: " << hash <<
" fetch: in shard db";
std::shared_ptr< Backend > backend_
Stream trace() const
Severity stream access functions.
NodeObjectType
The types of node objects.
static std::shared_ptr< NodeObject > createObject(NodeObjectType type, Blob &&data, uint256 const &hash)
Create an object from fields.
std::shared_ptr< NodeObject > fetchNodeObject(uint256 const &hash, std::uint32_t, FetchReport &fetchReport) override
std::atomic< std::uint32_t > fetchSz_
Contains information about a fetch operation.
std::atomic< std::uint32_t > fetchHitCount_
void tune(int size, std::chrono::seconds age) override
Set the maximum number of entries and maximum cache age for both caches.
std::shared_ptr< TaggedCache< uint256, NodeObject > > pCache_
void Rethrow()
Rethrow the exception currently being handled.
void storeStats(std::uint64_t count, std::uint64_t sz)
bool asyncFetch(uint256 const &hash, std::uint32_t ledgerSeq, std::shared_ptr< NodeObject > &nodeObject) override
Fetch an object without waiting.
void store(NodeObjectType type, Blob &&data, uint256 const &hash, std::uint32_t) override
Store the object.
std::shared_ptr< KeyCache< uint256 > > nCache_
Status
Return codes from Backend operations.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
virtual bool asyncFetch(uint256 const &hash, std::uint32_t ledgerSeq, std::shared_ptr< NodeObject > &nodeObject)=0
Fetch an object without waiting.
void sweep() override
Remove expired entries from the positive and negative caches.