20 #include <ripple/basics/contract.h>
21 #include <ripple/ledger/OpenView.h>
46 equal(base_type
const& impl)
const override
49 return iter_ == p->iter_;
65 result.first = std::make_shared<STTx const>(sit);
70 result.second = std::make_shared<STObject const>(sit,
sfMetadata);
83 , txs_{rhs.txs_, monotonic_resource_.get()}
89 , open_{rhs.open_} {};
98 , txs_{monotonic_resource_.get()}
100 , info_(base->info())
102 , hold_(std::move(hold))
104 info_.validated =
false;
105 info_.accepted =
false;
106 info_.seq = base_->info().seq + 1;
107 info_.parentCloseTime = base_->info().closeTime;
108 info_.parentHash = base_->info().hash;
114 , txs_{monotonic_resource_.get()}
115 , rules_(base->rules())
116 , info_(base->info())
118 , hold_(std::move(hold))
119 , open_(base->open())
133 for (
auto const& item :
txs_)
134 to.
rawTxInsert(item.first, item.second.txn, item.second.meta);
167 return items_.succ(*base_, key, last);
192 return items_.slesUpperBound(*base_, key);
204 return std::make_unique<txs_iter_impl>(!
open(),
txs_.
cend());
216 auto const iter = txs_.find(key);
217 if (iter == txs_.end())
218 return base_->txRead(key);
219 auto const& item = iter->
second;
220 auto stx = std::make_shared<STTx const>(
SerialIter{item.txn->slice()});
221 decltype(tx_type::second) sto;
223 sto = std::make_shared<STObject const>(
227 return {std::move(stx), std::move(sto)};
267 std::piecewise_construct,
std::size_t txCount() const
Return the number of tx inserted since creation.
A pair of SHAMap key and LedgerEntryType.
bool equal(base_type const &impl) const override
LedgerInfo const & info() const override
Returns information about the ledger.
const open_ledger_t open_ledger
void apply(TxsRawView &to) const
Apply changes.
Writable ledger view that accumulates state and tx changes.
void rawErase(std::shared_ptr< SLE > const &sle) override
Delete an existing state item.
virtual Fees const & fees() const =0
Returns the fees for the base ledger.
bool exists(Keylet const &k) const override
Determine if a state item exists.
std::unique_ptr< sles_type::iter_base > slesUpperBound(uint256 const &key) const override
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::shared_ptr< SLE const > read(ReadView const &base, Keylet const &k) const
detail::RawStateTable items_
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< txs_type::iter_base > txsEnd() const override
bool txExists(key_type const &key) const override
Returns true if a tx exists in the tx map.
Reflects the fee settings for a particular ledger.
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 rawReplace(std::shared_ptr< SLE > const &sle) override
Unconditionally replace a state item.
bool open() const override
Returns true if this reflects an open ledger.
std::unique_ptr< base_type > copy() const override
void increment() override
std::unique_ptr< ReadView::sles_type::iter_base > slesBegin(ReadView const &base) const
T forward_as_tuple(T... args)
void erase(std::shared_ptr< SLE > const &sle)
bool exists(ReadView const &base, Keylet const &k) const
void rawInsert(std::shared_ptr< SLE > const &sle) override
Unconditionally insert a state item.
Open ledger construction tag.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
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 apply(RawView &to) const
std::unique_ptr< txs_type::iter_base > txsBegin() const override
void destroyXRP(XRPAmount const &fee)
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
void insert(std::shared_ptr< SLE > const &sle)
txs_iter_impl(bool metadata, txs_map::const_iterator iter)
value_type dereference() const override
Rules controlling protocol behavior.
void rawDestroyXRP(XRPAmount const &fee) override
Destroy XRP.
std::shared_ptr< SLE const > read(Keylet const &k) const override
Return the state item associated with a key.
void replace(std::shared_ptr< SLE > const &sle)
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
std::unique_ptr< sles_type::iter_base > slesEnd() const override
Information about the notional ledger backing the view.
static constexpr size_t initialBufferSize
Interface for changing ledger entries with transactions.
std::unique_ptr< ReadView::sles_type::iter_base > slesEnd(ReadView const &base) const
std::unique_ptr< sles_type::iter_base > slesBegin() const override
txs_map::const_iterator iter_
Rules const & rules() const override
Returns the tx processing rules.