1#include <xrpl/basics/contract.h>
2#include <xrpl/ledger/detail/RawStateTable.h>
21 items_t::const_iterator iter1,
22 items_t::const_iterator end1,
49 "ripple::detail::RawStateTable::equal : matching end "
62 "ripple::detail::RawStateTable::increment : either SLE is "
148 for (
auto const& elem :
items_)
150 auto const& item = elem.second;
171 "ripple::detail::RawStateTable::exists : nonzero key");
175 auto const& item = iter->second;
178 if (!k.
check(*item.sle))
194 items_t::const_iterator iter;
199 next = base.succ(*next, last);
202 iter = items_.find(*next);
203 }
while (iter != items_.end() && iter->second.action == Action::erase);
205 for (iter = items_.upper_bound(key); iter != items_.end(); ++iter)
207 if (iter->second.action != Action::erase)
210 if (!next || next > iter->first)
217 if (last && next >= last)
232 auto& item = result.first->second;
236 LogicError(
"RawStateTable::erase: already erased");
257 auto& item = result.first->second;
265 LogicError(
"RawStateTable::insert: already inserted");
268 LogicError(
"RawStateTable::insert: already exists");
282 auto& item = result.first->second;
286 LogicError(
"RawStateTable::replace: was erased");
301 auto const& item = iter->second;
Interface for ledger entry changes.
virtual void rawInsert(std::shared_ptr< SLE > const &sle)=0
Unconditionally insert a state item.
virtual void rawDestroyXRP(XRPAmount const &fee)=0
Destroy XRP.
virtual void rawReplace(std::shared_ptr< SLE > const &sle)=0
Unconditionally replace a state item.
virtual void rawErase(std::shared_ptr< SLE > const &sle)=0
Delete an existing state item.
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
virtual bool exists(Keylet const &k) const =0
Determine if a state item exists.
sles_type sles
Iterable range of ledger state items.
sles_iter_impl(items_t::const_iterator iter1, items_t::const_iterator end1, ReadView::sles_type::iterator iter0, ReadView::sles_type::iterator end0)
ReadView::sles_type::iterator end0_
std::shared_ptr< SLE const > sle1_
value_type dereference() const override
sles_iter_impl(sles_iter_impl const &)=default
items_t::const_iterator iter1_
void increment() override
std::unique_ptr< base_type > copy() const override
items_t::const_iterator end1_
bool equal(base_type const &impl) const override
std::shared_ptr< SLE const > sle0_
ReadView::sles_type::iterator iter0_
std::optional< key_type > succ(ReadView const &base, key_type const &key, std::optional< key_type > const &last) const
void destroyXRP(XRPAmount const &fee)
XRPAmount dropsDestroyed_
bool exists(ReadView const &base, Keylet const &k) const
void apply(RawView &to) const
std::unique_ptr< ReadView::sles_type::iter_base > slesUpperBound(ReadView const &base, uint256 const &key) const
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
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.
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
A pair of SHAMap key and LedgerEntryType.
bool check(STLedgerEntry const &) const
Returns true if the SLE matches the type.
iterator upper_bound(key_type const &key) const