1#include <xrpl/basics/contract.h>
2#include <xrpl/ledger/OpenView.h>
25 equal(base_type
const& impl)
const override
28 return iter_ == p->iter_;
60 , monotonic_resource_{
std::make_unique<
61 boost::container::pmr::monotonic_buffer_resource>(initialBufferSize)}
62 , txs_{rhs.txs_, monotonic_resource_.
get()}
68 , open_{rhs.open_} {};
75 : monotonic_resource_{
std::make_unique<
76 boost::container::pmr::monotonic_buffer_resource>(initialBufferSize)}
77 , txs_{monotonic_resource_.
get()}
81 , hold_(
std::move(hold))
91 : monotonic_resource_{
std::make_unique<
92 boost::container::pmr::monotonic_buffer_resource>(initialBufferSize)}
93 , txs_{monotonic_resource_.
get()}
94 , rules_(base->rules())
97 , hold_(
std::move(hold))
112 for (
auto const& item :
txs_)
113 to.
rawTxInsert(item.first, item.second.txn, item.second.meta);
146 return items_.succ(*base_, key, last);
171 return items_.slesUpperBound(*base_, key);
195 auto const iter = txs_.find(key);
196 if (iter == txs_.end())
197 return base_->txRead(key);
198 auto const& item = iter->
second;
200 decltype(tx_type::second) sto;
206 return {std::move(stx), std::move(sto)};
void increment() override
std::unique_ptr< base_type > copy() const override
txs_iter_impl(bool metadata, txs_map::const_iterator iter)
bool equal(base_type const &impl) const override
value_type dereference() const override
txs_map::const_iterator iter_
Writable ledger view that accumulates state and tx changes.
std::size_t txCount() const
Return the number of tx inserted since creation.
std::unique_ptr< sles_type::iter_base > slesUpperBound(uint256 const &key) const override
tx_type txRead(key_type const &key) const override
Read a transaction from the tx map.
bool txExists(key_type const &key) const override
Returns true if a tx exists in the tx map.
LedgerInfo const & info() const override
Returns information about the ledger.
std::unique_ptr< sles_type::iter_base > slesEnd() const override
detail::RawStateTable items_
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.
void rawDestroyXRP(XRPAmount const &fee) override
Destroy XRP.
bool exists(Keylet const &k) const override
Determine if a state item exists.
Rules const & rules() const override
Returns the tx processing rules.
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 > slesBegin() const override
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.
void rawErase(std::shared_ptr< SLE > const &sle) override
Delete an existing state item.
std::size_t baseTxCount_
In batch mode, the number of transactions already executed.
void rawReplace(std::shared_ptr< SLE > const &sle) override
Unconditionally replace a state item.
void rawInsert(std::shared_ptr< SLE > const &sle) override
Unconditionally insert a state item.
bool open() const override
Returns true if this reflects an open ledger.
std::unique_ptr< txs_type::iter_base > txsBegin() const override
Fees const & fees() const override
Returns the fees for the base ledger.
void apply(TxsRawView &to) const
Apply changes.
std::unique_ptr< txs_type::iter_base > txsEnd() const override
virtual Fees const & fees() const =0
Returns the fees for the base ledger.
virtual LedgerInfo const & info() const =0
Returns information about the ledger.
Rules controlling protocol behavior.
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.
void destroyXRP(XRPAmount const &fee)
bool exists(ReadView const &base, Keylet const &k) const
void apply(RawView &to) const
void insert(std::shared_ptr< SLE > const &sle)
void erase(std::shared_ptr< SLE > const &sle)
std::shared_ptr< SLE const > read(ReadView const &base, Keylet const &k) const
std::unique_ptr< ReadView::sles_type::iter_base > slesBegin(ReadView const &base) const
void replace(std::shared_ptr< SLE > const &sle)
std::unique_ptr< ReadView::sles_type::iter_base > slesEnd(ReadView const &base) const
T forward_as_tuple(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
@ open
We haven't closed our ledger yet, but others might have.
std::string to_string(base_uint< Bits, Tag > const &a)
T get(Section const §ion, std::string const &name, T const &defaultValue=T{})
Retrieve a key/value pair from a section.
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Reflects the fee settings for a particular ledger.
A pair of SHAMap key and LedgerEntryType.
Open ledger construction tag.