rippled
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | Private Types | Private Attributes | List of all members
xrpl::InboundLedgersImp Class Referenceabstract
Inheritance diagram for xrpl::InboundLedgersImp:
Inheritance graph
[legend]
Collaboration diagram for xrpl::InboundLedgersImp:
Collaboration graph
[legend]

Public Types

using clock_type = beast::abstract_clock< std::chrono::steady_clock >
 

Public Member Functions

 InboundLedgersImp (Application &app, clock_type &clock, beast::insight::Collector::ptr const &collector, std::unique_ptr< PeerSetBuilder > peerSetBuilder)
 
std::shared_ptr< Ledger const > acquire (uint256 const &hash, std::uint32_t seq, InboundLedger::Reason reason) override
 
void acquireAsync (uint256 const &hash, std::uint32_t seq, InboundLedger::Reason reason) override
 
std::shared_ptr< InboundLedgerfind (uint256 const &hash) override
 
bool gotLedgerData (LedgerHash const &hash, std::shared_ptr< Peer > peer, std::shared_ptr< protocol::TMLedgerData > packet) override
 We received a TMLedgerData from a peer.
 
void logFailure (uint256 const &h, std::uint32_t seq) override
 
bool isFailure (uint256 const &h) override
 
void gotStaleData (std::shared_ptr< protocol::TMLedgerData > packet_ptr) override
 We got some data for a ledger we are no longer acquiring Since we paid the price to receive it, we might as well stash it in case we need it.
 
void clearFailures () override
 
std::size_t fetchRate () override
 Returns the rate of historical ledger fetches per minute.
 
void onLedgerFetched () override
 Called when a complete ledger is obtained.
 
Json::Value getInfo () override
 
void gotFetchPack () override
 
void sweep () override
 
void stop () override
 
std::size_t cacheSize () override
 
virtual std::shared_ptr< InboundLedgerfind (LedgerHash const &hash)=0
 

Static Public Attributes

static constexpr std::chrono::minutes const kReacquireInterval {5}
 

Private Types

using ScopedLockType = std::unique_lock< std::recursive_mutex >
 
using MapType = hash_map< uint256, std::shared_ptr< InboundLedger > >
 

Private Attributes

Applicationapp_
 
std::mutex fetchRateMutex_
 
DecayWindow< 30, clock_typefetchRate_
 
beast::Journal const j_
 
clock_typem_clock
 
std::recursive_mutex mLock
 
bool stopping_ = false
 
MapType mLedgers
 
beast::aged_map< uint256, std::uint32_tmRecentFailures
 
beast::insight::Counter mCounter
 
std::unique_ptr< PeerSetBuildermPeerSetBuilder
 
std::set< uint256pendingAcquires_
 
std::mutex acquiresMutex_
 

Detailed Description

Definition at line 21 of file InboundLedgers.cpp.

Member Typedef Documentation

◆ ScopedLockType

Definition at line 431 of file InboundLedgers.cpp.

◆ MapType

Definition at line 435 of file InboundLedgers.cpp.

◆ clock_type

Definition at line 17 of file InboundLedgers.h.

Constructor & Destructor Documentation

◆ InboundLedgersImp()

xrpl::InboundLedgersImp::InboundLedgersImp ( Application app,
clock_type clock,
beast::insight::Collector::ptr const &  collector,
std::unique_ptr< PeerSetBuilder peerSetBuilder 
)

Definition at line 34 of file InboundLedgers.cpp.

Member Function Documentation

◆ acquire()

std::shared_ptr< Ledger const > xrpl::InboundLedgersImp::acquire ( uint256 const &  hash,
std::uint32_t  seq,
InboundLedger::Reason  reason 
)
overridevirtual

Implements xrpl::InboundLedgers.

Definition at line 51 of file InboundLedgers.cpp.

Here is the call graph for this function:

◆ acquireAsync()

void xrpl::InboundLedgersImp::acquireAsync ( uint256 const &  hash,
std::uint32_t  seq,
InboundLedger::Reason  reason 
)
overridevirtual

Implements xrpl::InboundLedgers.

Definition at line 116 of file InboundLedgers.cpp.

◆ find() [1/2]

std::shared_ptr< InboundLedger > xrpl::InboundLedgersImp::find ( uint256 const &  hash)
override

Definition at line 146 of file InboundLedgers.cpp.

◆ gotLedgerData()

bool xrpl::InboundLedgersImp::gotLedgerData ( LedgerHash const &  hash,
std::shared_ptr< Peer peer,
std::shared_ptr< protocol::TMLedgerData >  packet 
)
overridevirtual

We received a TMLedgerData from a peer.

Implements xrpl::InboundLedgers.

Definition at line 181 of file InboundLedgers.cpp.

◆ logFailure()

void xrpl::InboundLedgersImp::logFailure ( uint256 const &  h,
std::uint32_t  seq 
)
overridevirtual

Implements xrpl::InboundLedgers.

Definition at line 219 of file InboundLedgers.cpp.

◆ isFailure()

bool xrpl::InboundLedgersImp::isFailure ( uint256 const &  h)
overridevirtual

Implements xrpl::InboundLedgers.

Definition at line 227 of file InboundLedgers.cpp.

◆ gotStaleData()

void xrpl::InboundLedgersImp::gotStaleData ( std::shared_ptr< protocol::TMLedgerData >  packet_ptr)
overridevirtual

We got some data for a ledger we are no longer acquiring Since we paid the price to receive it, we might as well stash it in case we need it.

Nodes are received in wire format and must be stashed/hashed in prefix format

Implements xrpl::InboundLedgers.

Definition at line 242 of file InboundLedgers.cpp.

◆ clearFailures()

void xrpl::InboundLedgersImp::clearFailures ( )
overridevirtual

Implements xrpl::InboundLedgers.

Definition at line 274 of file InboundLedgers.cpp.

◆ fetchRate()

std::size_t xrpl::InboundLedgersImp::fetchRate ( )
overridevirtual

Returns the rate of historical ledger fetches per minute.

Implements xrpl::InboundLedgers.

Definition at line 283 of file InboundLedgers.cpp.

◆ onLedgerFetched()

void xrpl::InboundLedgersImp::onLedgerFetched ( )
overridevirtual

Called when a complete ledger is obtained.

Implements xrpl::InboundLedgers.

Definition at line 292 of file InboundLedgers.cpp.

◆ getInfo()

Json::Value xrpl::InboundLedgersImp::getInfo ( )
overridevirtual

Implements xrpl::InboundLedgers.

Definition at line 299 of file InboundLedgers.cpp.

◆ gotFetchPack()

void xrpl::InboundLedgersImp::gotFetchPack ( )
overridevirtual

Implements xrpl::InboundLedgers.

Definition at line 339 of file InboundLedgers.cpp.

◆ sweep()

void xrpl::InboundLedgersImp::sweep ( )
overridevirtual

Implements xrpl::InboundLedgers.

Definition at line 363 of file InboundLedgers.cpp.

◆ stop()

void xrpl::InboundLedgersImp::stop ( )
overridevirtual

Implements xrpl::InboundLedgers.

Definition at line 413 of file InboundLedgers.cpp.

◆ cacheSize()

std::size_t xrpl::InboundLedgersImp::cacheSize ( )
overridevirtual

Implements xrpl::InboundLedgers.

Definition at line 422 of file InboundLedgers.cpp.

◆ find() [2/2]

virtual std::shared_ptr< InboundLedger > xrpl::InboundLedgers::find ( LedgerHash const &  hash)
pure virtualinherited

Member Data Documentation

◆ app_

Application& xrpl::InboundLedgersImp::app_
private

Definition at line 24 of file InboundLedgers.cpp.

◆ fetchRateMutex_

std::mutex xrpl::InboundLedgersImp::fetchRateMutex_
private

Definition at line 25 of file InboundLedgers.cpp.

◆ fetchRate_

DecayWindow<30, clock_type> xrpl::InboundLedgersImp::fetchRate_
private

Definition at line 27 of file InboundLedgers.cpp.

◆ j_

beast::Journal const xrpl::InboundLedgersImp::j_
private

Definition at line 28 of file InboundLedgers.cpp.

◆ kReacquireInterval

constexpr std::chrono::minutes const xrpl::InboundLedgersImp::kReacquireInterval {5}
staticconstexpr

Definition at line 32 of file InboundLedgers.cpp.

◆ m_clock

clock_type& xrpl::InboundLedgersImp::m_clock
private

Definition at line 429 of file InboundLedgers.cpp.

◆ mLock

std::recursive_mutex xrpl::InboundLedgersImp::mLock
private

Definition at line 432 of file InboundLedgers.cpp.

◆ stopping_

bool xrpl::InboundLedgersImp::stopping_ = false
private

Definition at line 434 of file InboundLedgers.cpp.

◆ mLedgers

MapType xrpl::InboundLedgersImp::mLedgers
private

Definition at line 436 of file InboundLedgers.cpp.

◆ mRecentFailures

beast::aged_map<uint256, std::uint32_t> xrpl::InboundLedgersImp::mRecentFailures
private

Definition at line 438 of file InboundLedgers.cpp.

◆ mCounter

beast::insight::Counter xrpl::InboundLedgersImp::mCounter
private

Definition at line 440 of file InboundLedgers.cpp.

◆ mPeerSetBuilder

std::unique_ptr<PeerSetBuilder> xrpl::InboundLedgersImp::mPeerSetBuilder
private

Definition at line 442 of file InboundLedgers.cpp.

◆ pendingAcquires_

std::set<uint256> xrpl::InboundLedgersImp::pendingAcquires_
private

Definition at line 444 of file InboundLedgers.cpp.

◆ acquiresMutex_

std::mutex xrpl::InboundLedgersImp::acquiresMutex_
private

Definition at line 445 of file InboundLedgers.cpp.