xrpld
Loading...
Searching...
No Matches
xrpl::DigestAwareReadView Class Referenceabstract

ReadView that associates keys with digests. More...

#include <ReadView.h>

Inheritance diagram for xrpl::DigestAwareReadView:
Collaboration diagram for xrpl::DigestAwareReadView:

Public Types

using digest_type = uint256
using tx_type = std::pair<std::shared_ptr<STTx const>, std::shared_ptr<STObject const>>
using key_type = uint256
using mapped_type = SLE::const_pointer

Public Member Functions

 DigestAwareReadView ()=default
 DigestAwareReadView (DigestAwareReadView const &)=default
virtual std::optional< digest_typedigest (key_type const &key) const =0
 Return the digest associated with the key.
virtual LedgerHeader const & header () const =0
 Returns information about the ledger.
virtual bool open () const =0
 Returns true if this reflects an open ledger.
NetClock::time_point parentCloseTime () const
 Returns the close time of the previous ledger.
LedgerIndex seq () const
 Returns the sequence number of the base ledger.
virtual Fees const & fees () const =0
 Returns the fees for the base ledger.
virtual Rules const & rules () const =0
 Returns the tx processing rules.
virtual bool exists (Keylet const &k) const =0
 Determine if a state item exists.
virtual std::optional< key_typesucc (key_type const &key, std::optional< key_type > const &last=std::nullopt) const =0
 Return the key of the next state item.
virtual SLE::const_pointer read (Keylet const &k) const =0
 Return the state item associated with a key.
virtual STAmount balanceHookIOU (AccountID const &account, AccountID const &issuer, STAmount const &amount) const
virtual STAmount balanceHookMPT (AccountID const &account, MPTIssue const &issue, std::int64_t amount) const
virtual STAmount balanceHookSelfIssueMPT (MPTIssue const &issue, std::int64_t amount) const
virtual std::uint32_t ownerCountHook (AccountID const &account, std::uint32_t count) const
virtual std::unique_ptr< SlesType::iter_base > slesBegin () const =0
virtual std::unique_ptr< SlesType::iter_base > slesEnd () const =0
virtual std::unique_ptr< SlesType::iter_base > slesUpperBound (key_type const &key) const =0
virtual std::unique_ptr< TxsType::iter_base > txsBegin () const =0
virtual std::unique_ptr< TxsType::iter_base > txsEnd () const =0
virtual bool txExists (key_type const &key) const =0
 Returns true if a tx exists in the tx map.
virtual tx_type txRead (key_type const &key) const =0
 Read a transaction from the tx map.

Public Attributes

SlesType sles
 Iterable range of ledger state items.
TxsType txs

Detailed Description

ReadView that associates keys with digests.

Definition at line 248 of file ReadView.h.

Member Typedef Documentation

◆ digest_type

Definition at line 251 of file ReadView.h.

◆ tx_type

Definition at line 33 of file ReadView.h.

◆ key_type

using xrpl::ReadView::key_type = uint256
inherited

Definition at line 35 of file ReadView.h.

◆ mapped_type

Definition at line 37 of file ReadView.h.

Constructor & Destructor Documentation

◆ DigestAwareReadView() [1/2]

xrpl::DigestAwareReadView::DigestAwareReadView ( )
default

◆ DigestAwareReadView() [2/2]

xrpl::DigestAwareReadView::DigestAwareReadView ( DigestAwareReadView const & )
default

Member Function Documentation

◆ digest()

virtual std::optional< digest_type > xrpl::DigestAwareReadView::digest ( key_type const & key) const
nodiscardpure virtual

Return the digest associated with the key.

Returns
std::nullopt if the item does not exist.

Implemented in xrpl::detail::CachedViewImpl, and xrpl::Ledger.

◆ header()

virtual LedgerHeader const & xrpl::ReadView::header ( ) const
nodiscardpure virtualinherited

Returns information about the ledger.

Implemented in xrpl::detail::ApplyViewBase, xrpl::detail::CachedViewImpl, xrpl::Ledger, and xrpl::OpenView.

◆ open()

virtual bool xrpl::ReadView::open ( ) const
nodiscardpure virtualinherited

Returns true if this reflects an open ledger.

Implemented in xrpl::detail::ApplyViewBase, xrpl::detail::CachedViewImpl, xrpl::Ledger, and xrpl::OpenView.

◆ parentCloseTime()

NetClock::time_point xrpl::ReadView::parentCloseTime ( ) const
nodiscardinherited

Returns the close time of the previous ledger.

Definition at line 90 of file ReadView.h.

◆ seq()

LedgerIndex xrpl::ReadView::seq ( ) const
nodiscardinherited

Returns the sequence number of the base ledger.

Definition at line 97 of file ReadView.h.

◆ fees()

virtual Fees const & xrpl::ReadView::fees ( ) const
nodiscardpure virtualinherited

Returns the fees for the base ledger.

Implemented in xrpl::detail::ApplyViewBase, xrpl::detail::CachedViewImpl, xrpl::Ledger, and xrpl::OpenView.

◆ rules()

virtual Rules const & xrpl::ReadView::rules ( ) const
nodiscardpure virtualinherited

Returns the tx processing rules.

Implemented in xrpl::detail::ApplyViewBase, xrpl::detail::CachedViewImpl, xrpl::Ledger, and xrpl::OpenView.

◆ exists()

virtual bool xrpl::ReadView::exists ( Keylet const & k) const
nodiscardpure virtualinherited

Determine if a state item exists.

Note
This can be more efficient than calling read.
Returns
true if a SLE is associated with the specified key.

Implemented in xrpl::detail::ApplyViewBase, xrpl::detail::CachedViewImpl, xrpl::Ledger, and xrpl::OpenView.

◆ succ()

virtual std::optional< key_type > xrpl::ReadView::succ ( key_type const & key,
std::optional< key_type > const & last = std::nullopt ) const
nodiscardpure virtualinherited

Return the key of the next state item.

This returns the key of the first state item whose key is greater than the specified key. If no such key is present, std::nullopt is returned.

If last is engaged, returns std::nullopt when the key returned would be outside the open interval (key, last).

Implemented in xrpl::detail::ApplyViewBase, xrpl::detail::CachedViewImpl, and xrpl::OpenView.

◆ read()

virtual SLE::const_pointer xrpl::ReadView::read ( Keylet const & k) const
nodiscardpure virtualinherited

Return the state item associated with a key.

Effects: If the key exists, gives the caller ownership of the non-modifiable corresponding SLE.

Note
While the returned SLE is const from the perspective of the caller, it can be changed by other callers through raw operations.
Returns
nullptr if the key is not present or if the type does not match.

Implemented in xrpl::detail::ApplyViewBase, xrpl::detail::CachedViewImpl, xrpl::Ledger, and xrpl::OpenView.

◆ balanceHookIOU()

virtual STAmount xrpl::ReadView::balanceHookIOU ( AccountID const & account,
AccountID const & issuer,
STAmount const & amount ) const
nodiscardvirtualinherited

Reimplemented in xrpl::PaymentSandbox.

Definition at line 155 of file ReadView.h.

◆ balanceHookMPT()

virtual STAmount xrpl::ReadView::balanceHookMPT ( AccountID const & account,
MPTIssue const & issue,
std::int64_t amount ) const
nodiscardvirtualinherited

Reimplemented in xrpl::PaymentSandbox.

Definition at line 165 of file ReadView.h.

◆ balanceHookSelfIssueMPT()

virtual STAmount xrpl::ReadView::balanceHookSelfIssueMPT ( MPTIssue const & issue,
std::int64_t amount ) const
nodiscardvirtualinherited

Reimplemented in xrpl::PaymentSandbox.

Definition at line 175 of file ReadView.h.

◆ ownerCountHook()

virtual std::uint32_t xrpl::ReadView::ownerCountHook ( AccountID const & account,
std::uint32_t count ) const
nodiscardvirtualinherited

Reimplemented in xrpl::PaymentSandbox.

Definition at line 186 of file ReadView.h.

◆ slesBegin()

virtual std::unique_ptr< SlesType::iter_base > xrpl::ReadView::slesBegin ( ) const
nodiscardpure virtualinherited

◆ slesEnd()

virtual std::unique_ptr< SlesType::iter_base > xrpl::ReadView::slesEnd ( ) const
nodiscardpure virtualinherited

◆ slesUpperBound()

virtual std::unique_ptr< SlesType::iter_base > xrpl::ReadView::slesUpperBound ( key_type const & key) const
nodiscardpure virtualinherited

◆ txsBegin()

virtual std::unique_ptr< TxsType::iter_base > xrpl::ReadView::txsBegin ( ) const
nodiscardpure virtualinherited

◆ txsEnd()

virtual std::unique_ptr< TxsType::iter_base > xrpl::ReadView::txsEnd ( ) const
nodiscardpure virtualinherited

◆ txExists()

virtual bool xrpl::ReadView::txExists ( key_type const & key) const
nodiscardpure virtualinherited

Returns true if a tx exists in the tx map.

A tx exists in the map if it is part of the base ledger, or if it is a newly inserted tx.

Implemented in xrpl::detail::ApplyViewBase, xrpl::detail::CachedViewImpl, and xrpl::OpenView.

◆ txRead()

virtual tx_type xrpl::ReadView::txRead ( key_type const & key) const
nodiscardpure virtualinherited

Read a transaction from the tx map.

If the view represents an open ledger, the metadata object will be empty.

Returns
A pair of nullptr if the key is not found in the tx map.

Implemented in xrpl::detail::ApplyViewBase, xrpl::detail::CachedViewImpl, xrpl::Ledger, and xrpl::OpenView.

Member Data Documentation

◆ sles

SlesType xrpl::ReadView::sles
inherited

Iterable range of ledger state items.

Note
Visiting each state entry in the ledger can become quite expensive as the ledger grows.

Definition at line 239 of file ReadView.h.

◆ txs

TxsType xrpl::ReadView::txs
inherited

Definition at line 242 of file ReadView.h.