rippled
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
ripple::ApplyContext Class Reference

State information when applying a tx. More...

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

Public Member Functions

 ApplyContext (Application &app, OpenView &base, STTx const &tx, TER preclaimResult, XRPAmount baseFee, ApplyFlags flags, beast::Journal=beast::Journal{beast::Journal::getNullSink()})
 
ApplyViewview ()
 
ApplyView const & view () const
 
RawViewrawView ()
 
void deliver (STAmount const &amount)
 Sets the DeliveredAmount field in the metadata. More...
 
void discard ()
 Discard changes and start fresh. More...
 
void apply (TER)
 Apply the transaction result to the base. More...
 
std::size_t size ()
 Get the number of unapplied changes. More...
 
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. More...
 
void destroyXRP (XRPAmount const &fee)
 
TER checkInvariants (TER const result, XRPAmount const fee)
 Applies all invariant checkers one by one. More...
 

Public Attributes

Applicationapp
 
STTx const & tx
 
const TER preclaimResult
 
const XRPAmount baseFee
 
const beast::Journal journal
 

Private Member Functions

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

Private Attributes

OpenViewbase_
 
ApplyFlags flags_
 
std::optional< ApplyViewImplview_
 

Detailed Description

State information when applying a tx.

Definition at line 35 of file ApplyContext.h.

Constructor & Destructor Documentation

◆ ApplyContext()

ripple::ApplyContext::ApplyContext ( Application app,
OpenView base,
STTx const &  tx,
TER  preclaimResult,
XRPAmount  baseFee,
ApplyFlags  flags,
beast::Journal  journal_ = beast::Journal{beast::Journal::getNullSink()} 
)
explicit

Definition at line 31 of file ApplyContext.cpp.

Member Function Documentation

◆ view() [1/2]

ApplyView& ripple::ApplyContext::view ( )

Definition at line 54 of file ApplyContext.h.

◆ view() [2/2]

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

Definition at line 60 of file ApplyContext.h.

◆ rawView()

RawView& ripple::ApplyContext::rawView ( )

Definition at line 67 of file ApplyContext.h.

◆ deliver()

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

Sets the DeliveredAmount field in the metadata.

Definition at line 74 of file ApplyContext.h.

◆ discard()

void ripple::ApplyContext::discard ( )

Discard changes and start fresh.

Definition at line 51 of file ApplyContext.cpp.

◆ apply()

void ripple::ApplyContext::apply ( TER  ter)

Apply the transaction result to the base.

Definition at line 57 of file ApplyContext.cpp.

◆ size()

std::size_t ripple::ApplyContext::size ( )

Get the number of unapplied changes.

Definition at line 63 of file ApplyContext.cpp.

◆ visit()

void ripple::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 69 of file ApplyContext.cpp.

◆ destroyXRP()

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

Definition at line 99 of file ApplyContext.h.

◆ checkInvariants()

TER ripple::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 147 of file ApplyContext.cpp.

◆ failInvariantCheck()

TER ripple::ApplyContext::failInvariantCheck ( TER const  result)
private

Definition at line 79 of file ApplyContext.cpp.

◆ checkInvariantsHelper()

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

Definition at line 93 of file ApplyContext.cpp.

Member Data Documentation

◆ app

Application& ripple::ApplyContext::app

Definition at line 47 of file ApplyContext.h.

◆ tx

STTx const& ripple::ApplyContext::tx

Definition at line 48 of file ApplyContext.h.

◆ preclaimResult

const TER ripple::ApplyContext::preclaimResult

Definition at line 49 of file ApplyContext.h.

◆ baseFee

const XRPAmount ripple::ApplyContext::baseFee

Definition at line 50 of file ApplyContext.h.

◆ journal

const beast::Journal ripple::ApplyContext::journal

Definition at line 51 of file ApplyContext.h.

◆ base_

OpenView& ripple::ApplyContext::base_
private

Definition at line 124 of file ApplyContext.h.

◆ flags_

ApplyFlags ripple::ApplyContext::flags_
private

Definition at line 125 of file ApplyContext.h.

◆ view_

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

Definition at line 126 of file ApplyContext.h.