1#include <xrpl/ledger/CachedView.h>
3#include <xrpl/basics/CountedObject.h>
4#include <xrpl/basics/TaggedCache.ipp>
5#include <xrpl/basics/base_uint.h>
6#include <xrpl/beast/utility/instrumentation.h>
7#include <xrpl/protocol/Keylet.h>
8#include <xrpl/protocol/STLedgerEntry.h>
18 return read(k) !=
nullptr;
27 bool cacheHit =
false;
28 bool baseRead =
false;
33 auto const iter =
map_.find(k.
key);
34 if (iter !=
map_.end())
49 XRPL_ASSERT(sle || baseRead,
"xrpl::CachedView::read : null SLE result from base");
50 if (cacheHit && baseRead)
71 if (!sle || !k.
check(*sle))
Implementation for CountedObject.
virtual SLE::const_pointer read(Keylet const &k) const =0
Return the state item associated with a key.
std::shared_ptr< STLedgerEntry const > const_pointer
SharedPointerType fetch(key_type const &key)
SLE::const_pointer read(Keylet const &k) const override
Return the state item associated with a key.
std::optional< digest_type > digest(key_type const &key) const override
Return the digest associated with the key.
DigestAwareReadView const & base_
std::unordered_map< key_type, uint256, HardenedHash<> > map_
bool exists(Keylet const &k) const override
Determine if a state item exists.
static Hasher::result_type digest(void const *data, std::size_t size) noexcept
A pair of SHAMap key and LedgerEntryType.
bool check(STLedgerEntry const &) const
Returns true if the SLE matches the type.