rippled
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
xrpl::PeerFinder::Counts Class Reference

Manages the count of available connections for the various slots. More...

#include <Counts.h>

Collaboration diagram for xrpl::PeerFinder::Counts:
Collaboration graph
[legend]

Public Member Functions

void add (Slot const &s)
 Adds the slot state and properties to the slot counts.
 
void remove (Slot const &s)
 Removes the slot state and properties from the slot counts.
 
bool can_activate (Slot const &s) const
 Returns true if the slot can become active.
 
std::size_t attempts_needed () const
 Returns the number of attempts needed to bring us to the max.
 
std::size_t attempts () const
 Returns the number of outbound connection attempts.
 
int out_max () const
 Returns the total number of outbound slots.
 
int out_active () const
 Returns the number of outbound peers assigned an open slot.
 
std::size_t fixed () const
 Returns the number of fixed connections.
 
std::size_t fixed_active () const
 Returns the number of active fixed connections.
 
void onConfig (Config const &config)
 Called when the config is set or changed.
 
int acceptCount () const
 Returns the number of accepted connections that haven't handshaked.
 
int connectCount () const
 Returns the number of connection attempts currently active.
 
int closingCount () const
 Returns the number of connections that are gracefully closing.
 
int in_max () const
 Returns the total number of inbound slots.
 
int inboundActive () const
 Returns the number of inbound peers assigned an open slot.
 
int totalActive () const
 Returns the total number of active peers excluding fixed peers.
 
int inboundSlotsFree () const
 Returns the number of unused inbound slots.
 
int outboundSlotsFree () const
 Returns the number of unused outbound slots.
 
bool isConnectedToNetwork () const
 Returns true if the slot logic considers us "connected" to the network.
 
void onWrite (beast::PropertyStream::Map &map)
 Output statistics.
 
std::string state_string () const
 Records the state for diagnostics.
 

Private Member Functions

void adjust (Slot const &s, int const n)
 

Private Attributes

int m_attempts {0}
 Outbound connection attempts.
 
std::size_t m_active {0}
 Active connections, including fixed and reserved.
 
std::size_t m_in_max {0}
 Total number of inbound slots.
 
std::size_t m_in_active {0}
 Number of inbound slots assigned to active peers.
 
std::size_t m_out_max {0}
 Maximum desired outbound slots.
 
std::size_t m_out_active {0}
 Active outbound slots.
 
std::size_t m_fixed {0}
 Fixed connections.
 
std::size_t m_fixed_active {0}
 Active fixed connections.
 
std::size_t m_reserved {0}
 Reserved connections.
 
int m_acceptCount {0}
 
int m_closingCount {0}
 

Detailed Description

Manages the count of available connections for the various slots.

Definition at line 13 of file Counts.h.

Member Function Documentation

◆ add()

void xrpl::PeerFinder::Counts::add ( Slot const &  s)

Adds the slot state and properties to the slot counts.

Definition at line 18 of file Counts.h.

◆ remove()

void xrpl::PeerFinder::Counts::remove ( Slot const &  s)

Removes the slot state and properties from the slot counts.

Definition at line 25 of file Counts.h.

◆ can_activate()

bool xrpl::PeerFinder::Counts::can_activate ( Slot const &  s) const

Returns true if the slot can become active.

Definition at line 32 of file Counts.h.

◆ attempts_needed()

std::size_t xrpl::PeerFinder::Counts::attempts_needed ( ) const

Returns the number of attempts needed to bring us to the max.

Definition at line 50 of file Counts.h.

◆ attempts()

std::size_t xrpl::PeerFinder::Counts::attempts ( ) const

Returns the number of outbound connection attempts.

Definition at line 59 of file Counts.h.

◆ out_max()

int xrpl::PeerFinder::Counts::out_max ( ) const

Returns the total number of outbound slots.

Definition at line 66 of file Counts.h.

◆ out_active()

int xrpl::PeerFinder::Counts::out_active ( ) const

Returns the number of outbound peers assigned an open slot.

Fixed peers do not count towards outbound slots used.

Definition at line 75 of file Counts.h.

◆ fixed()

std::size_t xrpl::PeerFinder::Counts::fixed ( ) const

Returns the number of fixed connections.

Definition at line 82 of file Counts.h.

◆ fixed_active()

std::size_t xrpl::PeerFinder::Counts::fixed_active ( ) const

Returns the number of active fixed connections.

Definition at line 89 of file Counts.h.

◆ onConfig()

void xrpl::PeerFinder::Counts::onConfig ( Config const &  config)

Called when the config is set or changed.

Definition at line 98 of file Counts.h.

◆ acceptCount()

int xrpl::PeerFinder::Counts::acceptCount ( ) const

Returns the number of accepted connections that haven't handshaked.

Definition at line 107 of file Counts.h.

◆ connectCount()

int xrpl::PeerFinder::Counts::connectCount ( ) const

Returns the number of connection attempts currently active.

Definition at line 114 of file Counts.h.

◆ closingCount()

int xrpl::PeerFinder::Counts::closingCount ( ) const

Returns the number of connections that are gracefully closing.

Definition at line 121 of file Counts.h.

◆ in_max()

int xrpl::PeerFinder::Counts::in_max ( ) const

Returns the total number of inbound slots.

Definition at line 128 of file Counts.h.

◆ inboundActive()

int xrpl::PeerFinder::Counts::inboundActive ( ) const

Returns the number of inbound peers assigned an open slot.

Definition at line 135 of file Counts.h.

◆ totalActive()

int xrpl::PeerFinder::Counts::totalActive ( ) const

Returns the total number of active peers excluding fixed peers.

Definition at line 142 of file Counts.h.

◆ inboundSlotsFree()

int xrpl::PeerFinder::Counts::inboundSlotsFree ( ) const

Returns the number of unused inbound slots.

Fixed peers do not deduct from inbound slots or count towards totals.

Definition at line 151 of file Counts.h.

◆ outboundSlotsFree()

int xrpl::PeerFinder::Counts::outboundSlotsFree ( ) const

Returns the number of unused outbound slots.

Fixed peers do not deduct from outbound slots or count towards totals.

Definition at line 162 of file Counts.h.

◆ isConnectedToNetwork()

bool xrpl::PeerFinder::Counts::isConnectedToNetwork ( ) const

Returns true if the slot logic considers us "connected" to the network.

Definition at line 174 of file Counts.h.

◆ onWrite()

void xrpl::PeerFinder::Counts::onWrite ( beast::PropertyStream::Map map)

Output statistics.

Definition at line 190 of file Counts.h.

◆ state_string()

std::string xrpl::PeerFinder::Counts::state_string ( ) const

Records the state for diagnostics.

Definition at line 204 of file Counts.h.

◆ adjust()

void xrpl::PeerFinder::Counts::adjust ( Slot const &  s,
int const  n 
)
private

Definition at line 216 of file Counts.h.

Member Data Documentation

◆ m_attempts

int xrpl::PeerFinder::Counts::m_attempts {0}
private

Outbound connection attempts.

Definition at line 267 of file Counts.h.

◆ m_active

std::size_t xrpl::PeerFinder::Counts::m_active {0}
private

Active connections, including fixed and reserved.

Definition at line 270 of file Counts.h.

◆ m_in_max

std::size_t xrpl::PeerFinder::Counts::m_in_max {0}
private

Total number of inbound slots.

Definition at line 273 of file Counts.h.

◆ m_in_active

std::size_t xrpl::PeerFinder::Counts::m_in_active {0}
private

Number of inbound slots assigned to active peers.

Definition at line 276 of file Counts.h.

◆ m_out_max

std::size_t xrpl::PeerFinder::Counts::m_out_max {0}
private

Maximum desired outbound slots.

Definition at line 279 of file Counts.h.

◆ m_out_active

std::size_t xrpl::PeerFinder::Counts::m_out_active {0}
private

Active outbound slots.

Definition at line 282 of file Counts.h.

◆ m_fixed

std::size_t xrpl::PeerFinder::Counts::m_fixed {0}
private

Fixed connections.

Definition at line 285 of file Counts.h.

◆ m_fixed_active

std::size_t xrpl::PeerFinder::Counts::m_fixed_active {0}
private

Active fixed connections.

Definition at line 288 of file Counts.h.

◆ m_reserved

std::size_t xrpl::PeerFinder::Counts::m_reserved {0}
private

Reserved connections.

Definition at line 291 of file Counts.h.

◆ m_acceptCount

int xrpl::PeerFinder::Counts::m_acceptCount {0}
private

Definition at line 295 of file Counts.h.

◆ m_closingCount

int xrpl::PeerFinder::Counts::m_closingCount {0}
private

Definition at line 298 of file Counts.h.