rippled
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ripple::test::OverlaySim Class Reference
Inheritance diagram for ripple::test::OverlaySim:
Inheritance graph
[legend]
Collaboration diagram for ripple::test::OverlaySim:
Collaboration graph
[legend]

Public Types

using id_t = Peer::id_t
 
using clock_type = ManualClock
 

Public Member Functions

 OverlaySim (Application &app)
 
 ~OverlaySim ()=default
 
void clear ()
 
std::uint16_t inState (PublicKey const &validator, reduce_relay::PeerState state)
 
void updateSlotAndSquelch (uint256 const &key, PublicKey const &validator, Peer::id_t id, SquelchCB f, protocol::MessageType type=protocol::mtVALIDATION) override
 
void deletePeer (id_t id, UnsquelchCB f) override
 
void deleteIdlePeers (UnsquelchCB f) override
 
PeerSPtr addPeer (bool useCache=true)
 
void deletePeer (Peer::id_t id, bool useCache=true)
 
void resetPeers ()
 
std::optional< Peer::id_tdeleteLastPeer ()
 
bool isCountingState (PublicKey const &validator)
 
std::set< id_tgetSelected (PublicKey const &validator)
 
bool isSelected (PublicKey const &validator, Peer::id_t peer)
 
id_t getSelectedPeer (PublicKey const &validator)
 
std::unordered_map< id_t, std::tuple< reduce_relay::PeerState, std::uint16_t, std::uint32_t, std::uint32_t > > getPeers (PublicKey const &validator)
 
std::uint16_t getNumPeers () const
 

Private Types

using Peers = std::unordered_map< Peer::id_t, PeerSPtr >
 

Private Member Functions

void squelch (PublicKey const &validator, Peer::id_t id, std::uint32_t squelchDuration) const override
 Squelch handler. More...
 
void unsquelch (PublicKey const &validator, Peer::id_t id) const override
 Unsquelch handler. More...
 

Private Attributes

SquelchCB squelch_
 
UnsquelchCB unsquelch_
 
Peers peers_
 
Peers peersCache_
 
reduce_relay::Slots< ManualClockslots_
 
Logslogs_
 

Detailed Description

Definition at line 504 of file reduce_relay_test.cpp.

Member Typedef Documentation

◆ Peers

Definition at line 506 of file reduce_relay_test.cpp.

◆ id_t

Definition at line 509 of file reduce_relay_test.cpp.

◆ clock_type

Definition at line 510 of file reduce_relay_test.cpp.

Constructor & Destructor Documentation

◆ OverlaySim()

ripple::test::OverlaySim::OverlaySim ( Application app)

Definition at line 511 of file reduce_relay_test.cpp.

◆ ~OverlaySim()

ripple::test::OverlaySim::~OverlaySim ( )
default

Member Function Documentation

◆ clear()

void ripple::test::OverlaySim::clear ( )

Definition at line 518 of file reduce_relay_test.cpp.

◆ inState()

std::uint16_t ripple::test::OverlaySim::inState ( PublicKey const &  validator,
reduce_relay::PeerState  state 
)

Definition at line 526 of file reduce_relay_test.cpp.

◆ updateSlotAndSquelch()

void ripple::test::OverlaySim::updateSlotAndSquelch ( uint256 const &  key,
PublicKey const &  validator,
Peer::id_t  id,
SquelchCB  f,
protocol::MessageType  type = protocol::mtVALIDATION 
)
overridevirtual

Implements ripple::test::Overlay.

Definition at line 533 of file reduce_relay_test.cpp.

◆ deletePeer() [1/2]

void ripple::test::OverlaySim::deletePeer ( id_t  id,
UnsquelchCB  f 
)
overridevirtual

Implements ripple::test::Overlay.

Definition at line 545 of file reduce_relay_test.cpp.

◆ deleteIdlePeers()

void ripple::test::OverlaySim::deleteIdlePeers ( UnsquelchCB  f)
overridevirtual

Implements ripple::test::Overlay.

Definition at line 552 of file reduce_relay_test.cpp.

◆ addPeer()

PeerSPtr ripple::test::OverlaySim::addPeer ( bool  useCache = true)

Definition at line 559 of file reduce_relay_test.cpp.

◆ deletePeer() [2/2]

void ripple::test::OverlaySim::deletePeer ( Peer::id_t  id,
bool  useCache = true 
)

Definition at line 580 of file reduce_relay_test.cpp.

◆ resetPeers()

void ripple::test::OverlaySim::resetPeers ( )

Definition at line 591 of file reduce_relay_test.cpp.

◆ deleteLastPeer()

std::optional<Peer::id_t> ripple::test::OverlaySim::deleteLastPeer ( )

Definition at line 600 of file reduce_relay_test.cpp.

◆ isCountingState()

bool ripple::test::OverlaySim::isCountingState ( PublicKey const &  validator)

Definition at line 620 of file reduce_relay_test.cpp.

◆ getSelected()

std::set<id_t> ripple::test::OverlaySim::getSelected ( PublicKey const &  validator)

Definition at line 626 of file reduce_relay_test.cpp.

◆ isSelected()

bool ripple::test::OverlaySim::isSelected ( PublicKey const &  validator,
Peer::id_t  peer 
)

Definition at line 632 of file reduce_relay_test.cpp.

◆ getSelectedPeer()

id_t ripple::test::OverlaySim::getSelectedPeer ( PublicKey const &  validator)

Definition at line 639 of file reduce_relay_test.cpp.

◆ getPeers()

std::unordered_map< id_t, std::tuple< reduce_relay::PeerState, std::uint16_t, std::uint32_t, std::uint32_t> > ripple::test::OverlaySim::getPeers ( PublicKey const &  validator)

Definition at line 653 of file reduce_relay_test.cpp.

◆ getNumPeers()

std::uint16_t ripple::test::OverlaySim::getNumPeers ( ) const

Definition at line 659 of file reduce_relay_test.cpp.

◆ squelch()

void ripple::test::OverlaySim::squelch ( PublicKey const &  validator,
Peer::id_t  id,
std::uint32_t  duration 
) const
overrideprivatevirtual

Squelch handler.

Parameters
validatorPublic key of the source validator
idPeer's id to squelch
durationSquelch duration in seconds

Implements ripple::reduce_relay::SquelchHandler.

Definition at line 666 of file reduce_relay_test.cpp.

◆ unsquelch()

void ripple::test::OverlaySim::unsquelch ( PublicKey const &  validator,
Peer::id_t  id 
) const
overrideprivatevirtual

Unsquelch handler.

Parameters
validatorPublic key of the source validator
idPeer's id to unsquelch

Implements ripple::reduce_relay::SquelchHandler.

Definition at line 675 of file reduce_relay_test.cpp.

Member Data Documentation

◆ squelch_

SquelchCB ripple::test::OverlaySim::squelch_
private

Definition at line 680 of file reduce_relay_test.cpp.

◆ unsquelch_

UnsquelchCB ripple::test::OverlaySim::unsquelch_
private

Definition at line 681 of file reduce_relay_test.cpp.

◆ peers_

Peers ripple::test::OverlaySim::peers_
private

Definition at line 682 of file reduce_relay_test.cpp.

◆ peersCache_

Peers ripple::test::OverlaySim::peersCache_
private

Definition at line 683 of file reduce_relay_test.cpp.

◆ slots_

reduce_relay::Slots<ManualClock> ripple::test::OverlaySim::slots_
private

Definition at line 684 of file reduce_relay_test.cpp.

◆ logs_

Logs& ripple::test::OverlaySim::logs_
private

Definition at line 685 of file reduce_relay_test.cpp.