1#include <xrpl/ledger/OpenView.h>
3#include <xrpl/basics/base_uint.h>
4#include <xrpl/basics/contract.h>
5#include <xrpl/ledger/RawView.h>
6#include <xrpl/ledger/ReadView.h>
7#include <xrpl/protocol/Fees.h>
8#include <xrpl/protocol/Keylet.h>
9#include <xrpl/protocol/SField.h>
10#include <xrpl/protocol/STLedgerEntry.h>
11#include <xrpl/protocol/STObject.h>
12#include <xrpl/protocol/STTx.h>
13#include <xrpl/protocol/Serializer.h>
14#include <xrpl/protocol/XRPAmount.h>
16#include <boost/container/pmr/monotonic_buffer_resource.hpp>
34 explicit TxsIterImpl(
bool metadata, txs_map::const_iterator iter)
46 equal(base_type
const& impl)
const override
48 if (
auto const p =
dynamic_cast<TxsIterImpl const*
>(&impl))
49 return iter_ == p->iter_;
59 [[nodiscard]] value_type
129 for (
auto const& item :
txs_)
130 to.
rawTxInsert(item.first, item.second.txn, item.second.meta);
144 return base_->fees();
205 return txs_.contains(key);
211 auto const iter =
txs_.find(key);
212 if (iter ==
txs_.end())
213 return base_->txRead(key);
214 auto const& item = iter->second;
225 return {std::move(stx), std::move(sto)};
264 auto const result =
txs_.emplace(
TxsIterImpl(bool metadata, txs_map::const_iterator iter)
txs_map::const_iterator iter_
std::unique_ptr< base_type > copy() const override
bool equal(base_type const &impl) const override
void increment() override
value_type dereference() const override
static constexpr size_t kInitialBufferSize
void rawDestroyXRP(XRPAmount const &fee) override
Destroy XRP.
std::size_t txCount() const
Return the number of tx inserted since creation.
tx_type txRead(key_type const &key) const override
Read a transaction from the tx map.
Fees const & fees() const override
Returns the fees for the base ledger.
std::unique_ptr< TxsType::iter_base > txsEnd() const override
void rawInsert(SLE::ref sle) override
Unconditionally insert a state item.
std::size_t baseTxCount_
In batch mode, the number of transactions already executed.
bool txExists(key_type const &key) const override
Returns true if a tx exists in the tx map.
std::shared_ptr< void const > hold_
bool open() const override
Returns true if this reflects an open ledger.
std::unique_ptr< SlesType::iter_base > slesBegin() const override
SLE::const_pointer read(Keylet const &k) const override
Return the state item associated with a key.
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.
std::unique_ptr< SlesType::iter_base > slesUpperBound(uint256 const &key) const override
void rawErase(SLE::ref sle) override
Delete an existing state item.
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.
LedgerHeader const & header() const override
Returns information about the ledger.
void apply(TxsRawView &to) const
Apply changes.
Rules const & rules() const override
Returns the tx processing rules.
bool exists(Keylet const &k) const override
Determine if a state item exists.
std::unique_ptr< TxsType::iter_base > txsBegin() const override
std::unique_ptr< boost::container::pmr::monotonic_buffer_resource > monotonicResource_
std::unique_ptr< SlesType::iter_base > slesEnd() const override
detail::RawStateTable items_
void rawReplace(SLE::ref sle) override
Unconditionally replace a state item.
std::pair< std::shared_ptr< STTx const >, std::shared_ptr< STObject const > > tx_type
LedgerIndex seq() const
Returns the sequence number of the base ledger.
Rules controlling protocol behavior.
std::shared_ptr< STLedgerEntry > const & ref
std::shared_ptr< STLedgerEntry const > const_pointer
Interface for changing ledger entries with transactions.
virtual void rawTxInsert(ReadView::key_type const &key, std::shared_ptr< Serializer const > const &txn, std::shared_ptr< Serializer const > const &metaData)=0
Add a transaction to the tx map.
T forward_as_tuple(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
T get(Section const §ion, std::string const &name, T const &defaultValue=T{})
Retrieve a key/value pair from a section.
std::string to_string(BaseUInt< Bits, Tag > const &a)
XRPL_NO_SANITIZE_ADDRESS void Throw(Args &&... args)
Reflects the fee settings for a particular ledger.
A pair of SHAMap key and LedgerEntryType.
Open ledger construction tag.