CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
29 namespace cache {
class CatapultCache; }
36 namespace catapult {
namespace extensions {
SelectorSettings(const cache::CatapultCache &cache, Importance totalChainImportance, ionet::NodeContainer &nodes, ionet::ServiceIdentifier serviceId, ionet::NodeRoles requiredRole, const config::NodeConfiguration::ConnectionsSubConfiguration &config)
Creates settings around cache, totalChainImportance, nodes, serviceId, requiredRole and config.
Definition: PeersConnectionTasks.cpp:50
#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
ionet::ServiceIdentifier ServiceId
Definition: PeersConnectionTasks.cpp:106
Manages a collection of connections that send data to external nodes.
Definition: PacketWriters.h:41
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
AddState m_state
Definition: PeersConnectionTasks.cpp:166
def debug(*args)
Definition: Parser.py:46
utils::BaseValue< uint32_t, ServiceIdentifier_tag > ServiceIdentifier
Definition: NodeInfo.h:56
PeerConnectCode
Enumeration of possible peer connection codes.
Definition: PeerConnectCode.h:44
ionet::NodeContainer & Nodes
Container of nodes from which to select.
Definition: PeersConnectionTasks.h:75
NodeSelectionResult SelectNodes(const ionet::NodeContainer &nodes, const NodeSelectionConfiguration &config, const ImportanceRetriever &importanceRetriever)
Definition: NodeSelector.cpp:175
def warning(*args)
Definition: colorPrint.py:10
Node selection configuration.
Definition: NodeSelector.h:84
Node aging configuration.
Definition: NodeSelector.h:72
uint16_t MaxConnections
Maximum number of active connections.
Definition: NodeConfiguration.h:160
ConnectResult
Enumeration of possible connection results.
Definition: ConnectResult.h:41
thread::Task CreateConnectPeersTask(const SelectorSettings &settings, net::PacketWriters &packetWriters)
Creates a task for the specified service that connects to nodes with the specified role given setting...
Definition: PeersConnectionTasks.cpp:186
consumer< const utils::KeySet & > NodeAger
Definition: PeersConnectionTasks.h:41
supplier< utils::KeySet > RemoveOnlyNodeSelector
A remove-only node selector.
Definition: PeersConnectionTasks.h:115
std::function< T()> supplier
A (stateless) supplier function.
Definition: functions.h:39
utils::KeySet SelectNodesForRemoval(const ionet::NodeContainer &nodes, const NodeAgingConfiguration &config, const ImportanceRetriever &importanceRetriever)
Definition: NodeSelector.cpp:198
Immutable wrapper for basic types, to provide some type-safety.
Definition: BaseValue.h:100
A collection of nodes.
Definition: NodeContainer.h:109
uint16_t MaxConnectionAge
Maximum connection age.
Definition: NodeConfiguration.h:163
future< std::vector< future< T > > > when_all(std::vector< future< T >> &&allFutures)
Returns a future that is signaled when all futures in allFutures complete.
Definition: FutureUtils.h:31
Level for logging informational events.
std::function< ImportanceDescriptor(const Key &)> ImportanceRetriever
Retrieves an importance descriptor given a specified public key.
Definition: NodeSelector.h:41
NodeSelector CreateNodeSelector(const SelectorSettings &settings)
Definition: PeersConnectionTasks.cpp:170
net::PacketWriters & PacketWriters
Definition: PeersConnectionTasks.cpp:105
uint16_t NumConsecutiveFailuresBeforeBanning
Number of consecutive connection failures before a connection is banned.
Definition: NodeConfiguration.h:169
Task CreateNamedTask(const std::string &name, const TaskCallback &callback)
Creates an unscheduled task with name and callback.
Definition: Task.cpp:52
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
std::unordered_set< Node, NodeHasher > NodeSet
A set of nodes.
Definition: Node.h:128
ionet::ServiceIdentifier ServiceId
Service identifier for selection.
Definition: PeersConnectionTasks.h:78
uint16_t MaxConnectionBanAge
Maximum connection ban age.
Definition: NodeConfiguration.h:166
virtual bool closeOne(const Key &identityKey)=0
Closes any active connections to the node identified by identityKey.
LogLevel
Catapult log levels.
Definition: Logging.h:36
NodeRoles
A node's role.
Definition: NodeRoles.h:28
supplier< NodeSelectionResult > NodeSelector
A node selector.
Definition: PeersConnectionTasks.h:95
Central cache holding all sub caches.
Definition: CatapultCache.h:40
Settings used to initialize a selector task.
Definition: PeersConnectionTasks.h:54
thread::Task CreateAgePeersTask(const SelectorSettings &settings, net::ConnectionContainer &connectionContainer)
Creates a task for the specified service that ages nodes given settings and connectionContainer.
Definition: PeersConnectionTasks.cpp:230
Describes an importance value.
Definition: NodeSelector.h:32
config::NodeConfiguration::ConnectionsSubConfiguration Config
Connections configuration.
Definition: PeersConnectionTasks.h:84
#define CATAPULT_LOG_LEVEL(LEVEL)
Writes a log entry to the default logger with LEVEL severity.
Definition: Logging.h:336
future< T > make_ready_future(T &&value)
Produces a future that is ready immediately and holds the given value.
Definition: Future.h:126
Synchronized cache composed of stateful account information.
Definition: AccountStateCache.h:72
Manages a collection of connections.
Definition: ConnectionContainer.h:27
const TCache::CacheViewType & sub() const
Gets a specific sub cache view.
Definition: CatapultCacheView.h:52
NodeAger CreateNodeAger(ionet::ServiceIdentifier serviceId, const config::NodeConfiguration::ConnectionsSubConfiguration &config, ionet::NodeContainer &nodes)
Creates and prepares a node ager that ages all serviceId connections in nodes given config.
Definition: PeersConnectionTasks.cpp:34
ionet::NodeContainer & Nodes
Definition: PeersConnectionTasks.cpp:104
CatapultCacheView createView() const
Returns a locked cache view based on this cache.
Definition: CatapultCache.cpp:246
Connections configuration.
Definition: NodeConfiguration.h:158
ionet::NodeRoles RequiredRole
Required role for selection (if applicable).
Definition: PeersConnectionTasks.h:81
Definition: AddressExtractionExtension.cpp:28
extensions::ImportanceRetriever ImportanceRetriever
Retrieves an account importance given a public key.
Definition: PeersConnectionTasks.h:87
constexpr utils::LogLevel MapToLogLevel(ValidationResult result)
Maps validation result to an appropriate logging level.
Definition: ValidationResult.h:100
thread::Task CreateAgePeersTask(const SelectorSettings &settings, net::ConnectionContainer &connectionContainer, const RemoveOnlyNodeSelector &selector)
Definition: PeersConnectionTasks.cpp:235
A read-only overlay on top of an account cache.
Definition: ReadOnlyAccountStateCache.h:36
RemoveOnlyNodeSelector CreateRemoveOnlyNodeSelector(const SelectorSettings &settings)
Definition: PeersConnectionTasks.cpp:218
std::function< void(TArgs...)> consumer
A consumer function.
Definition: functions.h:35
A task that can be dispatched to the scheduler.
Definition: Task.h:45
Level for logging warning events.
A view on top of an account state cache for retrieving importances.
Definition: ImportanceView.h:29
Importance getAccountImportanceOrDefault(const Key &publicKey, Height height) const
Gets the importance for publicKey at height or a default importance if no importance is set.
Definition: ImportanceView.cpp:76
virtual utils::KeySet identities() const =0
Gets the identities of active connections.