|
xrpld
|
Writable ledger view that accumulates state and tx changes. More...
#include <OpenView.h>


Classes | |
| struct | TxData |
| class | TxsIterImpl |
Public Types | |
| using | TxType = 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 | |
| OpenView ()=delete | |
| OpenView & | operator= (OpenView &&)=delete |
| OpenView & | operator= (OpenView const &)=delete |
| OpenView (OpenView &&)=default | |
| OpenView (OpenView const &) | |
| Construct a shallow copy. | |
| OpenView (OpenLedgerT, ReadView const *base, Rules rules, std::shared_ptr< void const > hold=nullptr) | |
| Construct an open ledger view. | |
| OpenView (OpenLedgerT, Rules const &rules, std::shared_ptr< ReadView const > const &base) | |
| OpenView (BatchViewT, OpenView &base) | |
| OpenView (ReadView const *base, std::shared_ptr< void const > hold=nullptr) | |
| Construct a new last closed ledger. | |
| bool | open () const override |
| Returns true if this reflects an open ledger. | |
| std::size_t | txCount () const |
| Return the number of tx inserted since creation. | |
| void | apply (TxsRawView &to) const |
| Apply changes. | |
| LedgerHeader const & | header () const override |
| Returns information about the ledger. | |
| Fees const & | fees () const override |
| Returns the fees for the base ledger. | |
| Rules const & | rules () const override |
| Returns the tx processing rules. | |
| bool | exists (Keylet const &k) const override |
| Determine if a state item exists. | |
| std::optional< key_type > | succ (key_type const &key, std::optional< key_type > const &last=std::nullopt) const override |
| Return the key of the next state item. | |
| SLE::const_pointer | read (Keylet const &k) const override |
| Return the state item associated with a key. | |
| std::unique_ptr< SlesType::IterBase > | slesBegin () const override |
| std::unique_ptr< SlesType::IterBase > | slesEnd () const override |
| std::unique_ptr< SlesType::IterBase > | slesUpperBound (UInt256 const &key) const override |
| std::unique_ptr< TxsType::IterBase > | txsBegin () const override |
| std::unique_ptr< TxsType::IterBase > | txsEnd () const override |
| bool | txExists (key_type const &key) const override |
| Returns true if a tx exists in the tx map. | |
| TxType | txRead (key_type const &key) const override |
| Read a transaction from the tx map. | |
| void | rawErase (SLE::Ref sle) override |
| Delete an existing state item. | |
| void | rawInsert (SLE::Ref sle) override |
| Unconditionally insert a state item. | |
| void | rawReplace (SLE::Ref sle) override |
| Unconditionally replace a state item. | |
| void | rawDestroyXRP (XRPAmount const &fee) override |
| Destroy XRP. | |
| void | rawTxInsert (key_type const &key, std::shared_ptr< Serializer const > const &txn, std::shared_ptr< Serializer const > const &metaData) override |
| Add a transaction to the tx map. | |
| 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 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 OwnerCounts | ownerCountHook (AccountID const &account, OwnerCounts const &count) const |
| virtual std::unique_ptr< SlesType::IterBase > | slesUpperBound (key_type const &key) const =0 |
Public Attributes | |
| SlesType | sles |
| Iterable range of ledger state items. | |
| TxsType | txs |
Private Types | |
| using | TxsMap |
Private Attributes | |
| std::unique_ptr< boost::container::pmr::monotonic_buffer_resource > | monotonicResource_ |
| TxsMap | txs_ |
| Rules | rules_ |
| LedgerHeader | header_ |
| ReadView const * | base_ |
| detail::RawStateTable | items_ |
| std::shared_ptr< void const > | hold_ |
| std::size_t | baseTxCount_ = 0 |
| In batch mode, the number of transactions already executed. | |
| bool | open_ = true |
Static Private Attributes | |
| static constexpr size_t | kInitialBufferSize = kilobytes(256) |
Writable ledger view that accumulates state and tx changes.
Definition at line 58 of file OpenView.h.
|
private |
Definition at line 85 of file OpenView.h.
|
inherited |
Definition at line 43 of file ReadView.h.
|
inherited |
Definition at line 45 of file ReadView.h.
|
inherited |
Definition at line 47 of file ReadView.h.
|
delete |
|
default |
| xrpl::OpenView::OpenView | ( | OpenView const & | rhs | ) |
Construct a shallow copy.
Effects:
Creates a new object with a copy of the modification state table.
The objects managed by shared pointers are not duplicated but shared between instances. Since the SLEs are immutable, calls on the RawView interface cannot break invariants.
Definition at line 79 of file OpenView.cpp.
| xrpl::OpenView::OpenView | ( | OpenLedgerT | , |
| ReadView const * | base, | ||
| Rules | rules, | ||
| std::shared_ptr< void const > | hold = nullptr ) |
Construct an open ledger view.
Effects:
The sequence number is set to the sequence number of parent plus one. The parentCloseTime is set to the closeTime of parent. If `hold` is not nullptr, retains ownership of a copy of `hold` until the MetaView is destroyed. Calls to rules() will return the rules provided on construction.
The tx list starts empty and will contain all newly inserted tx.
Definition at line 92 of file OpenView.cpp.
| xrpl::OpenView::OpenView | ( | OpenLedgerT | , |
| Rules const & | rules, | ||
| std::shared_ptr< ReadView const > const & | base ) |
Definition at line 159 of file OpenView.h.
| xrpl::OpenView::OpenView | ( | BatchViewT | , |
| OpenView & | base ) |
Definition at line 164 of file OpenView.h.
| xrpl::OpenView::OpenView | ( | ReadView const * | base, |
| std::shared_ptr< void const > | hold = nullptr ) |
Construct a new last closed ledger.
Effects:
The LedgerHeader is copied from the base. The rules are inherited from the base.
The tx list starts empty and will contain all newly inserted tx.
Definition at line 108 of file OpenView.cpp.
|
overridevirtual |
Returns true if this reflects an open ledger.
Implements xrpl::ReadView.
Definition at line 187 of file OpenView.h.
| std::size_t xrpl::OpenView::txCount | ( | ) | const |
Return the number of tx inserted since creation.
This is used to set the "apply ordinal" when calculating transaction metadata.
Definition at line 121 of file OpenView.cpp.
| void xrpl::OpenView::apply | ( | TxsRawView & | to | ) | const |
Apply changes.
Definition at line 127 of file OpenView.cpp.
|
overridevirtual |
Returns information about the ledger.
Implements xrpl::ReadView.
Definition at line 137 of file OpenView.cpp.
|
overridevirtual |
Returns the fees for the base ledger.
Implements xrpl::ReadView.
Definition at line 143 of file OpenView.cpp.
|
overridevirtual |
Returns the tx processing rules.
Implements xrpl::ReadView.
Definition at line 149 of file OpenView.cpp.
|
overridevirtual |
Determine if a state item exists.
Implements xrpl::ReadView.
Definition at line 155 of file OpenView.cpp.
|
overridevirtual |
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).
Implements xrpl::ReadView.
Definition at line 161 of file OpenView.cpp.
|
overridevirtual |
Return the state item associated with a key.
Effects: If the key exists, gives the caller ownership of the non-modifiable corresponding SLE.
Implements xrpl::ReadView.
Definition at line 168 of file OpenView.cpp.
|
overridevirtual |
Implements xrpl::ReadView.
Definition at line 174 of file OpenView.cpp.
|
overridevirtual |
Implements xrpl::ReadView.
Definition at line 180 of file OpenView.cpp.
|
override |
Definition at line 186 of file OpenView.cpp.
|
overridevirtual |
Implements xrpl::ReadView.
Definition at line 192 of file OpenView.cpp.
|
overridevirtual |
Implements xrpl::ReadView.
Definition at line 198 of file OpenView.cpp.
|
overridevirtual |
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.
Implements xrpl::ReadView.
Definition at line 204 of file OpenView.cpp.
|
overridevirtual |
Read a transaction from the tx map.
If the view represents an open ledger, the metadata object will be empty.
Implements xrpl::ReadView.
Definition at line 210 of file OpenView.cpp.
|
overridevirtual |
Delete an existing state item.
The SLE is provided so the implementation can calculate metadata.
Implements xrpl::RawView.
Definition at line 232 of file OpenView.cpp.
|
overridevirtual |
Unconditionally insert a state item.
Requirements: The key must not already exist.
Effects:
The key is associated with the SLE.
Implements xrpl::RawView.
Definition at line 238 of file OpenView.cpp.
|
overridevirtual |
Unconditionally replace a state item.
Requirements:
The key must exist.
Effects:
The key is associated with the SLE.
Implements xrpl::RawView.
Definition at line 244 of file OpenView.cpp.
|
overridevirtual |
Destroy XRP.
This is used to pay for transaction fees.
Implements xrpl::RawView.
Definition at line 250 of file OpenView.cpp.
|
overridevirtual |
Add a transaction to the tx map.
Closed ledgers must have metadata, while open ledgers omit metadata.
Implements xrpl::TxsRawView.
Definition at line 260 of file OpenView.cpp.
|
nodiscardinherited |
Returns the close time of the previous ledger.
Definition at line 106 of file ReadView.h.
|
nodiscardinherited |
Returns the sequence number of the base ledger.
Definition at line 115 of file ReadView.h.
|
nodiscardvirtualinherited |
Reimplemented in xrpl::PaymentSandbox.
Definition at line 180 of file ReadView.h.
|
nodiscardvirtualinherited |
Reimplemented in xrpl::PaymentSandbox.
Definition at line 190 of file ReadView.h.
|
nodiscardvirtualinherited |
Reimplemented in xrpl::PaymentSandbox.
Definition at line 200 of file ReadView.h.
|
nodiscardvirtualinherited |
Reimplemented in xrpl::PaymentSandbox.
Definition at line 211 of file ReadView.h.
|
nodiscardpure virtualinherited |
|
staticconstexprprivate |
Definition at line 64 of file OpenView.h.
|
private |
Definition at line 93 of file OpenView.h.
|
private |
Definition at line 94 of file OpenView.h.
|
private |
Definition at line 95 of file OpenView.h.
|
private |
Definition at line 96 of file OpenView.h.
|
private |
Definition at line 97 of file OpenView.h.
|
private |
Definition at line 98 of file OpenView.h.
|
private |
Definition at line 99 of file OpenView.h.
|
private |
In batch mode, the number of transactions already executed.
Definition at line 104 of file OpenView.h.
|
private |
Definition at line 106 of file OpenView.h.
|
inherited |
Iterable range of ledger state items.
Definition at line 267 of file ReadView.h.
|
inherited |
Definition at line 270 of file ReadView.h.