20 #ifndef RIPPLE_LEDGER_CACHEDVIEW_H_INCLUDED
21 #define RIPPLE_LEDGER_CACHEDVIEW_H_INCLUDED
23 #include <ripple/basics/hardened_hash.h>
24 #include <ripple/ledger/CachedSLEs.h>
25 #include <ripple/ledger/ReadView.h>
158 template <
class Base>
virtual LedgerInfo const & info() const =0
Returns information about the ledger.
bool open() const override
Returns true if this reflects an open ledger.
A pair of SHAMap key and LedgerEntryType.
std::optional< digest_type > digest(key_type const &key) const override
tx_type txRead(key_type const &key) const override
virtual Fees const & fees() const =0
Returns the fees for the base ledger.
virtual std::unique_ptr< txs_type::iter_base > txsEnd() const =0
std::unique_ptr< txs_type::iter_base > txsEnd() const override
virtual bool txExists(key_type const &key) const =0
Returns true if a tx exists in the tx map.
virtual std::unique_ptr< sles_type::iter_base > slesBegin() const =0
Fees const & fees() const override
Returns the fees for the base ledger.
CachedViewImpl(DigestAwareReadView const *base, CachedSLEs &cache)
std::unique_ptr< txs_type::iter_base > txsBegin() const override
std::optional< key_type > succ(key_type const &key, std::optional< key_type > const &last=std::nullopt) const override
bool txExists(key_type const &key) const override
std::unique_ptr< sles_type::iter_base > slesEnd() const override
virtual std::unique_ptr< txs_type::iter_base > txsBegin() const =0
std::shared_ptr< SLE const > read(Keylet const &k) const override
Return the state item associated with a key.
std::unique_ptr< sles_type::iter_base > slesUpperBound(uint256 const &key) const override
Reflects the fee settings for a particular ledger.
Wraps a DigestAwareReadView to provide caching.
virtual std::unique_ptr< sles_type::iter_base > slesUpperBound(key_type const &key) const =0
virtual std::unique_ptr< sles_type::iter_base > slesEnd() const =0
ReadView that associates keys with digests.
virtual tx_type txRead(key_type const &key) const =0
Read a transaction from the tx map.
Seed functor once per construction.
std::unordered_map< key_type, std::shared_ptr< SLE const >, hardened_hash<> > map_
virtual std::optional< key_type > succ(key_type const &key, std::optional< key_type > const &last=std::nullopt) const =0
Return the key of the next state item.
Rules const & rules() const override
Returns the tx processing rules.
std::pair< std::shared_ptr< STTx const >, std::shared_ptr< STObject const > > tx_type
LedgerInfo const & info() const override
Returns information about the ledger.
CachedViewImpl & operator=(CachedViewImpl const &)=delete
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
DigestAwareReadView const & base_
virtual Rules const & rules() const =0
Returns the tx processing rules.
CachedView & operator=(CachedView const &)=delete
Rules controlling protocol behavior.
std::shared_ptr< Base const > const & base() const
Returns the base type.
bool exists(Keylet const &k) const override
Determine if a state item exists.
std::shared_ptr< Base const > sp_
Information about the notional ledger backing the view.
virtual std::optional< digest_type > digest(key_type const &key) const =0
Return the digest associated with the key.
virtual bool open() const =0
Returns true if this reflects an open ledger.
CachedView(std::shared_ptr< Base const > const &base, CachedSLEs &cache)
T & get(EitherAmount &amt)
std::unique_ptr< sles_type::iter_base > slesBegin() const override