rippled
Public Types | Public Member Functions | Public Attributes | List of all members
ripple::test::TestPeer Class Reference

Simulate a network peer. More...

Inheritance diagram for ripple::test::TestPeer:
Inheritance graph
[legend]
Collaboration diagram for ripple::test::TestPeer:
Collaboration graph
[legend]

Public Types

using ptr = std::shared_ptr< Peer >
 
using id_t = std::uint32_t
 Uniquely identifies a peer. More...
 

Public Member Functions

 TestPeer (bool enableLedgerReplay)
 
void send (std::shared_ptr< Message > const &m) override
 
beast::IP::Endpoint getRemoteAddress () const override
 
void charge (Resource::Charge const &fee) override
 Adjust this peer's load balance based on the type of load imposed. More...
 
id_t id () const override
 
bool cluster () const override
 Returns true if this connection is a member of the cluster. More...
 
bool isHighLatency () const override
 
int getScore (bool) const override
 
PublicKey const & getNodePublic () const override
 
Json::Value json () override
 
bool supportsFeature (ProtocolFeature f) const override
 
std::optional< std::size_tpublisherListSequence (PublicKey const &) const override
 
void setPublisherListSequence (PublicKey const &, std::size_t const) override
 
uint256 const & getClosedLedgerHash () const override
 
bool hasLedger (uint256 const &hash, std::uint32_t seq) const override
 
void ledgerRange (std::uint32_t &minSeq, std::uint32_t &maxSeq) const override
 
bool hasTxSet (uint256 const &hash) const override
 
void cycleStatus () override
 
bool hasRange (std::uint32_t uMin, std::uint32_t uMax) override
 
bool compressionEnabled () const override
 
void sendTxQueue () override
 Send aggregated transactions' hashes. More...
 
void addTxQueue (const uint256 &) override
 Aggregate transaction's hash. More...
 
void removeTxQueue (const uint256 &) override
 Remove hash from the transactions' hashes queue. More...
 
bool txReduceRelayEnabled () const override
 

Public Attributes

bool ledgerReplayEnabled_
 

Detailed Description

Simulate a network peer.

Depending on the configured PeerFeature, it either supports the ProtocolFeature::LedgerReplay or not

Definition at line 191 of file LedgerReplay_test.cpp.

Member Typedef Documentation

◆ ptr

Definition at line 48 of file ripple/overlay/Peer.h.

◆ id_t

using ripple::Peer::id_t = std::uint32_t
inherited

Uniquely identifies a peer.

This can be stored in tables to find the peer later. Callers can discover if the peer is no longer connected and make adjustments as needed.

Definition at line 55 of file ripple/overlay/Peer.h.

Constructor & Destructor Documentation

◆ TestPeer()

ripple::test::TestPeer::TestPeer ( bool  enableLedgerReplay)

Definition at line 194 of file LedgerReplay_test.cpp.

Member Function Documentation

◆ send()

void ripple::test::TestPeer::send ( std::shared_ptr< Message > const &  m)
overridevirtual

Implements ripple::Peer.

Definition at line 199 of file LedgerReplay_test.cpp.

◆ getRemoteAddress()

beast::IP::Endpoint ripple::test::TestPeer::getRemoteAddress ( ) const
overridevirtual

Implements ripple::Peer.

Definition at line 203 of file LedgerReplay_test.cpp.

◆ charge()

void ripple::test::TestPeer::charge ( Resource::Charge const &  fee)
overridevirtual

Adjust this peer's load balance based on the type of load imposed.

Implements ripple::Peer.

Definition at line 208 of file LedgerReplay_test.cpp.

◆ id()

id_t ripple::test::TestPeer::id ( ) const
overridevirtual

Implements ripple::Peer.

Definition at line 212 of file LedgerReplay_test.cpp.

◆ cluster()

bool ripple::test::TestPeer::cluster ( ) const
overridevirtual

Returns true if this connection is a member of the cluster.

Implements ripple::Peer.

Definition at line 217 of file LedgerReplay_test.cpp.

◆ isHighLatency()

bool ripple::test::TestPeer::isHighLatency ( ) const
overridevirtual

Implements ripple::Peer.

Definition at line 222 of file LedgerReplay_test.cpp.

◆ getScore()

int ripple::test::TestPeer::getScore ( bool  ) const
overridevirtual

Implements ripple::Peer.

Definition at line 227 of file LedgerReplay_test.cpp.

◆ getNodePublic()

PublicKey const& ripple::test::TestPeer::getNodePublic ( ) const
overridevirtual

Implements ripple::Peer.

Definition at line 232 of file LedgerReplay_test.cpp.

◆ json()

Json::Value ripple::test::TestPeer::json ( )
overridevirtual

Implements ripple::Peer.

Definition at line 238 of file LedgerReplay_test.cpp.

◆ supportsFeature()

bool ripple::test::TestPeer::supportsFeature ( ProtocolFeature  f) const
overridevirtual

Implements ripple::Peer.

Definition at line 243 of file LedgerReplay_test.cpp.

◆ publisherListSequence()

std::optional<std::size_t> ripple::test::TestPeer::publisherListSequence ( PublicKey const &  ) const
overridevirtual

Implements ripple::Peer.

Definition at line 250 of file LedgerReplay_test.cpp.

◆ setPublisherListSequence()

void ripple::test::TestPeer::setPublisherListSequence ( PublicKey const &  ,
std::size_t const   
)
overridevirtual

Implements ripple::Peer.

Definition at line 255 of file LedgerReplay_test.cpp.

◆ getClosedLedgerHash()

uint256 const& ripple::test::TestPeer::getClosedLedgerHash ( ) const
overridevirtual

Implements ripple::Peer.

Definition at line 259 of file LedgerReplay_test.cpp.

◆ hasLedger()

bool ripple::test::TestPeer::hasLedger ( uint256 const &  hash,
std::uint32_t  seq 
) const
overridevirtual

Implements ripple::Peer.

Definition at line 265 of file LedgerReplay_test.cpp.

◆ ledgerRange()

void ripple::test::TestPeer::ledgerRange ( std::uint32_t minSeq,
std::uint32_t maxSeq 
) const
overridevirtual

Implements ripple::Peer.

Definition at line 270 of file LedgerReplay_test.cpp.

◆ hasTxSet()

bool ripple::test::TestPeer::hasTxSet ( uint256 const &  hash) const
overridevirtual

Implements ripple::Peer.

Definition at line 274 of file LedgerReplay_test.cpp.

◆ cycleStatus()

void ripple::test::TestPeer::cycleStatus ( )
overridevirtual

Implements ripple::Peer.

Definition at line 279 of file LedgerReplay_test.cpp.

◆ hasRange()

bool ripple::test::TestPeer::hasRange ( std::uint32_t  uMin,
std::uint32_t  uMax 
)
overridevirtual

Implements ripple::Peer.

Definition at line 283 of file LedgerReplay_test.cpp.

◆ compressionEnabled()

bool ripple::test::TestPeer::compressionEnabled ( ) const
overridevirtual

Implements ripple::Peer.

Definition at line 288 of file LedgerReplay_test.cpp.

◆ sendTxQueue()

void ripple::test::TestPeer::sendTxQueue ( )
overridevirtual

Send aggregated transactions' hashes.

Implements ripple::Peer.

Definition at line 293 of file LedgerReplay_test.cpp.

◆ addTxQueue()

void ripple::test::TestPeer::addTxQueue ( const uint256 )
overridevirtual

Aggregate transaction's hash.

Implements ripple::Peer.

Definition at line 297 of file LedgerReplay_test.cpp.

◆ removeTxQueue()

void ripple::test::TestPeer::removeTxQueue ( const uint256 )
overridevirtual

Remove hash from the transactions' hashes queue.

Implements ripple::Peer.

Definition at line 301 of file LedgerReplay_test.cpp.

◆ txReduceRelayEnabled()

bool ripple::test::TestPeer::txReduceRelayEnabled ( ) const
overridevirtual

Implements ripple::Peer.

Definition at line 305 of file LedgerReplay_test.cpp.

Member Data Documentation

◆ ledgerReplayEnabled_

bool ripple::test::TestPeer::ledgerReplayEnabled_

Definition at line 310 of file LedgerReplay_test.cpp.