xrpld
Loading...
Searching...
No Matches
xrpl::InboundLedgersImp Class Referenceabstract
Inheritance diagram for xrpl::InboundLedgersImp:
Collaboration diagram for xrpl::InboundLedgersImp:

Public Types

using clock_type = beast::AbstractClock<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 > packetPtr) 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 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_typeclock_
std::recursive_mutex lock_
bool stopping_ = false
MapType ledgers_
beast::aged_map< uint256, std::uint32_trecentFailures_
beast::insight::Counter counter_
std::unique_ptr< PeerSetBuilderpeerSetBuilder_
std::set< uint256pendingAcquires_
std::mutex acquiresMutex_

Detailed Description

Definition at line 45 of file InboundLedgers.cpp.

Member Typedef Documentation

◆ ScopedLockType

◆ MapType

◆ clock_type

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 58 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 75 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 130 of file InboundLedgers.cpp.

◆ find() [1/2]

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

Definition at line 154 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 188 of file InboundLedgers.cpp.

◆ logFailure()

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

Implements xrpl::InboundLedgers.

Definition at line 223 of file InboundLedgers.cpp.

◆ isFailure()

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

Implements xrpl::InboundLedgers.

Definition at line 231 of file InboundLedgers.cpp.

◆ gotStaleData()

void xrpl::InboundLedgersImp::gotStaleData ( std::shared_ptr< protocol::TMLedgerData > packetPtr)
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 246 of file InboundLedgers.cpp.

◆ clearFailures()

void xrpl::InboundLedgersImp::clearFailures ( )
overridevirtual

Implements xrpl::InboundLedgers.

Definition at line 276 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 285 of file InboundLedgers.cpp.

◆ onLedgerFetched()

void xrpl::InboundLedgersImp::onLedgerFetched ( )
overridevirtual

Called when a complete ledger is obtained.

Implements xrpl::InboundLedgers.

Definition at line 294 of file InboundLedgers.cpp.

◆ getInfo()

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

Implements xrpl::InboundLedgers.

Definition at line 301 of file InboundLedgers.cpp.

◆ gotFetchPack()

void xrpl::InboundLedgersImp::gotFetchPack ( )
overridevirtual

Implements xrpl::InboundLedgers.

Definition at line 347 of file InboundLedgers.cpp.

◆ sweep()

void xrpl::InboundLedgersImp::sweep ( )
overridevirtual

Implements xrpl::InboundLedgers.

Definition at line 371 of file InboundLedgers.cpp.

◆ stop()

void xrpl::InboundLedgersImp::stop ( )
overridevirtual

Implements xrpl::InboundLedgers.

Definition at line 419 of file InboundLedgers.cpp.

◆ cacheSize()

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

Implements xrpl::InboundLedgers.

Definition at line 428 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 48 of file InboundLedgers.cpp.

◆ fetchRateMutex_

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

Definition at line 49 of file InboundLedgers.cpp.

◆ fetchRate_

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

Definition at line 51 of file InboundLedgers.cpp.

◆ j_

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

Definition at line 52 of file InboundLedgers.cpp.

◆ kReacquireInterval

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

Definition at line 56 of file InboundLedgers.cpp.

◆ clock_

clock_type& xrpl::InboundLedgersImp::clock_
private

Definition at line 435 of file InboundLedgers.cpp.

◆ lock_

std::recursive_mutex xrpl::InboundLedgersImp::lock_
private

Definition at line 438 of file InboundLedgers.cpp.

◆ stopping_

bool xrpl::InboundLedgersImp::stopping_ = false
private

Definition at line 440 of file InboundLedgers.cpp.

◆ ledgers_

MapType xrpl::InboundLedgersImp::ledgers_
private

Definition at line 442 of file InboundLedgers.cpp.

◆ recentFailures_

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

Definition at line 444 of file InboundLedgers.cpp.

◆ counter_

beast::insight::Counter xrpl::InboundLedgersImp::counter_
private

Definition at line 446 of file InboundLedgers.cpp.

◆ peerSetBuilder_

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

Definition at line 448 of file InboundLedgers.cpp.

◆ pendingAcquires_

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

Definition at line 450 of file InboundLedgers.cpp.

◆ acquiresMutex_

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

Definition at line 451 of file InboundLedgers.cpp.