rippled
Loading...
Searching...
No Matches
ApplyViewBase.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012, 2013 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#ifndef RIPPLE_LEDGER_APPLYVIEWBASE_H_INCLUDED
21#define RIPPLE_LEDGER_APPLYVIEWBASE_H_INCLUDED
22
23#include <xrpld/ledger/ApplyView.h>
24#include <xrpld/ledger/ReadView.h>
25#include <xrpld/ledger/detail/ApplyStateTable.h>
26
27#include <xrpl/protocol/XRPAmount.h>
28
29namespace ripple {
30namespace detail {
31
32class ApplyViewBase : public ApplyView, public RawView
33{
34public:
35 ApplyViewBase() = delete;
36 ApplyViewBase(ApplyViewBase const&) = delete;
40 operator=(ApplyViewBase const&) = delete;
41
43
45
46 // ReadView
47 bool
48 open() const override;
49
50 LedgerInfo const&
51 info() const override;
52
53 Fees const&
54 fees() const override;
55
56 Rules const&
57 rules() const override;
58
59 bool
60 exists(Keylet const& k) const override;
61
63 succ(
64 key_type const& key,
65 std::optional<key_type> const& last = std::nullopt) const override;
66
68 read(Keylet const& k) const override;
69
71 slesBegin() const override;
72
74 slesEnd() const override;
75
77 slesUpperBound(uint256 const& key) const override;
78
80 txsBegin() const override;
81
83 txsEnd() const override;
84
85 bool
86 txExists(key_type const& key) const override;
87
89 txRead(key_type const& key) const override;
90
91 // ApplyView
92
94 flags() const override;
95
97 peek(Keylet const& k) override;
98
99 void
100 erase(std::shared_ptr<SLE> const& sle) override;
101
102 void
103 insert(std::shared_ptr<SLE> const& sle) override;
104
105 void
106 update(std::shared_ptr<SLE> const& sle) override;
107
108 // RawView
109
110 void
111 rawErase(std::shared_ptr<SLE> const& sle) override;
112
113 void
114 rawInsert(std::shared_ptr<SLE> const& sle) override;
115
116 void
117 rawReplace(std::shared_ptr<SLE> const& sle) override;
118
119 void
120 rawDestroyXRP(XRPAmount const& feeDrops) override;
121
122protected:
126};
127
128} // namespace detail
129} // namespace ripple
130
131#endif
Writeable view to a ledger, for applying a transaction.
Definition: ApplyView.h:144
Interface for ledger entry changes.
Definition: RawView.h:35
A view into a ledger.
Definition: ReadView.h:52
Rules controlling protocol behavior.
Definition: Rules.h:35
ApplyViewBase(ApplyViewBase &&)=default
Fees const & fees() const override
Returns the fees for the base ledger.
void erase(std::shared_ptr< SLE > const &sle) override
Remove a peeked SLE.
void rawDestroyXRP(XRPAmount const &feeDrops) override
Destroy XRP.
std::unique_ptr< txs_type::iter_base > txsEnd() const override
bool open() const override
Returns true if this reflects an open ledger.
void update(std::shared_ptr< SLE > const &sle) override
Indicate changes to a peeked SLE.
ApplyViewBase & operator=(ApplyViewBase &&)=delete
void insert(std::shared_ptr< SLE > const &sle) override
Insert a new state SLE.
std::unique_ptr< sles_type::iter_base > slesEnd() const override
LedgerInfo const & info() const override
Returns information about the ledger.
detail::ApplyStateTable items_
void rawReplace(std::shared_ptr< SLE > const &sle) override
Unconditionally replace a state item.
void rawErase(std::shared_ptr< SLE > const &sle) override
Delete an existing state item.
tx_type txRead(key_type const &key) const override
Read a transaction from the tx map.
ApplyViewBase(ApplyViewBase const &)=delete
std::unique_ptr< sles_type::iter_base > slesBegin() const override
std::unique_ptr< txs_type::iter_base > txsBegin() const override
void rawInsert(std::shared_ptr< SLE > const &sle) override
Unconditionally insert a state item.
ApplyViewBase & operator=(ApplyViewBase const &)=delete
bool exists(Keylet const &k) const override
Determine if a state item exists.
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.
ApplyFlags flags() const override
Returns the tx apply flags.
bool txExists(key_type const &key) const override
Returns true if a tx exists in the tx map.
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 > slesUpperBound(uint256 const &key) const override
Rules const & rules() const override
Returns the tx processing rules.
std::shared_ptr< SLE > peek(Keylet const &k) override
Prepare to modify the SLE associated with key.
Match set account flags.
Definition: flags.h:125
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
ApplyFlags
Definition: ApplyView.h:31
Reflects the fee settings for a particular ledger.
Definition: protocol/Fees.h:33
A pair of SHAMap key and LedgerEntryType.
Definition: Keylet.h:39
Information about the notional ledger backing the view.
Definition: LedgerHeader.h:34