rippled
Public Types | Public Member Functions | Public Attributes | List of all members
ripple::DigestAwareReadView Class Referenceabstract

ReadView that associates keys with digests. More...

Inheritance diagram for ripple::DigestAwareReadView:
Inheritance graph
[legend]
Collaboration diagram for ripple::DigestAwareReadView:
Collaboration graph
[legend]

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 = std::shared_ptr< SLE const >
 

Public Member Functions

 DigestAwareReadView ()=default
 
 DigestAwareReadView (const DigestAwareReadView &)=default
 
virtual std::optional< digest_typedigest (key_type const &key) const =0
 Return the digest associated with the key. More...
 
virtual LedgerInfo const & info () const =0
 Returns information about the ledger. More...
 
virtual bool open () const =0
 Returns true if this reflects an open ledger. More...
 
NetClock::time_point parentCloseTime () const
 Returns the close time of the previous ledger. More...
 
LedgerIndex seq () const
 Returns the sequence number of the base ledger. More...
 
virtual Fees const & fees () const =0
 Returns the fees for the base ledger. More...
 
virtual Rules const & rules () const =0
 Returns the tx processing rules. More...
 
virtual bool exists (Keylet const &k) const =0
 Determine if a state item exists. More...
 
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. More...
 
virtual std::shared_ptr< SLE const > read (Keylet const &k) const =0
 Return the state item associated with a key. More...
 
virtual STAmount balanceHook (AccountID const &account, AccountID const &issuer, STAmount const &amount) const
 
virtual std::uint32_t ownerCountHook (AccountID const &account, std::uint32_t count) const
 
virtual std::unique_ptr< sles_type::iter_baseslesBegin () const =0
 
virtual std::unique_ptr< sles_type::iter_baseslesEnd () const =0
 
virtual std::unique_ptr< sles_type::iter_baseslesUpperBound (key_type const &key) const =0
 
virtual std::unique_ptr< txs_type::iter_basetxsBegin () const =0
 
virtual std::unique_ptr< txs_type::iter_basetxsEnd () const =0
 
virtual bool txExists (key_type const &key) const =0
 Returns true if a tx exists in the tx map. More...
 
virtual tx_type txRead (key_type const &key) const =0
 Read a transaction from the tx map. More...
 

Public Attributes

sles_type sles
 Iterable range of ledger state items. More...
 
txs_type txs
 

Detailed Description

ReadView that associates keys with digests.

Definition at line 329 of file ReadView.h.

Member Typedef Documentation

◆ digest_type

Definition at line 332 of file ReadView.h.

◆ tx_type

Definition at line 129 of file ReadView.h.

◆ key_type

Definition at line 131 of file ReadView.h.

◆ mapped_type

Definition at line 133 of file ReadView.h.

Constructor & Destructor Documentation

◆ DigestAwareReadView() [1/2]

ripple::DigestAwareReadView::DigestAwareReadView ( )
default

◆ DigestAwareReadView() [2/2]

ripple::DigestAwareReadView::DigestAwareReadView ( const DigestAwareReadView )
default

Member Function Documentation

◆ digest()

virtual std::optional<digest_type> ripple::DigestAwareReadView::digest ( key_type const &  key) const
pure virtual

Return the digest associated with the key.

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

Implemented in ripple::Ledger.

◆ info()

virtual LedgerInfo const& ripple::ReadView::info ( ) const
pure virtualinherited

Returns information about the ledger.

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

◆ open()

virtual bool ripple::ReadView::open ( ) const
pure virtualinherited

Returns true if this reflects an open ledger.

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

◆ parentCloseTime()

NetClock::time_point ripple::ReadView::parentCloseTime ( ) const
inherited

Returns the close time of the previous ledger.

Definition at line 186 of file ReadView.h.

◆ seq()

LedgerIndex ripple::ReadView::seq ( ) const
inherited

Returns the sequence number of the base ledger.

Definition at line 193 of file ReadView.h.

◆ fees()

virtual Fees const& ripple::ReadView::fees ( ) const
pure virtualinherited

Returns the fees for the base ledger.

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

◆ rules()

virtual Rules const& ripple::ReadView::rules ( ) const
pure virtualinherited

Returns the tx processing rules.

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

◆ exists()

virtual bool ripple::ReadView::exists ( Keylet const &  k) const
pure 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 ripple::OpenView, ripple::Ledger, ripple::detail::CachedViewImpl, and ripple::detail::ApplyViewBase.

◆ succ()

virtual std::optional<key_type> ripple::ReadView::succ ( key_type const &  key,
std::optional< key_type > const &  last = std::nullopt 
) const
pure 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 ripple::Ledger, ripple::OpenView, and ripple::detail::ApplyViewBase.

◆ read()

virtual std::shared_ptr<SLE const> ripple::ReadView::read ( Keylet const &  k) const
pure 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 ripple::OpenView, ripple::Ledger, ripple::detail::ApplyViewBase, and ripple::detail::CachedViewImpl.

◆ balanceHook()

virtual STAmount ripple::ReadView::balanceHook ( AccountID const &  account,
AccountID const &  issuer,
STAmount const &  amount 
) const
virtualinherited

Reimplemented in ripple::PaymentSandbox.

Definition at line 253 of file ReadView.h.

◆ ownerCountHook()

virtual std::uint32_t ripple::ReadView::ownerCountHook ( AccountID const &  account,
std::uint32_t  count 
) const
virtualinherited

Reimplemented in ripple::PaymentSandbox.

Definition at line 267 of file ReadView.h.

◆ slesBegin()

virtual std::unique_ptr<sles_type::iter_base> ripple::ReadView::slesBegin ( ) const
pure virtualinherited

◆ slesEnd()

virtual std::unique_ptr<sles_type::iter_base> ripple::ReadView::slesEnd ( ) const
pure virtualinherited

◆ slesUpperBound()

virtual std::unique_ptr<sles_type::iter_base> ripple::ReadView::slesUpperBound ( key_type const &  key) const
pure virtualinherited

◆ txsBegin()

virtual std::unique_ptr<txs_type::iter_base> ripple::ReadView::txsBegin ( ) const
pure virtualinherited

◆ txsEnd()

virtual std::unique_ptr<txs_type::iter_base> ripple::ReadView::txsEnd ( ) const
pure virtualinherited

◆ txExists()

virtual bool ripple::ReadView::txExists ( key_type const &  key) const
pure 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 ripple::Ledger, ripple::OpenView, and ripple::detail::ApplyViewBase.

◆ txRead()

virtual tx_type ripple::ReadView::txRead ( key_type const &  key) const
pure 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 ripple::OpenView, ripple::Ledger, and ripple::detail::ApplyViewBase.

Member Data Documentation

◆ sles

sles_type ripple::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 320 of file ReadView.h.

◆ txs

txs_type ripple::ReadView::txs
inherited

Definition at line 323 of file ReadView.h.