xrpld
Loading...
Searching...
No Matches
ApplyViewBase.h
1#pragma once
2
3#include <xrpl/ledger/ApplyView.h>
4#include <xrpl/ledger/ReadView.h>
5#include <xrpl/ledger/detail/ApplyStateTable.h>
6#include <xrpl/protocol/XRPAmount.h>
7
8namespace xrpl::detail {
9
10class ApplyViewBase : public ApplyView, public RawView
11{
12public:
13 ApplyViewBase() = delete;
14 ApplyViewBase(ApplyViewBase const&) = delete;
18 operator=(ApplyViewBase const&) = delete;
19
21
23
24 // ReadView
25 [[nodiscard]] bool
26 open() const override;
27
28 [[nodiscard]] LedgerHeader const&
29 header() const override;
30
31 [[nodiscard]] Fees const&
32 fees() const override;
33
34 [[nodiscard]] Rules const&
35 rules() const override;
36
37 [[nodiscard]] bool
38 exists(Keylet const& k) const override;
39
40 [[nodiscard]] std::optional<key_type>
41 succ(key_type const& key, std::optional<key_type> const& last = std::nullopt) const override;
42
43 [[nodiscard]] SLE::const_pointer
44 read(Keylet const& k) const override;
45
47 slesBegin() const override;
48
50 slesEnd() const override;
51
53 slesUpperBound(uint256 const& key) const override;
54
56 txsBegin() const override;
57
59 txsEnd() const override;
60
61 [[nodiscard]] bool
62 txExists(key_type const& key) const override;
63
64 [[nodiscard]] tx_type
65 txRead(key_type const& key) const override;
66
67 // ApplyView
68
69 [[nodiscard]] ApplyFlags
70 flags() const override;
71
73 peek(Keylet const& k) override;
74
75 void
76 erase(SLE::ref sle) override;
77
78 void
79 insert(SLE::ref sle) override;
80
81 void
82 update(SLE::ref sle) override;
83
84 // RawView
85
86 void
87 rawErase(SLE::ref sle) override;
88
89 void
90 rawInsert(SLE::ref sle) override;
91
92 void
93 rawReplace(SLE::ref sle) override;
94
95 void
96 rawDestroyXRP(XRPAmount const& feeDrops) override;
97
98protected:
102};
103
104} // namespace xrpl::detail
ApplyView()=default
RawView()=default
std::pair< std::shared_ptr< STTx const >, std::shared_ptr< STObject const > > tx_type
Definition ReadView.h:33
uint256 key_type
Definition ReadView.h:35
Rules controlling protocol behavior.
Definition Rules.h:33
std::shared_ptr< STLedgerEntry > const & ref
std::shared_ptr< STLedgerEntry > pointer
std::shared_ptr< STLedgerEntry const > const_pointer
void rawDestroyXRP(XRPAmount const &feeDrops) override
Destroy XRP.
void insert(SLE::ref sle) override
Insert a new state SLE.
ApplyFlags flags() const override
Returns the tx apply flags.
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 > slesEnd() const override
SLE::pointer peek(Keylet const &k) override
Prepare to modify the SLE associated with key.
void rawInsert(SLE::ref sle) override
Unconditionally insert a state item.
void update(SLE::ref sle) override
Indicate changes to a peeked SLE.
std::unique_ptr< TxsType::iter_base > txsBegin() const override
bool open() const override
Returns true if this reflects an open ledger.
void rawReplace(SLE::ref sle) override
Unconditionally replace a state item.
LedgerHeader const & header() const override
Returns information about the ledger.
ApplyViewBase & operator=(ApplyViewBase const &)=delete
SLE::const_pointer read(Keylet const &k) const override
Return the state item associated with a key.
ApplyViewBase(ApplyViewBase &&)=default
void erase(SLE::ref sle) override
Remove a peeked SLE.
Rules const & rules() const override
Returns the tx processing rules.
detail::ApplyStateTable items_
std::unique_ptr< SlesType::iter_base > slesBegin() const override
std::unique_ptr< SlesType::iter_base > slesUpperBound(uint256 const &key) const override
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
bool txExists(key_type const &key) const override
Returns true if a tx exists in the tx map.
void rawErase(SLE::ref sle) override
Delete an existing state item.
ApplyViewBase(ApplyViewBase const &)=delete
bool exists(Keylet const &k) const override
Determine if a state item exists.
ApplyViewBase & operator=(ApplyViewBase &&)=delete
ApplyFlags
Definition ApplyView.h:12
BaseUInt< 256 > uint256
Definition base_uint.h:562
Reflects the fee settings for a particular ledger.
A pair of SHAMap key and LedgerEntryType.
Definition Keylet.h:19
Information about the notional ledger backing the view.