CatapultServer  v0.5.0.1 (Elephant)
ServiceState.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "ServerHooks.h"
23 #include "ServiceState.h"
27 #include "catapult/thread/Task.h"
28 
29 namespace catapult {
30  namespace cache {
31  class CatapultCache;
32  class MemoryUtCacheProxy;
33  }
34  namespace extensions { class LocalNodeChainScore; }
35  namespace io { class BlockStorageCache; }
36  namespace ionet { class NodeContainer; }
37  namespace plugins { class PluginManager; }
38  namespace state { struct CatapultState; }
39  namespace subscribers {
40  class NodeSubscriber;
41  class StateChangeSubscriber;
42  class TransactionStatusSubscriber;
43  }
44  namespace thread { class MultiServicePool; }
45  namespace utils { class DiagnosticCounter; }
46 }
47 
48 namespace catapult { namespace extensions {
49 
51  class ServiceState {
52  public:
67  const std::vector<utils::DiagnosticCounter>& counters,
70  : m_config(config)
71  , m_nodes(nodes)
72  , m_cache(cache)
73  , m_state(state)
75  , m_score(score)
83  , m_pool(pool)
84  , m_packetHandlers(m_config.Node.MaxPacketDataSize.bytes32())
85  {}
86 
87  public:
89  const auto& config() const {
90  return m_config;
91  }
92 
94  auto& nodes() const {
95  return m_nodes;
96  }
97 
99  auto& cache() const {
100  return m_cache;
101  }
102 
104  auto& state() const {
105  return m_state;
106  }
107 
109  auto& storage() const {
110  return m_storage;
111  }
112 
114  auto& score() const {
115  return m_score;
116  }
117 
119  auto& utCache() const {
120  return m_utCache;
121  }
122 
124  auto timeSupplier() const {
125  return m_timeSupplier;
126  }
127 
131  }
132 
134  auto& stateChangeSubscriber() const {
136  }
137 
139  auto& nodeSubscriber() const {
140  return m_nodeSubscriber;
141  }
142 
145  const auto& counters() const {
146  return m_counters;
147  }
148 
150  const auto& pluginManager() const {
151  return m_pluginManager;
152  }
153 
155  auto& pool() {
156  return m_pool;
157  }
158 
160  auto& tasks() {;
161  return m_tasks;
162  }
163 
165  auto& packetHandlers() {
166  return m_packetHandlers;
167  }
168 
170  const auto& hooks() const {
171  return m_hooks;
172  }
173 
175  auto& hooks() {
176  return m_hooks;
177  }
178 
180  auto& packetIoPickers() {
181  return m_packetIoPickers;
182  }
183 
184  private:
185  // references
194 
198 
199  const std::vector<utils::DiagnosticCounter>& m_counters;
202 
203  // owned
204  std::vector<thread::Task> m_tasks;
208  };
209 }}
catapult::extensions::ServiceState::counters
const auto & counters() const
Definition: ServiceState.h:145
catapult::extensions::ServiceState::m_packetIoPickers
net::PacketIoPickerContainer m_packetIoPickers
Definition: ServiceState.h:207
PacketIoPickerContainer.h
catapult::extensions::ServiceState::ServiceState
ServiceState(const config::CatapultConfiguration &config, ionet::NodeContainer &nodes, cache::CatapultCache &cache, state::CatapultState &state, io::BlockStorageCache &storage, LocalNodeChainScore &score, cache::MemoryUtCacheProxy &utCache, const supplier< Timestamp > &timeSupplier, subscribers::TransactionStatusSubscriber &transactionStatusSubscriber, subscribers::StateChangeSubscriber &stateChangeSubscriber, subscribers::NodeSubscriber &nodeSubscriber, const std::vector< utils::DiagnosticCounter > &counters, const plugins::PluginManager &pluginManager, thread::MultiServicePool &pool)
Definition: ServiceState.h:55
catapult::extensions::ServiceState::m_utCache
cache::MemoryUtCacheProxy & m_utCache
Definition: ServiceState.h:192
catapult::extensions::ServiceState::m_timeSupplier
supplier< Timestamp > m_timeSupplier
Definition: ServiceState.h:193
catapult::extensions::ServiceState::m_cache
cache::CatapultCache & m_cache
Definition: ServiceState.h:188
catapult::extensions::ServiceState::cache
auto & cache() const
Gets the cache.
Definition: ServiceState.h:99
catapult::extensions::ServiceState::stateChangeSubscriber
auto & stateChangeSubscriber() const
Gets the state change subscriber.
Definition: ServiceState.h:134
catapult::cache::MemoryUtCacheProxy
A delegating proxy around a MemoryUtCache.
Definition: MemoryUtCache.h:107
catapult::extensions::ServiceState::packetIoPickers
auto & packetIoPickers()
Gets the packet io pickers.
Definition: ServiceState.h:180
Task.h
catapult::subscribers::StateChangeSubscriber
State change subscriber.
Definition: StateChangeSubscriber.h:31
catapult::subscribers::NodeSubscriber
Node subscriber.
Definition: NodeSubscriber.h:30
catapult::extensions::ServiceState::utCache
auto & utCache() const
Gets the unconfirmed transactions cache.
Definition: ServiceState.h:119
catapult::extensions::ServiceState::packetHandlers
auto & packetHandlers()
Gets the packet handlers.
Definition: ServiceState.h:165
catapult::thread::MultiServicePool
Definition: MultiServicePool.h:33
catapult::plugins::PluginManager
A manager for registering plugins.
Definition: PluginManager.h:51
catapult::extensions::ServiceState::hooks
auto & hooks()
Gets the server hooks.
Definition: ServiceState.h:175
catapult::extensions::ServiceState::storage
auto & storage() const
Gets the storage.
Definition: ServiceState.h:109
catapult::supplier
std::function< T()> supplier
A (stateless) supplier function.
Definition: functions.h:39
catapult::extensions::ServiceState::m_score
LocalNodeChainScore & m_score
Definition: ServiceState.h:191
catapult::extensions::ServiceState::m_storage
io::BlockStorageCache & m_storage
Definition: ServiceState.h:190
catapult::ionet::NodeContainer
A collection of nodes.
Definition: NodeContainer.h:109
catapult::extensions::ServiceState::tasks
auto & tasks()
Gets the tasks.
Definition: ServiceState.h:160
catapult::extensions::ServiceState::m_nodeSubscriber
subscribers::NodeSubscriber & m_nodeSubscriber
Definition: ServiceState.h:197
catapult::extensions::ServiceState::config
const auto & config() const
Gets the config.
Definition: ServiceState.h:89
PacketHandlers.h
catapult::extensions::ServiceState::m_tasks
std::vector< thread::Task > m_tasks
Definition: ServiceState.h:204
catapult::extensions::ServiceState::m_packetHandlers
ionet::ServerPacketHandlers m_packetHandlers
Definition: ServiceState.h:205
catapult::extensions::ServiceState::m_hooks
ServerHooks m_hooks
Definition: ServiceState.h:206
catapult::config::CatapultConfiguration
Comprehensive configuration for a catapult process.
Definition: CatapultConfiguration.h:34
catapult::extensions::ServiceState::m_counters
const std::vector< utils::DiagnosticCounter > & m_counters
Definition: ServiceState.h:199
catapult::io::BlockStorageCache
Definition: BlockStorageCache.h:97
catapult::extensions::ServiceState::score
auto & score() const
Gets the score.
Definition: ServiceState.h:114
catapult::cache::CatapultCache
Central cache holding all sub caches.
Definition: CatapultCache.h:40
catapult::extensions::ServiceState
State that is used as part of service registration.
Definition: ServiceState.h:51
catapult::state::CatapultState
Stateful catapult information.
Definition: CatapultState.h:27
ServerHooks.h
catapult::extensions::ServiceState::nodeSubscriber
auto & nodeSubscriber() const
Gets the node subscriber.
Definition: ServiceState.h:139
catapult::extensions::ServiceState::m_nodes
ionet::NodeContainer & m_nodes
Definition: ServiceState.h:187
catapult::extensions::ServiceState::state
auto & state() const
Gets the state.
Definition: ServiceState.h:104
catapult::extensions::ServiceState::nodes
auto & nodes() const
Gets the nodes.
Definition: ServiceState.h:94
CatapultConfiguration.h
catapult::extensions::ServiceState::m_pluginManager
const plugins::PluginManager & m_pluginManager
Definition: ServiceState.h:200
catapult::extensions::LocalNodeChainScore
Definition: LocalNodeChainScore.h:29
catapult::extensions::ServiceState::hooks
const auto & hooks() const
Gets the server hooks.
Definition: ServiceState.h:170
catapult::extensions::ServerHooks
Hooks that can be used to configure server behavior.
Definition: ServerHooks.h:77
catapult::extensions::ServiceState::m_config
const config::CatapultConfiguration & m_config
Definition: ServiceState.h:186
catapult::net::PacketIoPickerContainer
A collection of packet io pickers.
Definition: PacketIoPickerContainer.h:28
Node
ionet::Node Node
Definition: PacketWriters.cpp:45
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::extensions::ServiceState::m_transactionStatusSubscriber
subscribers::TransactionStatusSubscriber & m_transactionStatusSubscriber
Definition: ServiceState.h:195
catapult::extensions::ServiceState::m_pool
thread::MultiServicePool & m_pool
Definition: ServiceState.h:201
catapult::extensions::ServiceState::transactionStatusSubscriber
auto & transactionStatusSubscriber() const
Gets the transaction status subscriber.
Definition: ServiceState.h:129
catapult::extensions::ServiceState::m_state
state::CatapultState & m_state
Definition: ServiceState.h:189
catapult::extensions::ServiceState::pool
auto & pool()
Gets the multiservice pool.
Definition: ServiceState.h:155
catapult::ionet::ServerPacketHandlers
A collection of packet handlers where there is at most one handler per packet type.
Definition: PacketHandlers.h:62
catapult::extensions::ServiceState::pluginManager
const auto & pluginManager() const
Gets the plugin manager.
Definition: ServiceState.h:150
ServiceState.h
catapult::subscribers::TransactionStatusSubscriber
Transaction status subscriber.
Definition: TransactionStatusSubscriber.h:30
catapult::extensions::ServiceState::timeSupplier
auto timeSupplier() const
Gets the time supplier.
Definition: ServiceState.h:124
catapult::extensions::ServiceState::m_stateChangeSubscriber
subscribers::StateChangeSubscriber & m_stateChangeSubscriber
Definition: ServiceState.h:196