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

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

#include <Counts.h>

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

Public Member Functions

 Counts ()
 
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
 Outbound connection attempts.
 
std::size_t m_active
 Active connections, including fixed and reserved.
 
std::size_t m_in_max
 Total number of inbound slots.
 
std::size_t m_in_active
 Number of inbound slots assigned to active peers.
 
std::size_t m_out_max
 Maximum desired outbound slots.
 
std::size_t m_out_active
 Active outbound slots.
 
std::size_t m_fixed
 Fixed connections.
 
std::size_t m_fixed_active
 Active fixed connections.
 
std::size_t m_reserved
 Reserved connections.
 
int m_acceptCount
 
int m_closingCount
 

Detailed Description

Manages the count of available connections for the various slots.

Definition at line 14 of file Counts.h.

Constructor & Destructor Documentation

◆ Counts()

ripple::PeerFinder::Counts::Counts ( )

Definition at line 17 of file Counts.h.

Member Function Documentation

◆ add()

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

Adds the slot state and properties to the slot counts.

Definition at line 37 of file Counts.h.

◆ remove()

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

Removes the slot state and properties from the slot counts.

Definition at line 44 of file Counts.h.

◆ can_activate()

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

Returns true if the slot can become active.

Definition at line 51 of file Counts.h.

◆ attempts_needed()

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

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

Definition at line 69 of file Counts.h.

◆ attempts()

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

Returns the number of outbound connection attempts.

Definition at line 78 of file Counts.h.

◆ out_max()

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

Returns the total number of outbound slots.

Definition at line 85 of file Counts.h.

◆ out_active()

int ripple::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 94 of file Counts.h.

◆ fixed()

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

Returns the number of fixed connections.

Definition at line 101 of file Counts.h.

◆ fixed_active()

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

Returns the number of active fixed connections.

Definition at line 108 of file Counts.h.

◆ onConfig()

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

Called when the config is set or changed.

Definition at line 117 of file Counts.h.

◆ acceptCount()

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

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

Definition at line 126 of file Counts.h.

◆ connectCount()

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

Returns the number of connection attempts currently active.

Definition at line 133 of file Counts.h.

◆ closingCount()

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

Returns the number of connections that are gracefully closing.

Definition at line 140 of file Counts.h.

◆ in_max()

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

Returns the total number of inbound slots.

Definition at line 147 of file Counts.h.

◆ inboundActive()

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

Returns the number of inbound peers assigned an open slot.

Definition at line 154 of file Counts.h.

◆ totalActive()

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

Returns the total number of active peers excluding fixed peers.

Definition at line 161 of file Counts.h.

◆ inboundSlotsFree()

int ripple::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 170 of file Counts.h.

◆ outboundSlotsFree()

int ripple::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 181 of file Counts.h.

◆ isConnectedToNetwork()

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

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

Definition at line 193 of file Counts.h.

◆ onWrite()

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

Output statistics.

Definition at line 209 of file Counts.h.

◆ state_string()

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

Records the state for diagnostics.

Definition at line 223 of file Counts.h.

◆ adjust()

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

Definition at line 236 of file Counts.h.

Member Data Documentation

◆ m_attempts

int ripple::PeerFinder::Counts::m_attempts
private

Outbound connection attempts.

Definition at line 290 of file Counts.h.

◆ m_active

std::size_t ripple::PeerFinder::Counts::m_active
private

Active connections, including fixed and reserved.

Definition at line 293 of file Counts.h.

◆ m_in_max

std::size_t ripple::PeerFinder::Counts::m_in_max
private

Total number of inbound slots.

Definition at line 296 of file Counts.h.

◆ m_in_active

std::size_t ripple::PeerFinder::Counts::m_in_active
private

Number of inbound slots assigned to active peers.

Definition at line 299 of file Counts.h.

◆ m_out_max

std::size_t ripple::PeerFinder::Counts::m_out_max
private

Maximum desired outbound slots.

Definition at line 302 of file Counts.h.

◆ m_out_active

std::size_t ripple::PeerFinder::Counts::m_out_active
private

Active outbound slots.

Definition at line 305 of file Counts.h.

◆ m_fixed

std::size_t ripple::PeerFinder::Counts::m_fixed
private

Fixed connections.

Definition at line 308 of file Counts.h.

◆ m_fixed_active

std::size_t ripple::PeerFinder::Counts::m_fixed_active
private

Active fixed connections.

Definition at line 311 of file Counts.h.

◆ m_reserved

std::size_t ripple::PeerFinder::Counts::m_reserved
private

Reserved connections.

Definition at line 314 of file Counts.h.

◆ m_acceptCount

int ripple::PeerFinder::Counts::m_acceptCount
private

Definition at line 318 of file Counts.h.

◆ m_closingCount

int ripple::PeerFinder::Counts::m_closingCount
private

Definition at line 321 of file Counts.h.