rippled
Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ripple::PathRequest Class Referencefinal
Inheritance diagram for ripple::PathRequest:
Inheritance graph
[legend]
Collaboration diagram for ripple::PathRequest:
Collaboration graph
[legend]

Public Types

using wptr = std::weak_ptr< PathRequest >
 
using pointer = std::shared_ptr< PathRequest >
 
using ref = const pointer &
 
using wref = const wptr &
 

Public Member Functions

 PathRequest (Application &app, std::shared_ptr< InfoSub > const &subscriber, int id, PathRequests &, beast::Journal journal)
 
 PathRequest (Application &app, std::function< void(void)> const &completion, Resource::Consumer &consumer, int id, PathRequests &, beast::Journal journal)
 
 ~PathRequest ()
 
bool isNew ()
 
bool needsUpdate (bool newOnly, LedgerIndex index)
 
void updateComplete ()
 
std::pair< bool, Json::ValuedoCreate (std::shared_ptr< RippleLineCache > const &, Json::Value const &)
 
Json::Value doClose () override
 
Json::Value doStatus (Json::Value const &) override
 
void doAborting () const
 
Json::Value doUpdate (std::shared_ptr< RippleLineCache > const &, bool fast, std::function< bool(void)> const &continueCallback={})
 
InfoSub::pointer getSubscriber () const
 
bool hasCompletion ()
 
shared_from_this (T... args)
 
weak_from_this (T... args)
 

Private Member Functions

bool isValid (std::shared_ptr< RippleLineCache > const &crCache)
 
std::unique_ptr< Pathfinder > const & getPathFinder (std::shared_ptr< RippleLineCache > const &, hash_map< Currency, std::unique_ptr< Pathfinder >> &, Currency const &, STAmount const &, int const, std::function< bool(void)> const &)
 
bool findPaths (std::shared_ptr< RippleLineCache > const &, int const, Json::Value &, std::function< bool(void)> const &)
 Finds and sets a PathSet in the JSON argument. More...
 
int parseJson (Json::Value const &)
 

Static Private Member Functions

static auto & getCounter () noexcept
 

Private Attributes

Applicationapp_
 
beast::Journal m_journal
 
std::recursive_mutex mLock
 
PathRequestsmOwner
 
std::weak_ptr< InfoSubwpSubscriber
 
std::function< void(void)> fCompletion
 
Resource::Consumerconsumer_
 
Json::Value jvId
 
Json::Value jvStatus
 
std::optional< AccountIDraSrcAccount
 
std::optional< AccountIDraDstAccount
 
STAmount saDstAmount
 
std::optional< STAmountsaSendMax
 
std::set< IssuesciSourceCurrencies
 
std::map< Issue, STPathSetmContext
 
bool convert_all_
 
std::recursive_mutex mIndexLock
 
LedgerIndex mLastIndex
 
bool mInProgress
 
int iLevel
 
bool bLastSuccess
 
const int iIdentifier
 
const std::chrono::steady_clock::time_point created_
 
std::chrono::steady_clock::time_point quick_reply_
 
std::chrono::steady_clock::time_point full_reply_
 

Static Private Attributes

static unsigned const int max_paths_ = 4
 

Detailed Description

Definition at line 47 of file PathRequest.h.

Member Typedef Documentation

◆ wptr

Definition at line 52 of file PathRequest.h.

◆ pointer

Definition at line 53 of file PathRequest.h.

◆ ref

Definition at line 54 of file PathRequest.h.

◆ wref

Definition at line 55 of file PathRequest.h.

Constructor & Destructor Documentation

◆ PathRequest() [1/2]

ripple::PathRequest::PathRequest ( Application app,
std::shared_ptr< InfoSub > const &  subscriber,
int  id,
PathRequests owner,
beast::Journal  journal 
)

Definition at line 42 of file PathRequest.cpp.

◆ PathRequest() [2/2]

ripple::PathRequest::PathRequest ( Application app,
std::function< void(void)> const &  completion,
Resource::Consumer consumer,
int  id,
PathRequests owner,
beast::Journal  journal 
)

Definition at line 64 of file PathRequest.cpp.

◆ ~PathRequest()

ripple::PathRequest::~PathRequest ( )

Definition at line 87 of file PathRequest.cpp.

Member Function Documentation

◆ isNew()

bool ripple::PathRequest::isNew ( )

Definition at line 116 of file PathRequest.cpp.

◆ needsUpdate()

bool ripple::PathRequest::needsUpdate ( bool  newOnly,
LedgerIndex  index 
)

Definition at line 125 of file PathRequest.cpp.

◆ updateComplete()

void ripple::PathRequest::updateComplete ( )

Definition at line 157 of file PathRequest.cpp.

◆ doCreate()

std::pair< bool, Json::Value > ripple::PathRequest::doCreate ( std::shared_ptr< RippleLineCache > const &  cache,
Json::Value const &  value 
)

Definition at line 244 of file PathRequest.cpp.

◆ doClose()

Json::Value ripple::PathRequest::doClose ( )
overridevirtual

Implements ripple::InfoSubRequest.

Definition at line 444 of file PathRequest.cpp.

◆ doStatus()

Json::Value ripple::PathRequest::doStatus ( Json::Value const &  )
overridevirtual

Implements ripple::InfoSubRequest.

Definition at line 453 of file PathRequest.cpp.

◆ doAborting()

void ripple::PathRequest::doAborting ( ) const

Definition at line 461 of file PathRequest.cpp.

◆ doUpdate()

Json::Value ripple::PathRequest::doUpdate ( std::shared_ptr< RippleLineCache > const &  cache,
bool  fast,
std::function< bool(void)> const &  continueCallback = {} 
)

Definition at line 657 of file PathRequest.cpp.

◆ getSubscriber()

InfoSub::pointer ripple::PathRequest::getSubscriber ( ) const

Definition at line 762 of file PathRequest.cpp.

◆ hasCompletion()

bool ripple::PathRequest::hasCompletion ( )

Definition at line 151 of file PathRequest.cpp.

◆ isValid()

bool ripple::PathRequest::isValid ( std::shared_ptr< RippleLineCache > const &  crCache)
private

Definition at line 172 of file PathRequest.cpp.

◆ getPathFinder()

std::unique_ptr< Pathfinder > const & ripple::PathRequest::getPathFinder ( std::shared_ptr< RippleLineCache > const &  cache,
hash_map< Currency, std::unique_ptr< Pathfinder >> &  currency_map,
Currency const &  currency,
STAmount const &  dst_amount,
int const  level,
std::function< bool(void)> const &  continueCallback 
)
private

Definition at line 467 of file PathRequest.cpp.

◆ findPaths()

bool ripple::PathRequest::findPaths ( std::shared_ptr< RippleLineCache > const &  cache,
int const  level,
Json::Value jvArray,
std::function< bool(void)> const &  continueCallback 
)
private

Finds and sets a PathSet in the JSON argument.

Returns false if the source currencies are inavlid.

Definition at line 495 of file PathRequest.cpp.

◆ parseJson()

int ripple::PathRequest::parseJson ( Json::Value const &  jvParams)
private

Definition at line 274 of file PathRequest.cpp.

◆ getCounter()

static auto& ripple::CountedObject< PathRequest >::getCounter
staticprivatenoexceptinherited

Definition at line 128 of file CountedObject.h.

Member Data Documentation

◆ app_

Application& ripple::PathRequest::app_
private

Definition at line 135 of file PathRequest.h.

◆ m_journal

beast::Journal ripple::PathRequest::m_journal
private

Definition at line 136 of file PathRequest.h.

◆ mLock

std::recursive_mutex ripple::PathRequest::mLock
private

Definition at line 138 of file PathRequest.h.

◆ mOwner

PathRequests& ripple::PathRequest::mOwner
private

Definition at line 140 of file PathRequest.h.

◆ wpSubscriber

std::weak_ptr<InfoSub> ripple::PathRequest::wpSubscriber
private

Definition at line 142 of file PathRequest.h.

◆ fCompletion

std::function<void(void)> ripple::PathRequest::fCompletion
private

Definition at line 143 of file PathRequest.h.

◆ consumer_

Resource::Consumer& ripple::PathRequest::consumer_
private

Definition at line 144 of file PathRequest.h.

◆ jvId

Json::Value ripple::PathRequest::jvId
private

Definition at line 146 of file PathRequest.h.

◆ jvStatus

Json::Value ripple::PathRequest::jvStatus
private

Definition at line 147 of file PathRequest.h.

◆ raSrcAccount

std::optional<AccountID> ripple::PathRequest::raSrcAccount
private

Definition at line 150 of file PathRequest.h.

◆ raDstAccount

std::optional<AccountID> ripple::PathRequest::raDstAccount
private

Definition at line 151 of file PathRequest.h.

◆ saDstAmount

STAmount ripple::PathRequest::saDstAmount
private

Definition at line 152 of file PathRequest.h.

◆ saSendMax

std::optional<STAmount> ripple::PathRequest::saSendMax
private

Definition at line 153 of file PathRequest.h.

◆ sciSourceCurrencies

std::set<Issue> ripple::PathRequest::sciSourceCurrencies
private

Definition at line 155 of file PathRequest.h.

◆ mContext

std::map<Issue, STPathSet> ripple::PathRequest::mContext
private

Definition at line 156 of file PathRequest.h.

◆ convert_all_

bool ripple::PathRequest::convert_all_
private

Definition at line 158 of file PathRequest.h.

◆ mIndexLock

std::recursive_mutex ripple::PathRequest::mIndexLock
private

Definition at line 160 of file PathRequest.h.

◆ mLastIndex

LedgerIndex ripple::PathRequest::mLastIndex
private

Definition at line 161 of file PathRequest.h.

◆ mInProgress

bool ripple::PathRequest::mInProgress
private

Definition at line 162 of file PathRequest.h.

◆ iLevel

int ripple::PathRequest::iLevel
private

Definition at line 164 of file PathRequest.h.

◆ bLastSuccess

bool ripple::PathRequest::bLastSuccess
private

Definition at line 165 of file PathRequest.h.

◆ iIdentifier

const int ripple::PathRequest::iIdentifier
private

Definition at line 167 of file PathRequest.h.

◆ created_

const std::chrono::steady_clock::time_point ripple::PathRequest::created_
private

Definition at line 169 of file PathRequest.h.

◆ quick_reply_

std::chrono::steady_clock::time_point ripple::PathRequest::quick_reply_
private

Definition at line 170 of file PathRequest.h.

◆ full_reply_

std::chrono::steady_clock::time_point ripple::PathRequest::full_reply_
private

Definition at line 171 of file PathRequest.h.

◆ max_paths_

unsigned const int ripple::PathRequest::max_paths_ = 4
staticprivate

Definition at line 173 of file PathRequest.h.