xrpld
Loading...
Searching...
No Matches
xrpl::FlowOfferStream< TIn, TOut > Class Template Reference

Presents and consumes the offers in an order book. More...

#include <OfferStream.h>

Inheritance diagram for xrpl::FlowOfferStream< TIn, TOut >:
Collaboration diagram for xrpl::FlowOfferStream< TIn, TOut >:

Public Member Functions

void permRmOffer (uint256 const &offerIndex) override
boost::container::flat_set< uint256 > const & permToRemove () const
TOffer< TIn, TOut > & tip () const
 Returns the offer at the tip of the order book.
bool step ()
 Advance to the next valid offer.
TOut ownerFunds () const

Protected Member Functions

void erase (ApplyView &view)
template<class TTakerPays, class TTakerGets>
bool shouldRmSmallIncreasedQOffer () const

Protected Attributes

beast::Journal const j_
ApplyViewview_
ApplyViewcancelView_
Book book_
bool validBook_
NetClock::time_point const expire_
BookTip tip_
TOffer< TIn, TOut > offer_
std::optional< TOut > ownerFunds_
StepCountercounter_

Private Attributes

boost::container::flat_set< uint256permToRemove_

Detailed Description

template<StepAmount TIn, StepAmount TOut>
class xrpl::FlowOfferStream< TIn, TOut >

Presents and consumes the offers in an order book.

The view_' ApplyView accumulates changes to the ledger. The cancelView_ is used to determine if an offer is found unfunded or became unfunded. The permToRemove collection identifies offers that should be removed even if the strand associated with this OfferStream is not applied.

Certain invalid offers are added to the permToRemove collection:

  • Offers with missing ledger entries
  • Offers that expired
  • Offers found unfunded: An offer is found unfunded when the corresponding balance is zero and the caller has not modified the balance. This is accomplished by also looking up the balance in the cancel view.

Definition at line 129 of file OfferStream.h.

Member Function Documentation

◆ permRmOffer()

template<StepAmount TIn, StepAmount TOut>
void xrpl::FlowOfferStream< TIn, TOut >::permRmOffer ( uint256 const & offerIndex)
overridevirtual

Implements xrpl::TOfferStreamBase< TIn, TOut >.

Definition at line 343 of file OfferStream.cpp.

◆ permToRemove()

template<StepAmount TIn, StepAmount TOut>
boost::container::flat_set< uint256 > const & xrpl::FlowOfferStream< TIn, TOut >::permToRemove ( ) const
nodiscard

Definition at line 145 of file OfferStream.h.

◆ erase()

template<StepAmount TIn, StepAmount TOut>
void xrpl::TOfferStreamBase< TIn, TOut >::erase ( ApplyView & view)
protectedinherited

Definition at line 71 of file OfferStream.cpp.

◆ shouldRmSmallIncreasedQOffer()

template<StepAmount TIn, StepAmount TOut>
template<class TTakerPays, class TTakerGets>
bool xrpl::TOfferStreamBase< TIn, TOut >::shouldRmSmallIncreasedQOffer ( ) const
nodiscardprotectedinherited

Definition at line 136 of file OfferStream.cpp.

◆ tip()

template<StepAmount TIn, StepAmount TOut>
TOffer< TIn, TOut > & xrpl::TOfferStreamBase< TIn, TOut >::tip ( ) const
nodiscardinherited

Returns the offer at the tip of the order book.

Offers are always presented in decreasing quality. Only valid if step() returned true.

Definition at line 88 of file OfferStream.h.

◆ step()

template<StepAmount TIn, StepAmount TOut>
bool xrpl::TOfferStreamBase< TIn, TOut >::step ( )
inherited

Advance to the next valid offer.

This automatically removes:

  • Offers with missing ledger entries
  • Offers found unfunded
  • expired offers
    Returns
    true if there is a valid offer.

Definition at line 192 of file OfferStream.cpp.

◆ ownerFunds()

template<StepAmount TIn, StepAmount TOut>
TOut xrpl::TOfferStreamBase< TIn, TOut >::ownerFunds ( ) const
nodiscardinherited

Definition at line 104 of file OfferStream.h.

Member Data Documentation

◆ permToRemove_

template<StepAmount TIn, StepAmount TOut>
boost::container::flat_set<uint256> xrpl::FlowOfferStream< TIn, TOut >::permToRemove_
private

Definition at line 132 of file OfferStream.h.

◆ j_

template<StepAmount TIn, StepAmount TOut>
beast::Journal const xrpl::TOfferStreamBase< TIn, TOut >::j_
protectedinherited

Definition at line 50 of file OfferStream.h.

◆ view_

template<StepAmount TIn, StepAmount TOut>
ApplyView& xrpl::TOfferStreamBase< TIn, TOut >::view_
protectedinherited

Definition at line 51 of file OfferStream.h.

◆ cancelView_

template<StepAmount TIn, StepAmount TOut>
ApplyView& xrpl::TOfferStreamBase< TIn, TOut >::cancelView_
protectedinherited

Definition at line 52 of file OfferStream.h.

◆ book_

template<StepAmount TIn, StepAmount TOut>
Book xrpl::TOfferStreamBase< TIn, TOut >::book_
protectedinherited

Definition at line 53 of file OfferStream.h.

◆ validBook_

template<StepAmount TIn, StepAmount TOut>
bool xrpl::TOfferStreamBase< TIn, TOut >::validBook_
protectedinherited

Definition at line 54 of file OfferStream.h.

◆ expire_

template<StepAmount TIn, StepAmount TOut>
NetClock::time_point const xrpl::TOfferStreamBase< TIn, TOut >::expire_
protectedinherited

Definition at line 55 of file OfferStream.h.

◆ tip_

template<StepAmount TIn, StepAmount TOut>
BookTip xrpl::TOfferStreamBase< TIn, TOut >::tip_
protectedinherited

Definition at line 56 of file OfferStream.h.

◆ offer_

template<StepAmount TIn, StepAmount TOut>
TOffer<TIn, TOut> xrpl::TOfferStreamBase< TIn, TOut >::offer_
protectedinherited

Definition at line 57 of file OfferStream.h.

◆ ownerFunds_

template<StepAmount TIn, StepAmount TOut>
std::optional<TOut> xrpl::TOfferStreamBase< TIn, TOut >::ownerFunds_
protectedinherited

Definition at line 58 of file OfferStream.h.

◆ counter_

template<StepAmount TIn, StepAmount TOut>
StepCounter& xrpl::TOfferStreamBase< TIn, TOut >::counter_
protectedinherited

Definition at line 59 of file OfferStream.h.