20#ifndef RIPPLE_LEDGER_APPLYVIEW_H_INCLUDED
21#define RIPPLE_LEDGER_APPLYVIEW_H_INCLUDED
23#include <xrpl/basics/safe_cast.h>
24#include <xrpl/beast/utility/instrumentation.h>
25#include <xrpl/ledger/RawView.h>
26#include <xrpl/ledger/ReadView.h>
55 return safe_cast<ApplyFlags>(
62 "ApplyFlags operator |");
65 "ApplyFlags operator |");
70 return safe_cast<ApplyFlags>(
81 return safe_cast<ApplyFlags>(
86 ~tapRETRY == safe_cast<ApplyFlags>(0xFFFFFFDFu),
87 "ApplyFlags operator ~");
285 if (key.
type != ltOFFER)
288 "ripple::ApplyView::dirAppend : only Offers are appended to "
294 return dirAdd(
true, directory, key.
key, describe);
322 return dirAdd(
false, directory, key, describe);
331 return dirAdd(
false, directory, key.
key, describe);
Writeable view to a ledger, for applying a transaction.
std::optional< std::uint64_t > dirInsert(Keylet const &directory, Keylet const &key, std::function< void(std::shared_ptr< SLE > const &)> const &describe)
virtual void creditHook(AccountID const &from, AccountID const &to, STAmount const &amount, STAmount const &preCreditBalance)
bool dirDelete(Keylet const &directory, std::function< void(uint256 const &)> const &)
Remove the specified directory, invoking the callback for every node.
virtual void update(std::shared_ptr< SLE > const &sle)=0
Indicate changes to a peeked SLE.
bool dirRemove(Keylet const &directory, std::uint64_t page, uint256 const &key, bool keepRoot)
Remove an entry from a directory.
bool emptyDirDelete(Keylet const &directory)
Remove the specified directory, if it is empty.
std::optional< std::uint64_t > dirAppend(Keylet const &directory, Keylet const &key, std::function< void(std::shared_ptr< SLE > const &)> const &describe)
Append an entry to a directory.
virtual void adjustOwnerCountHook(AccountID const &account, std::uint32_t cur, std::uint32_t next)
std::optional< std::uint64_t > dirAdd(bool preserveOrder, Keylet const &directory, uint256 const &key, std::function< void(std::shared_ptr< SLE > const &)> const &describe)
Add an entry to a directory using the specified insert strategy.
virtual void insert(std::shared_ptr< SLE > const &sle)=0
Insert a new state SLE.
virtual ApplyFlags flags() const =0
Returns the tx apply flags.
bool dirRemove(Keylet const &directory, std::uint64_t page, Keylet const &key, bool keepRoot)
std::optional< std::uint64_t > dirInsert(Keylet const &directory, uint256 const &key, std::function< void(std::shared_ptr< SLE > const &)> const &describe)
Insert an entry to a directory.
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
virtual void erase(std::shared_ptr< SLE > const &sle)=0
Remove a peeked SLE.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
ApplyFlags operator|=(ApplyFlags &lhs, ApplyFlags const &rhs)
constexpr base_uint< Bits, Tag > operator|(base_uint< Bits, Tag > const &a, base_uint< Bits, Tag > const &b)
constexpr std::enable_if_t< std::is_integral_v< Dest > &&std::is_integral_v< Src >, Dest > safe_cast(Src s) noexcept
ApplyFlags operator&=(ApplyFlags &lhs, ApplyFlags const &rhs)
constexpr ApplyFlags operator~(ApplyFlags const &flags)
constexpr base_uint< Bits, Tag > operator&(base_uint< Bits, Tag > const &a, base_uint< Bits, Tag > const &b)
A pair of SHAMap key and LedgerEntryType.