rippled
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
xrpl::ApplyContext Class Reference

State information when applying a tx. More...

#include <ApplyContext.h>

Collaboration diagram for xrpl::ApplyContext:
Collaboration graph
[legend]

Public Member Functions

 ApplyContext (ServiceRegistry &registry, OpenView &base, std::optional< uint256 const > const &parentBatchId, STTx const &tx, TER preclaimResult, XRPAmount baseFee, ApplyFlags flags, beast::Journal journal=beast::Journal{beast::Journal::getNullSink()})
 
 ApplyContext (ServiceRegistry &registry, OpenView &base, STTx const &tx, TER preclaimResult, XRPAmount baseFee, ApplyFlags flags, beast::Journal journal=beast::Journal{beast::Journal::getNullSink()})
 
ApplyViewview ()
 
ApplyView const & view () const
 
RawViewrawView ()
 
ApplyFlags const & flags () const
 
void deliver (STAmount const &amount)
 Sets the DeliveredAmount field in the metadata.
 
void discard ()
 Discard changes and start fresh.
 
std::optional< TxMetaapply (TER)
 Apply the transaction result to the base.
 
std::size_t size ()
 Get the number of unapplied changes.
 
void visit (std::function< void(uint256 const &key, bool isDelete, std::shared_ptr< SLE const > const &before, std::shared_ptr< SLE const > const &after)> const &func)
 Visit unapplied changes.
 
void destroyXRP (XRPAmount const &fee)
 
TER checkInvariants (TER const result, XRPAmount const fee)
 Applies all invariant checkers one by one.
 

Public Attributes

std::reference_wrapper< ServiceRegistryregistry
 
STTx const & tx
 
TER const preclaimResult
 
XRPAmount const baseFee
 
beast::Journal const journal
 

Private Member Functions

template<std::size_t... Is>
TER checkInvariantsHelper (TER const result, XRPAmount const fee, std::index_sequence< Is... >)
 

Static Private Member Functions

static TER failInvariantCheck (TER const result)
 

Private Attributes

OpenViewbase_
 
ApplyFlags flags_
 
std::optional< ApplyViewImplview_
 
std::optional< uint256 const > parentBatchId_
 

Detailed Description

State information when applying a tx.

Definition at line 14 of file ApplyContext.h.

Constructor & Destructor Documentation

◆ ApplyContext() [1/2]

xrpl::ApplyContext::ApplyContext ( ServiceRegistry registry,
OpenView base,
std::optional< uint256 const > const &  parentBatchId,
STTx const &  tx,
TER  preclaimResult,
XRPAmount  baseFee,
ApplyFlags  flags,
beast::Journal  journal = beast::Journal{beast::Journal::getNullSink()} 
)
explicit

Definition at line 10 of file ApplyContext.cpp.

◆ ApplyContext() [2/2]

xrpl::ApplyContext::ApplyContext ( ServiceRegistry registry,
OpenView base,
STTx const &  tx,
TER  preclaimResult,
XRPAmount  baseFee,
ApplyFlags  flags,
beast::Journal  journal = beast::Journal{beast::Journal::getNullSink()} 
)
explicit

Definition at line 27 of file ApplyContext.h.

Member Function Documentation

◆ view() [1/2]

ApplyView & xrpl::ApplyContext::view ( )

Definition at line 47 of file ApplyContext.h.

◆ view() [2/2]

ApplyView const & xrpl::ApplyContext::view ( ) const

Definition at line 53 of file ApplyContext.h.

◆ rawView()

RawView & xrpl::ApplyContext::rawView ( )

Definition at line 60 of file ApplyContext.h.

◆ flags()

ApplyFlags const & xrpl::ApplyContext::flags ( ) const

Definition at line 66 of file ApplyContext.h.

◆ deliver()

void xrpl::ApplyContext::deliver ( STAmount const &  amount)

Sets the DeliveredAmount field in the metadata.

Definition at line 73 of file ApplyContext.h.

◆ discard()

void xrpl::ApplyContext::discard ( )

Discard changes and start fresh.

Definition at line 35 of file ApplyContext.cpp.

◆ apply()

std::optional< TxMeta > xrpl::ApplyContext::apply ( TER  ter)

Apply the transaction result to the base.

Definition at line 41 of file ApplyContext.cpp.

◆ size()

std::size_t xrpl::ApplyContext::size ( )

Get the number of unapplied changes.

Definition at line 47 of file ApplyContext.cpp.

◆ visit()

void xrpl::ApplyContext::visit ( std::function< void(uint256 const &key, bool isDelete, std::shared_ptr< SLE const > const &before, std::shared_ptr< SLE const > const &after)> const &  func)

Visit unapplied changes.

Definition at line 53 of file ApplyContext.cpp.

◆ destroyXRP()

void xrpl::ApplyContext::destroyXRP ( XRPAmount const &  fee)

Definition at line 99 of file ApplyContext.h.

◆ checkInvariants()

TER xrpl::ApplyContext::checkInvariants ( TER const  result,
XRPAmount const  fee 
)

Applies all invariant checkers one by one.

Parameters
resultthe result generated by processing this transaction.
feethe fee charged for this transaction
Returns
the result code that should be returned for this transaction.

Definition at line 126 of file ApplyContext.cpp.

◆ failInvariantCheck()

TER xrpl::ApplyContext::failInvariantCheck ( TER const  result)
staticprivate

Definition at line 64 of file ApplyContext.cpp.

◆ checkInvariantsHelper()

template<std::size_t... Is>
TER xrpl::ApplyContext::checkInvariantsHelper ( TER const  result,
XRPAmount const  fee,
std::index_sequence< Is... >   
)
private

Definition at line 78 of file ApplyContext.cpp.

Member Data Documentation

◆ registry

std::reference_wrapper<ServiceRegistry> xrpl::ApplyContext::registry

Definition at line 40 of file ApplyContext.h.

◆ tx

STTx const& xrpl::ApplyContext::tx

Definition at line 41 of file ApplyContext.h.

◆ preclaimResult

TER const xrpl::ApplyContext::preclaimResult

Definition at line 42 of file ApplyContext.h.

◆ baseFee

XRPAmount const xrpl::ApplyContext::baseFee

Definition at line 43 of file ApplyContext.h.

◆ journal

beast::Journal const xrpl::ApplyContext::journal

Definition at line 44 of file ApplyContext.h.

◆ base_

OpenView& xrpl::ApplyContext::base_
private

Definition at line 121 of file ApplyContext.h.

◆ flags_

ApplyFlags xrpl::ApplyContext::flags_
private

Definition at line 122 of file ApplyContext.h.

◆ view_

std::optional<ApplyViewImpl> xrpl::ApplyContext::view_
private

Definition at line 123 of file ApplyContext.h.

◆ parentBatchId_

std::optional<uint256 const> xrpl::ApplyContext::parentBatchId_
private

Definition at line 126 of file ApplyContext.h.