rippled
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | Private Types | Private Attributes | List of all members
ripple::InboundLedgersImp Class Referenceabstract
Inheritance diagram for ripple::InboundLedgersImp:
Inheritance graph
[legend]
Collaboration diagram for ripple::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 40 of file InboundLedgers.cpp.

Member Typedef Documentation

◆ ScopedLockType

Definition at line 451 of file InboundLedgers.cpp.

◆ MapType

Definition at line 455 of file InboundLedgers.cpp.

◆ clock_type

Definition at line 36 of file InboundLedgers.h.

Constructor & Destructor Documentation

◆ InboundLedgersImp()

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

Definition at line 53 of file InboundLedgers.cpp.

Member Function Documentation

◆ acquire()

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

Implements ripple::InboundLedgers.

Definition at line 70 of file InboundLedgers.cpp.

Here is the call graph for this function:

◆ acquireAsync()

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

Implements ripple::InboundLedgers.

Definition at line 135 of file InboundLedgers.cpp.

◆ find() [1/2]

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

Definition at line 165 of file InboundLedgers.cpp.

◆ gotLedgerData()

bool ripple::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 ripple::InboundLedgers.

Definition at line 201 of file InboundLedgers.cpp.

◆ logFailure()

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

Implements ripple::InboundLedgers.

Definition at line 239 of file InboundLedgers.cpp.

◆ isFailure()

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

Implements ripple::InboundLedgers.

Definition at line 247 of file InboundLedgers.cpp.

◆ gotStaleData()

void ripple::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 ripple::InboundLedgers.

Definition at line 262 of file InboundLedgers.cpp.

◆ clearFailures()

void ripple::InboundLedgersImp::clearFailures ( )
overridevirtual

Implements ripple::InboundLedgers.

Definition at line 294 of file InboundLedgers.cpp.

◆ fetchRate()

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

Returns the rate of historical ledger fetches per minute.

Implements ripple::InboundLedgers.

Definition at line 303 of file InboundLedgers.cpp.

◆ onLedgerFetched()

void ripple::InboundLedgersImp::onLedgerFetched ( )
overridevirtual

Called when a complete ledger is obtained.

Implements ripple::InboundLedgers.

Definition at line 312 of file InboundLedgers.cpp.

◆ getInfo()

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

Implements ripple::InboundLedgers.

Definition at line 319 of file InboundLedgers.cpp.

◆ gotFetchPack()

void ripple::InboundLedgersImp::gotFetchPack ( )
overridevirtual

Implements ripple::InboundLedgers.

Definition at line 359 of file InboundLedgers.cpp.

◆ sweep()

void ripple::InboundLedgersImp::sweep ( )
overridevirtual

Implements ripple::InboundLedgers.

Definition at line 383 of file InboundLedgers.cpp.

◆ stop()

void ripple::InboundLedgersImp::stop ( )
overridevirtual

Implements ripple::InboundLedgers.

Definition at line 433 of file InboundLedgers.cpp.

◆ cacheSize()

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

Implements ripple::InboundLedgers.

Definition at line 442 of file InboundLedgers.cpp.

◆ find() [2/2]

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

Member Data Documentation

◆ app_

Application& ripple::InboundLedgersImp::app_
private

Definition at line 43 of file InboundLedgers.cpp.

◆ fetchRateMutex_

std::mutex ripple::InboundLedgersImp::fetchRateMutex_
private

Definition at line 44 of file InboundLedgers.cpp.

◆ fetchRate_

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

Definition at line 46 of file InboundLedgers.cpp.

◆ j_

beast::Journal const ripple::InboundLedgersImp::j_
private

Definition at line 47 of file InboundLedgers.cpp.

◆ kReacquireInterval

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

Definition at line 51 of file InboundLedgers.cpp.

◆ m_clock

clock_type& ripple::InboundLedgersImp::m_clock
private

Definition at line 449 of file InboundLedgers.cpp.

◆ mLock

std::recursive_mutex ripple::InboundLedgersImp::mLock
private

Definition at line 452 of file InboundLedgers.cpp.

◆ stopping_

bool ripple::InboundLedgersImp::stopping_ = false
private

Definition at line 454 of file InboundLedgers.cpp.

◆ mLedgers

MapType ripple::InboundLedgersImp::mLedgers
private

Definition at line 456 of file InboundLedgers.cpp.

◆ mRecentFailures

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

Definition at line 458 of file InboundLedgers.cpp.

◆ mCounter

beast::insight::Counter ripple::InboundLedgersImp::mCounter
private

Definition at line 460 of file InboundLedgers.cpp.

◆ mPeerSetBuilder

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

Definition at line 462 of file InboundLedgers.cpp.

◆ pendingAcquires_

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

Definition at line 464 of file InboundLedgers.cpp.

◆ acquiresMutex_

std::mutex ripple::InboundLedgersImp::acquiresMutex_
private

Definition at line 465 of file InboundLedgers.cpp.