CatapultServer  v0.5.0.1 (Elephant)
ProcessBootstrapper.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "ExtensionManager.h"
28 #include "catapult/plugins.h"
29 
30 namespace catapult { namespace extensions {
31 
33  enum class ProcessDisposition {
35  Production,
36 
38  Recovery
39  };
40 
43  public:
47  const std::string& resourcesPath,
49  const std::string& servicePoolName);
50 
51  public:
54 
56  const std::string& resourcesPath() const;
57 
60 
62  const std::vector<ionet::Node>& staticNodes() const;
63 
64  public:
67 
70 
73 
76 
77  public:
79  void loadExtensions();
80 
82  void addStaticNodes(const std::vector<ionet::Node>& nodes);
83 
84  private:
86  std::string m_resourcesPath;
88  std::unique_ptr<thread::MultiServicePool> m_pMultiServicePool;
89  std::vector<plugins::PluginModule> m_extensionModules;
90 
94  std::vector<ionet::Node> m_nodes;
95  };
96 
98  void AddStaticNodesFromPath(ProcessBootstrapper& bootstrapper, const std::string& path);
99 }}
100 
102 extern "C" PLUGIN_API
catapult::extensions::ProcessBootstrapper::addStaticNodes
void addStaticNodes(const std::vector< ionet::Node > &nodes)
Adds static nodes to the bootstrapper.
Definition: ProcessBootstrapper.cpp:105
CATAPULT_LOG
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
CATAPULT_THROW_AND_LOG_0
#define CATAPULT_THROW_AND_LOG_0(TYPE, MESSAGE)
Macro used to throw a catapult exception with zero parameters.
Definition: exceptions.h:146
catapult::extensions::ProcessBootstrapper::m_extensionModules
std::vector< plugins::PluginModule > m_extensionModules
Definition: ProcessBootstrapper.h:89
catapult::config::CatapultConfiguration::BlockChain
const model::BlockChainConfiguration BlockChain
Block chain configuration.
Definition: CatapultConfiguration.h:48
catapult::config::UserConfiguration::PluginsDirectory
std::string PluginsDirectory
Plugins directory.
Definition: UserConfiguration.h:38
catapult::plugins::PluginModule
A plugin module.
Definition: PluginModule.h:28
PluginModule.h
catapult::extensions::ProcessBootstrapper::m_nodes
std::vector< ionet::Node > m_nodes
Definition: ProcessBootstrapper.h:94
catapult::extensions::ProcessBootstrapper::m_config
config::CatapultConfiguration m_config
Definition: ProcessBootstrapper.h:85
catapult::extensions::ProcessDisposition::Production
Production process.
catapult::extensions::ProcessBootstrapper::disposition
ProcessDisposition disposition() const
Gets the process disposition.
Definition: ProcessBootstrapper.cpp:55
catapult::config::CatapultConfiguration::Extensions
const ExtensionsConfiguration Extensions
Extensions configuration.
Definition: CatapultConfiguration.h:60
catapult::thread::MultiServicePool
Definition: MultiServicePool.h:33
catapult::plugins::plugin_load_error
Exception class that is thrown when an error is encountered while loading a plugin.
Definition: PluginExceptions.h:27
catapult::extensions::ProcessBootstrapper::m_disposition
ProcessDisposition m_disposition
Definition: ProcessBootstrapper.h:87
catapult::plugins::PluginManager
A manager for registering plugins.
Definition: PluginManager.h:51
catapult::model::BlockChainConfiguration::Network
NetworkInfo Network
Block chain network.
Definition: BlockChainConfiguration.h:36
PluginUtils.h
catapult::extensions::ProcessBootstrapper::resourcesPath
const std::string & resourcesPath() const
Gets the resources path.
Definition: ProcessBootstrapper.cpp:51
catapult::extensions::ProcessDisposition::Recovery
Recovery process.
m_resourcesPath
std::string m_resourcesPath
Definition: tools/health/main.cpp:209
plugins.h
catapult::extensions::ProcessBootstrapper::ProcessBootstrapper
ProcessBootstrapper(const config::CatapultConfiguration &config, const std::string &resourcesPath, ProcessDisposition disposition, const std::string &servicePoolName)
Creates a process bootstrapper around config, resourcesPath, disposition and servicePoolName.
Definition: ProcessBootstrapper.cpp:29
PLUGIN_API
#define PLUGIN_API
Definition: plugins.h:30
SubscriptionManager.h
catapult::config::CatapultConfiguration
Comprehensive configuration for a catapult process.
Definition: CatapultConfiguration.h:34
catapult::plugins::PluginModule::symbol
TFunc symbol(const char *symbolName) const
Gets a symbol of the specified type named symbolName.
Definition: PluginModule.h:44
forwardsValidation.info
def info(*args)
Definition: forwardsValidation.py:12
catapult::config::ExtensionsConfiguration::Names
std::vector< std::string > Names
Definition: ExtensionsConfiguration.h:34
m_pluginManager
plugins::PluginManager & m_pluginManager
Definition: Broker.cpp:123
MultiServicePool.h
m_config
HarvestingConfiguration m_config
Definition: HarvestingService.cpp:126
catapult::extensions::ProcessBootstrapper::pluginManager
plugins::PluginManager & pluginManager()
Gets the plugin manager.
Definition: ProcessBootstrapper.cpp:75
catapult::extensions::ProcessBootstrapper::extensionManager
ExtensionManager & extensionManager()
Gets the extension manager.
Definition: ProcessBootstrapper.cpp:67
catapult::extensions::ProcessBootstrapper::m_resourcesPath
std::string m_resourcesPath
Definition: ProcessBootstrapper.h:86
catapult::extensions::ProcessBootstrapper::m_pMultiServicePool
std::unique_ptr< thread::MultiServicePool > m_pMultiServicePool
Definition: ProcessBootstrapper.h:88
CatapultConfiguration.h
catapult::extensions::ProcessBootstrapper::m_extensionManager
ExtensionManager m_extensionManager
Definition: ProcessBootstrapper.h:91
catapult::extensions::ProcessBootstrapper::m_subscriptionManager
subscribers::SubscriptionManager m_subscriptionManager
Definition: ProcessBootstrapper.h:92
catapult::extensions::ProcessBootstrapper::config
const config::CatapultConfiguration & config() const
Gets the configuration.
Definition: ProcessBootstrapper.cpp:47
catapult::extensions::ProcessBootstrapper::staticNodes
const std::vector< ionet::Node > & staticNodes() const
Gets the static (pretrusted) nodes.
Definition: ProcessBootstrapper.cpp:59
catapult::extensions::ExtensionManager
A manager for registering extensions.
Definition: ExtensionManager.h:33
catapult::config::LoadPeersFromPath
std::vector< ionet::Node > LoadPeersFromPath(const std::string &path, model::NetworkIdentifier networkIdentifier)
Loads peers from the specified path for the network identified by networkIdentifier.
Definition: PeersConfiguration.cpp:106
PluginManager.h
catapult::config::CatapultConfiguration::User
const UserConfiguration User
User configuration.
Definition: CatapultConfiguration.h:57
catapult::extensions::AddStaticNodesFromPath
void AddStaticNodesFromPath(ProcessBootstrapper &bootstrapper, const std::string &path)
Adds static nodes from path to bootstrapper.
Definition: ProcessBootstrapper.cpp:109
Node
ionet::Node Node
Definition: PacketWriters.cpp:45
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::extensions::ProcessBootstrapper
Process bootstrapper.
Definition: ProcessBootstrapper.h:42
Logging.h
catapult::extensions::ProcessBootstrapper::subscriptionManager
subscribers::SubscriptionManager & subscriptionManager()
Gets the subscription manager.
Definition: ProcessBootstrapper.cpp:71
catapult::extensions::ProcessBootstrapper::pool
thread::MultiServicePool & pool()
Gets the multiservice pool.
Definition: ProcessBootstrapper.cpp:63
ExtensionManager.h
ProcessBootstrapper.h
catapult::extensions::CreateStorageConfiguration
plugins::StorageConfiguration CreateStorageConfiguration(const config::CatapultConfiguration &config)
Creates plugin storage configuration from config.
Definition: PluginUtils.cpp:30
catapult::extensions::ProcessDisposition
ProcessDisposition
Possible process dispositions.
Definition: ProcessBootstrapper.h:33
RegisterExtension
PLUGIN_API void RegisterExtension(catapult::extensions::ProcessBootstrapper &bootstrapper)
Entry point for registering a dynamic extension module with bootstrapper.
Definition: AddressExtractionExtension.cpp:50
catapult::extensions::ProcessBootstrapper::m_pluginManager
plugins::PluginManager m_pluginManager
Definition: ProcessBootstrapper.h:93
catapult::extensions::ProcessBootstrapper::loadExtensions
void loadExtensions()
Loads all configured extensions.
Definition: ProcessBootstrapper.cpp:96
PluginExceptions.h
catapult::model::NetworkInfo::Identifier
NetworkIdentifier Identifier
Network identifier.
Definition: NetworkInfo.h:70
catapult::subscribers::SubscriptionManager
A manager for subscribing to notifications.
Definition: SubscriptionManager.h:38