20#include <xrpld/ledger/detail/RawStateTable.h>
22#include <xrpl/basics/contract.h>
41 items_t::const_iterator iter1,
42 items_t::const_iterator end1,
59 return std::make_unique<sles_iter_impl>(*
this);
69 "ripple::detail::RawStateTable::equal : matching end "
82 "ripple::detail::RawStateTable::increment : either SLE is "
168 for (
auto const& elem :
items_)
170 auto const& item = elem.second;
191 "ripple::detail::RawStateTable::exists : nonzero key");
195 auto const& item = iter->second;
198 if (!k.
check(*item.sle))
214 items_t::const_iterator iter;
219 next = base.succ(*next, last);
222 iter = items_.find(*next);
223 }
while (iter != items_.end() && iter->second.action == Action::erase);
225 for (iter = items_.upper_bound(key); iter != items_.end(); ++iter)
227 if (iter->second.action != Action::erase)
230 if (!next || next > iter->first)
237 if (last && next >= last)
247 std::piecewise_construct,
252 auto& item = result.first->second;
256 LogicError(
"RawStateTable::erase: already erased");
272 std::piecewise_construct,
277 auto& item = result.first->second;
285 LogicError(
"RawStateTable::insert: already inserted");
288 LogicError(
"RawStateTable::insert: already exists");
297 std::piecewise_construct,
302 auto& item = result.first->second;
306 LogicError(
"RawStateTable::replace: was erased");
321 auto const& item = iter->second;
340 return std::make_unique<sles_iter_impl>(
347 return std::make_unique<sles_iter_impl>(
354 return std::make_unique<sles_iter_impl>(
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