CatapultServer  v0.5.0.1 (Elephant)
catapult::ionet::NodeContainerModifier Class Reference

A write only view on top of node container. More...

Inheritance diagram for catapult::ionet::NodeContainerModifier:
Collaboration diagram for catapult::ionet::NodeContainerModifier:

Public Member Functions

 NodeContainerModifier (NodeContainerData &nodeContainerData, utils::SpinReaderWriterLock::ReaderLockGuard &&readLock)
 Creates a view around nodeContainerData with lock context readLock. More...
 
bool add (const Node &node, NodeSource source)
 
void addConnectionStates (ServiceIdentifier serviceId, ionet::NodeRoles role)
 Adds connection states for the service identified by serviceId to all nodes with role. More...
 
ConnectionStateprovisionConnectionState (ServiceIdentifier serviceId, const Key &identityKey)
 Gets connection state for the service identified by serviceId and the node with identityKey. More...
 
void ageConnections (ServiceIdentifier serviceId, const utils::KeySet &identities)
 Ages all connections for the service identified by serviceId for nodes with identities. More...
 
void ageConnectionBans (ServiceIdentifier serviceId, uint32_t maxConnectionBanAge, uint32_t numConsecutiveFailuresBeforeBanning)
 
void incrementSuccesses (const Key &identityKey)
 Increments the number of successful interactions for the node identified by identityKey. More...
 
void incrementFailures (const Key &identityKey)
 Increments the number of failed interactions for the node identified by identityKey. More...
 

Private Member Functions

void autoProvisionConnectionStates (NodeData &nodeData)
 
bool ensureAtLeastOneEmptySlot ()
 
void incrementInteraction (const Key &identityKey, const consumer< NodeInfo & > &incrementer)
 
- Private Member Functions inherited from catapult::utils::MoveOnly
constexpr MoveOnly ()=default
 Default constructor. More...
 
 ~MoveOnly ()=default
 Default destructor. More...
 
 MoveOnly (const NonCopyable &)=delete
 Disabled copy constructor. More...
 
 MoveOnly (MoveOnly &&)=default
 Default move constructor. More...
 
MoveOnlyoperator= (const MoveOnly &)=delete
 Disabled assignment operator. More...
 
MoveOnlyoperator= (MoveOnly &&)=default
 Default move assignment operator. More...
 

Private Attributes

NodeContainerDatam_nodeContainerData
 
utils::SpinReaderWriterLock::ReaderLockGuard m_readLock
 
utils::SpinReaderWriterLock::WriterLockGuard m_writeLock
 

Detailed Description

A write only view on top of node container.

Constructor & Destructor Documentation

◆ NodeContainerModifier()

catapult::ionet::NodeContainerModifier::NodeContainerModifier ( NodeContainerData nodeContainerData,
utils::SpinReaderWriterLock::ReaderLockGuard &&  readLock 
)

Creates a view around nodeContainerData with lock context readLock.

Member Function Documentation

◆ add()

bool catapult::ionet::NodeContainerModifier::add ( const Node node,
NodeSource  source 
)

Adds a node to the collection with source.

Note
Node sources can be promoted but never demoted.
Here is the call graph for this function:

◆ addConnectionStates()

void catapult::ionet::NodeContainerModifier::addConnectionStates ( ServiceIdentifier  serviceId,
ionet::NodeRoles  role 
)

Adds connection states for the service identified by serviceId to all nodes with role.

Here is the caller graph for this function:

◆ ageConnectionBans()

void catapult::ionet::NodeContainerModifier::ageConnectionBans ( ServiceIdentifier  serviceId,
uint32_t  maxConnectionBanAge,
uint32_t  numConsecutiveFailuresBeforeBanning 
)

Ages all connection bans for the service identified by serviceId given maxConnectionBanAge and numConsecutiveFailuresBeforeBanning.

◆ ageConnections()

void catapult::ionet::NodeContainerModifier::ageConnections ( ServiceIdentifier  serviceId,
const utils::KeySet identities 
)

Ages all connections for the service identified by serviceId for nodes with identities.

Here is the caller graph for this function:

◆ autoProvisionConnectionStates()

void catapult::ionet::NodeContainerModifier::autoProvisionConnectionStates ( NodeData nodeData)
private
Here is the caller graph for this function:

◆ ensureAtLeastOneEmptySlot()

bool catapult::ionet::NodeContainerModifier::ensureAtLeastOneEmptySlot ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ incrementFailures()

void catapult::ionet::NodeContainerModifier::incrementFailures ( const Key identityKey)

Increments the number of failed interactions for the node identified by identityKey.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ incrementInteraction()

void catapult::ionet::NodeContainerModifier::incrementInteraction ( const Key identityKey,
const consumer< NodeInfo & > &  incrementer 
)
private
Here is the caller graph for this function:

◆ incrementSuccesses()

void catapult::ionet::NodeContainerModifier::incrementSuccesses ( const Key identityKey)

Increments the number of successful interactions for the node identified by identityKey.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ provisionConnectionState()

ConnectionState & catapult::ionet::NodeContainerModifier::provisionConnectionState ( ServiceIdentifier  serviceId,
const Key identityKey 
)

Gets connection state for the service identified by serviceId and the node with identityKey.

Member Data Documentation

◆ m_nodeContainerData

NodeContainerData& catapult::ionet::NodeContainerModifier::m_nodeContainerData
private

◆ m_readLock

utils::SpinReaderWriterLock::ReaderLockGuard catapult::ionet::NodeContainerModifier::m_readLock
private

◆ m_writeLock

utils::SpinReaderWriterLock::WriterLockGuard catapult::ionet::NodeContainerModifier::m_writeLock
private

The documentation for this class was generated from the following files: