CatapultServer  v0.5.0.1 (Elephant)
LocalNode.h
Go to the documentation of this file.
1 
21 #pragma once
24 #include <memory>
25 #include <vector>
26 
27 namespace catapult {
28  namespace cache { class CatapultCache; }
29  namespace crypto { class KeyPair; }
30  namespace extensions { class ProcessBootstrapper; }
31  namespace ionet { class NodeContainerView; }
32  namespace model { class ChainScore; }
33 }
34 
35 namespace catapult { namespace local {
36 
37  // region LocalNodeCounterValue(s)
38 
42  public:
45  : m_id(counter.id())
46  , m_value(counter.value())
47  {}
48 
49  public:
51  const utils::DiagnosticCounterId& id() const {
52  return m_id;
53  }
54 
56  uint64_t value() const {
57  return m_value;
58  }
59 
60  private:
62  uint64_t m_value;
63  };
64 
66  using LocalNodeCounterValues = std::vector<LocalNodeCounterValue>;
67 
68  // endregion
69 
70  // region LocalNode
71 
73  class LocalNode : public ProcessHost {
74  public:
76  virtual const cache::CatapultCache& cache() const = 0;
77 
79  virtual model::ChainScore score() const = 0;
80 
82  virtual LocalNodeCounterValues counters() const = 0;
83 
85  virtual ionet::NodeContainerView nodes() const = 0;
86  };
87 
89  std::unique_ptr<LocalNode> CreateLocalNode(
90  const crypto::KeyPair& keyPair,
91  std::unique_ptr<extensions::ProcessBootstrapper>&& pBootstrapper);
92 
93  // endregion
94 }}
m_pTransactionStatusSubscriber
std::unique_ptr< subscribers::TransactionStatusSubscriber > m_pTransactionStatusSubscriber
Definition: LocalNode.cpp:245
catapult::local::LocalNodeCounterValue::id
const utils::DiagnosticCounterId & id() const
Gets the counter id.
Definition: LocalNode.h:51
m_pluginManager
plugins::PluginManager & m_pluginManager
Definition: LocalNode.cpp:249
m_pStateChangeSubscriber
std::unique_ptr< subscribers::StateChangeSubscriber > m_pStateChangeSubscriber
Definition: LocalNode.cpp:246
catapult::utils::DiagnosticCounterId
A diagnostic counter id.
Definition: DiagnosticCounterId.h:27
CATAPULT_LOG
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
FileQueue.h
catapult::local::LocalNode::nodes
virtual ionet::NodeContainerView nodes() const =0
Gets the current nodes.
HostUtils.h
Parser.debug
def debug(*args)
Definition: Parser.py:46
m_dataDirectory
config::CatapultDataDirectory m_dataDirectory
Definition: LocalNode.cpp:236
m_pBlockChangeSubscriber
io::BlockChangeSubscriber * m_pBlockChangeSubscriber
Definition: LocalNode.cpp:234
DiagnosticCounter.h
m_serviceLocator
extensions::ServiceLocator m_serviceLocator
Definition: LocalNode.cpp:232
catapult::local::SeedNodeContainer
void SeedNodeContainer(ionet::NodeContainer &nodes, const extensions::ProcessBootstrapper &bootstrapper)
Seeds nodes with node information from bootstrapper.
Definition: NodeUtils.cpp:46
m_pBootstrapper
std::unique_ptr< extensions::ProcessBootstrapper > m_pBootstrapper
Definition: LocalNode.cpp:231
ServiceLocator.h
catapult::extensions::SaveStateToDirectoryWithCheckpointing
void SaveStateToDirectoryWithCheckpointing(const config::CatapultDataDirectory &dataDirectory, const config::NodeConfiguration &nodeConfig, const cache::CatapultCache &cache, const state::CatapultState &state, const model::ChainScore &score)
Serializes state composed of cache, state and score with checkpointing to dataDirectory given nodeCon...
Definition: LocalNodeStateFileStorage.cpp:192
CatapultDataDirectory.h
catapult::local::LocalNode::counters
virtual LocalNodeCounterValues counters() const =0
Gets the current node counters.
catapult::model::ChainScore
Definition: ChainScore.h:30
NodeUtils.h
catapult::local::LocalNodeCounterValues
std::vector< LocalNodeCounterValue > LocalNodeCounterValues
Container of local node counter values.
Definition: LocalNode.h:66
catapult::utils::LogLevel::Info
Level for logging informational events.
catapult::local::LocalNode::score
virtual model::ChainScore score() const =0
Gets the current chain score.
catapult::ionet::NodeContainerView
A read only view on top of node container.
Definition: NodeContainer.h:39
catapult::crypto::KeyPair
Represents a pair of private key with associated public key.
Definition: KeyPair.h:33
m_pUtCache
std::unique_ptr< cache::MemoryUtCacheProxy > m_pUtCache
Definition: LocalNode.cpp:243
catapult::local::CreateLocalNode
std::unique_ptr< LocalNode > CreateLocalNode(const crypto::KeyPair &keyPair, std::unique_ptr< extensions::ProcessBootstrapper > &&pBootstrapper)
Creates and boots a local node around the specified key pair (keyPair) and bootstrapper (pBootstrappe...
Definition: LocalNode.cpp:255
catapult::local::CreateNodeContainerSubscriberAdapter
std::unique_ptr< subscribers::NodeSubscriber > CreateNodeContainerSubscriberAdapter(ionet::NodeContainer &nodes)
Adapts nodes to a node subscriber.
Definition: NodeUtils.cpp:84
catapult::extensions::LoadStateFromDirectory
StateHeights LoadStateFromDirectory(const config::CatapultDirectory &directory, const LocalNodeStateRef &stateRef, const plugins::PluginManager &pluginManager)
Loads catapult state into stateRef from directory given pluginManager.
Definition: LocalNodeStateFileStorage.cpp:96
catapult::local::AddMemoryCounters
void AddMemoryCounters(std::vector< utils::DiagnosticCounter > &counters)
Adds process memory counters to counters.
Definition: MemoryCounters.cpp:89
catapult::io::FileBlockStorageMode::None
None.
catapult::local::LocalNode
Represents a local node.
Definition: LocalNode.h:73
catapult::local::ProcessHost
Catapult process host.
Definition: ProcessHost.h:27
m_pNodeSubscriber
std::unique_ptr< subscribers::NodeSubscriber > m_pNodeSubscriber
Definition: LocalNode.cpp:247
forwardsValidation.info
def info(*args)
Definition: forwardsValidation.py:12
NodeContainer.h
catapult::cache::CatapultCache
Central cache holding all sub caches.
Definition: CatapultCache.h:40
catapult::local::CreateFileStateChangeStorage
std::unique_ptr< subscribers::StateChangeSubscriber > CreateFileStateChangeStorage(std::unique_ptr< io::OutputStream > &&pOutputStream, const supplier< CacheChangesStorages > &cacheChangesStoragesSupplier)
Definition: FileStateChangeStorage.cpp:77
catapult::extensions::StateHeights::Cache
Height Cache
Cache height.
Definition: LocalNodeStateFileStorage.h:44
StackLogger.h
m_pluginModules
std::vector< plugins::PluginModule > m_pluginModules
Definition: LocalNode.cpp:230
m_storage
io::BlockStorageCache m_storage
Definition: LocalNode.cpp:241
catapult::local::LocalNodeCounterValue::value
uint64_t value() const
Gets the counter value.
Definition: LocalNode.h:56
catapult::extensions::HasSerializedState
bool HasSerializedState(const config::CatapultDirectory &directory)
Returns true if serialized state is present in directory.
Definition: LocalNodeStateFileStorage.cpp:55
LocalNodeStateRef.h
catapult::utils::DiagnosticCounter
A diagnostic counter.
Definition: DiagnosticCounter.h:28
m_score
extensions::LocalNodeChainScore m_score
Definition: LocalNode.cpp:242
catapult::local::LocalNodeCounterValue::m_id
utils::DiagnosticCounterId m_id
Definition: LocalNode.h:61
CATAPULT_THROW_RUNTIME_ERROR
#define CATAPULT_THROW_RUNTIME_ERROR(MESSAGE)
Macro used to throw a catapult runtime error.
Definition: exceptions.h:167
catapult::local::LocalNodeCounterValue
Definition: LocalNode.h:41
LocalNode.h
m_catapultCache
cache::CatapultCache m_catapultCache
Definition: LocalNode.cpp:239
catapult::extensions::GetUtCacheOptions
cache::MemoryCacheOptions GetUtCacheOptions(const config::NodeConfiguration &config)
Extracts unconfirmed transactions cache options from config.
Definition: extensions/ConfigurationUtils.cpp:26
Node
ionet::Node Node
Definition: PacketWriters.cpp:45
ChainScore
model::ChainScore ChainScore
Definition: tools/health/main.cpp:43
catapult::local::LoadAllPlugins
std::vector< plugins::PluginModule > LoadAllPlugins(extensions::ProcessBootstrapper &bootstrapper)
Loads all plugins using bootstrapper.
Definition: HostUtils.cpp:64
catapult
Definition: AddressExtractionExtension.cpp:28
LocalNodeChainScore.h
catapult::local::LocalNode::cache
virtual const cache::CatapultCache & cache() const =0
Gets the current cache.
LocalNodeStateFileStorage.h
FileStateChangeStorage.h
catapult::local::LocalNodeCounterValue::m_value
uint64_t m_value
Definition: LocalNode.h:62
m_config
const config::CatapultConfiguration & m_config
Definition: LocalNode.cpp:235
BlockStorageCache.h
ProcessBootstrapper.h
m_nodes
ionet::NodeContainer m_nodes
Definition: LocalNode.cpp:237
catapult::local::LocalNodeCounterValue::LocalNodeCounterValue
LocalNodeCounterValue(const utils::DiagnosticCounter &counter)
Creates a counter value from counter.
Definition: LocalNode.h:44
NemesisBlockNotifier.h
m_isBooted
bool m_isBooted
Definition: LocalNode.cpp:251
m_counters
std::vector< utils::DiagnosticCounter > m_counters
Definition: LocalNode.cpp:250
ServiceState.h
m_catapultState
state::CatapultState m_catapultState
Definition: LocalNode.cpp:240
MemoryCounters.h
ProcessHost.h
ConfigurationUtils.h