CatapultServer
v0.5.0.1 (Elephant)
|
Information about a node and its interactions. More...
Public Types | |
using | ServiceIdentifiers = std::unordered_set< ServiceIdentifier, utils::BaseValueHasher< ServiceIdentifier > > |
A container of service identifiers. More... | |
Public Member Functions | |
NodeInfo (NodeSource source) | |
Creates a node info with source. More... | |
NodeSource | source () const |
Gets the node source. More... | |
NodeInteractions | interactions (Timestamp timestamp) const |
Gets the node interactions at timestamp. More... | |
size_t | numConnectionStates () const |
Gets the number of connection states. More... | |
ServiceIdentifiers | services () const |
Gets the associated service ids. More... | |
bool | hasActiveConnection () const |
Returns true if at least one connection is active. More... | |
const ConnectionState * | getConnectionState (ServiceIdentifier serviceId) const |
Gets connection state for the service identified by serviceId or nullptr if no state exists. More... | |
void | source (NodeSource source) |
Sets the node source to source. More... | |
void | incrementSuccesses (Timestamp timestamp) |
Increments the number of successful interactions at timestamp. More... | |
void | incrementFailures (Timestamp timestamp) |
Increments the number of failed interactions at timestamp. More... | |
ConnectionState & | provisionConnectionState (ServiceIdentifier serviceId) |
Gets connection state for the service identified by serviceId and creates zeroed state if no state exists. More... | |
void | clearAge (ServiceIdentifier serviceId) |
Clears the age of the connection for the service identified by serviceId. More... | |
void | updateBan (ServiceIdentifier serviceId, uint32_t maxConnectionBanAge, uint32_t numConsecutiveFailuresBeforeBanning) |
Private Attributes | |
NodeSource | m_source |
NodeInteractionsContainer | m_interactions |
std::vector< std::pair< ServiceIdentifier, ConnectionState > > | m_connectionStates |
Information about a node and its interactions.
using catapult::ionet::NodeInfo::ServiceIdentifiers = std::unordered_set<ServiceIdentifier, utils::BaseValueHasher<ServiceIdentifier> > |
A container of service identifiers.
|
explicit |
Creates a node info with source.
void catapult::ionet::NodeInfo::clearAge | ( | ServiceIdentifier | serviceId | ) |
Clears the age of the connection for the service identified by serviceId.
const ConnectionState * catapult::ionet::NodeInfo::getConnectionState | ( | ServiceIdentifier | serviceId | ) | const |
Gets connection state for the service identified by serviceId or nullptr
if no state exists.
bool catapult::ionet::NodeInfo::hasActiveConnection | ( | ) | const |
Returns true if at least one connection is active.
void catapult::ionet::NodeInfo::incrementFailures | ( | Timestamp | timestamp | ) |
Increments the number of failed interactions at timestamp.
void catapult::ionet::NodeInfo::incrementSuccesses | ( | Timestamp | timestamp | ) |
Increments the number of successful interactions at timestamp.
NodeInteractions catapult::ionet::NodeInfo::interactions | ( | Timestamp | timestamp | ) | const |
Gets the node interactions at timestamp.
size_t catapult::ionet::NodeInfo::numConnectionStates | ( | ) | const |
Gets the number of connection states.
ConnectionState & catapult::ionet::NodeInfo::provisionConnectionState | ( | ServiceIdentifier | serviceId | ) |
Gets connection state for the service identified by serviceId and creates zeroed state if no state exists.
NodeInfo::ServiceIdentifiers catapult::ionet::NodeInfo::services | ( | ) | const |
Gets the associated service ids.
NodeSource catapult::ionet::NodeInfo::source | ( | ) | const |
Gets the node source.
void catapult::ionet::NodeInfo::source | ( | NodeSource | source | ) |
Sets the node source to source.
void catapult::ionet::NodeInfo::updateBan | ( | ServiceIdentifier | serviceId, |
uint32_t | maxConnectionBanAge, | ||
uint32_t | numConsecutiveFailuresBeforeBanning | ||
) |
Updates the connection ban (if applicable) for the service identified by serviceId given maxConnectionBanAge and numConsecutiveFailuresBeforeBanning.
|
private |
|
private |
|
private |