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 <xrpl/ledger/ApplyView.h>
24#include <xrpl/ledger/ReadView.h>
25#include <xrpl/ledger/detail/ApplyStateTable.h>
26#include <xrpl/protocol/XRPAmount.h>
27
28namespace ripple {
29namespace detail {
30
31class ApplyViewBase : public ApplyView, public RawView
32{
33public:
34 ApplyViewBase() = delete;
35 ApplyViewBase(ApplyViewBase const&) = delete;
39 operator=(ApplyViewBase const&) = delete;
40
42
44
45 // ReadView
46 bool
47 open() const override;
48
49 LedgerInfo const&
50 info() const override;
51
52 Fees const&
53 fees() const override;
54
55 Rules const&
56 rules() const override;
57
58 bool
59 exists(Keylet const& k) const override;
60
62 succ(
63 key_type const& key,
64 std::optional<key_type> const& last = std::nullopt) const override;
65
67 read(Keylet const& k) const override;
68
70 slesBegin() const override;
71
73 slesEnd() const override;
74
76 slesUpperBound(uint256 const& key) const override;
77
79 txsBegin() const override;
80
82 txsEnd() const override;
83
84 bool
85 txExists(key_type const& key) const override;
86
88 txRead(key_type const& key) const override;
89
90 // ApplyView
91
93 flags() const override;
94
96 peek(Keylet const& k) override;
97
98 void
99 erase(std::shared_ptr<SLE> const& sle) override;
100
101 void
102 insert(std::shared_ptr<SLE> const& sle) override;
103
104 void
105 update(std::shared_ptr<SLE> const& sle) override;
106
107 // RawView
108
109 void
110 rawErase(std::shared_ptr<SLE> const& sle) override;
111
112 void
113 rawInsert(std::shared_ptr<SLE> const& sle) override;
114
115 void
116 rawReplace(std::shared_ptr<SLE> const& sle) override;
117
118 void
119 rawDestroyXRP(XRPAmount const& feeDrops) override;
120
121protected:
125};
126
127} // namespace detail
128} // namespace ripple
129
130#endif
Writeable view to a ledger, for applying a transaction.
Definition ApplyView.h:143
Interface for ledger entry changes.
Definition RawView.h:34
A view into a ledger.
Definition ReadView.h:51
Rules controlling protocol behavior.
Definition Rules.h:38
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.
T is_same_v
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
Reflects the fee settings for a particular ledger.
A pair of SHAMap key and LedgerEntryType.
Definition Keylet.h:39
Information about the notional ledger backing the view.