CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
26 #include <unordered_map>
30 struct NodeContainerData;
32 struct NodeInteractionResult;
36 namespace catapult {
namespace ionet {
NodeContainerView view() const
Gets a read only view of the nodes.
Definition: NodeContainer.cpp:249
size_t NodeId
Definition: NodeContainer.cpp:42
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
NodeContainerModifier modifier()
Gets a write only view of the nodes.
Definition: NodeContainer.cpp:254
const size_t MaxNodes
Definition: NodeContainer.cpp:54
ionet::Node Node
Definition: NodeContainer.cpp:40
void addConnectionStates(ServiceIdentifier serviceId, ionet::NodeRoles role)
Adds connection states for the service identified by serviceId to all nodes with role.
Definition: NodeContainer.cpp:145
Connection state unique to a node and connection identifier.
Definition: NodeInfo.h:59
utils::SpinReaderWriterLock::WriterLockGuard m_writeLock
Definition: NodeContainer.h:105
NodeSet FindAllActiveNodes(const NodeContainerView &view)
Finds all active nodes in view.
Definition: NodeContainer.cpp:263
~NodeContainer()
Destroys a node container.
const Key & identityKey() const
Gets the unique identifier (a public key).
Definition: Node.cpp:60
const NodeInfo & getNodeInfo(const Key &identityKey) const
Gets node info for the node with identityKey.
Definition: NodeContainer.cpp:84
def warning(*args)
Definition: colorPrint.py:10
NodeContainerData & m_nodeContainerData
Definition: NodeContainer.h:103
void ageConnectionBans(ServiceIdentifier serviceId, uint32_t maxConnectionBanAge, uint32_t numConsecutiveFailuresBeforeBanning)
Definition: NodeContainer.cpp:171
utils::SpinReaderWriterLock::ReaderLockGuard m_readLock
Definition: MemoryPtCache.cpp:258
NodeContainerModifier(NodeContainerData &nodeContainerData, utils::SpinReaderWriterLock::ReaderLockGuard &&readLock)
Creates a view around nodeContainerData with lock context readLock.
Definition: NodeContainer.cpp:101
bool contains(const Key &identityKey) const
Returns true if the node with identityKey is in the container, false otherwise.
Definition: NodeContainer.cpp:80
Information about a node and its interactions.
Definition: NodeInfo.h:82
void autoProvisionConnectionStates(NodeData &nodeData)
Definition: NodeContainer.cpp:189
std::function< T()> supplier
A (stateless) supplier function.
Definition: functions.h:39
utils::SpinReaderWriterLock::ReaderLockGuard m_readLock
Definition: NodeContainer.h:62
A collection of nodes.
Definition: NodeContainer.h:109
ConnectionState & provisionConnectionState(ServiceIdentifier serviceId)
Gets connection state for the service identified by serviceId and creates zeroed state if no state ex...
Definition: NodeInfo.cpp:91
NodeContainerView(const NodeContainerData &nodeContainerData, utils::SpinReaderWriterLock::ReaderLockGuard &&readLock)
Creates a view around nodeContainerData with lock context readLock.
Definition: NodeContainer.cpp:65
NodeData(const Node &node, NodeSource source, size_t nodeId)
Definition: NodeContainer.cpp:33
bool ensureAtLeastOneEmptySlot()
Definition: NodeContainer.cpp:194
ReaderLockGuard acquireReader()
Blocks until a reader lock can be acquired.
Definition: SpinReaderWriterLock.h:153
Timestamp time() const
Gets current container time.
Definition: NodeContainer.cpp:76
NodeSource source() const
Gets the node source.
Definition: NodeInfo.cpp:47
A writer lock guard.
Definition: SpinReaderWriterLock.h:83
std::vector< std::pair< ServiceIdentifier, ionet::NodeRoles > > ServiceRolesMap
Definition: NodeContainer.cpp:58
A read only view on top of node container.
Definition: NodeContainer.h:39
NodeContainerData(size_t maxNodes, const supplier< Timestamp > &timeSupplier)
Definition: NodeContainer.cpp:47
void ageConnections(ServiceIdentifier serviceId, const utils::KeySet &identities)
Ages all connections for the service identified by serviceId for nodes with identities.
Definition: NodeContainer.cpp:161
ConnectionState & provisionConnectionState(ServiceIdentifier serviceId, const Key &identityKey)
Gets connection state for the service identified by serviceId and the node with identityKey.
Definition: NodeContainer.cpp:153
std::unordered_set< Node, NodeHasher > NodeSet
A set of nodes.
Definition: Node.h:128
NodeInfo Info
Definition: NodeContainer.cpp:41
utils::SpinReaderWriterLock::WriterLockGuard m_writeLock
Definition: MemoryPtCache.cpp:259
Definition: NodeContainer.cpp:31
NodeRoles
A node's role.
Definition: NodeRoles.h:28
def info(*args)
Definition: forwardsValidation.py:12
ArraySet< Key > KeySet
A key set.
Definition: ArraySet.h:64
const NodeContainerData & m_nodeContainerData
Definition: NodeContainer.h:61
#define CATAPULT_THROW_INVALID_ARGUMENT_1(MESSAGE, PARAM1)
Macro used to throw a catapult invalid argument with a single parameter.
Definition: exceptions.h:183
utils::SpinReaderWriterLock::ReaderLockGuard m_readLock
Definition: NodeContainer.h:104
std::unordered_map< Key, NodeData, utils::ArrayHasher< Key > > NodeDataContainer
Definition: NodeContainer.cpp:57
void incrementInteraction(const Key &identityKey, const consumer< NodeInfo & > &incrementer)
Definition: NodeContainer.cpp:228
A class that can be moved but not copied.
Definition: NonCopyable.h:43
NodeSource
Definition: NodeInfo.h:47
void incrementSuccesses(const Key &identityKey)
Increments the number of successful interactions for the node identified by identityKey.
Definition: NodeContainer.cpp:179
utils::SpinReaderWriterLock m_lock
Definition: NodeContainer.h:129
const NodeMetadata & metadata() const
Gets tne metadata.
Definition: Node.cpp:68
A reader lock guard.
Definition: SpinReaderWriterLock.h:99
bool add(const Node &node, NodeSource source)
Definition: NodeContainer.cpp:109
utils::BaseValue< uint64_t, Timestamp_tag > Timestamp
Definition: src/catapult/types.h:73
Definition: AddressExtractionExtension.cpp:28
size_t size() const
Returns the number of nodes.
Definition: NodeContainer.cpp:72
A write only view on top of node container.
Definition: NodeContainer.h:66
Definition: NodeContainer.cpp:45
NodeContainer()
Creates a node container.
Definition: NodeContainer.cpp:240
A node in the catapult network.
Definition: Node.h:82
std::function< void(TArgs...)> consumer
A consumer function.
Definition: functions.h:35
const supplier< Timestamp > TimeSupplier
Definition: NodeContainer.cpp:55
void incrementFailures(const Key &identityKey)
Increments the number of failed interactions for the node identified by identityKey.
Definition: NodeContainer.cpp:184
Definition: SpinReaderWriterLock.h:36
size_t NextNodeId
Definition: NodeContainer.cpp:56
std::unique_ptr< NodeContainerData > m_pImpl
Definition: NodeContainer.h:128
void forEach(const consumer< const Node &, const NodeInfo & > &consumer) const
Iterates over all nodes and passes them to consumer.
Definition: NodeContainer.cpp:92