20#pragma warning(disable : 4251)
26using plugins_t = std::deque<plugin::plugin_base_t *>;
49 PluginList plugin_list;
51 template <
size_t Index = 0>
void add_plugin(
plugins_t &plugins)
noexcept {
52 plugins.emplace_back(&std::get<Index>(plugin_list));
53 if constexpr (Index + 1 < std::tuple_size_v<PluginList>) {
54 add_plugin<Index + 1>(plugins);
94 using builder_t =
typename Actor::template config_builder_t<Actor>;
131 std::uint32_t
mask = builder_t::requirements_mask;
146 return std::move(*
static_cast<builder_t *
>(
this));
153 return std::move(*
static_cast<builder_t *
>(
this));
160 return std::move(*
static_cast<builder_t *
>(
this));
169 config.spawner_address = value;
170 return std::move(*
static_cast<builder_t *
>(
this));
182 config.escalate_failure = value;
183 return std::move(*
static_cast<builder_t *
>(
this));
192 config.autoshutdown_supervisor = value;
193 return std::move(*
static_cast<builder_t *
>(
this));
205 void init_ctor() noexcept {
207 using plugins_list_t =
typename Actor::plugins_list_t;
209 return std::make_unique<storage_t>();
Basic namespace for all rotor functionalities.
Definition rotor.hpp:21
std::deque< plugin::plugin_base_t * > plugins_t
list of raw plugin pointers
Definition actor_config.h:26
std::unique_ptr< plugin_storage_base_t > plugin_storage_ptr_t
smart pointer for plugin_storage_base_t
Definition actor_config.h:38
intrusive_ptr_t< address_t > address_ptr_t
intrusive pointer for address
Definition address.hpp:57
boost::intrusive_ptr< T > intrusive_ptr_t
alias for intrusive pointer
Definition arc.hpp:27
builder_t && autoshutdown_supervisor(bool value=true) &&noexcept
shutdown supervisor when an actor is down
Definition actor_config.h:191
builder_t && init_timeout(const pt::time_duration &timeout) &&noexcept
setter for init timeout
Definition actor_config.h:150
builder_t && escalate_failure(bool value=true) &&noexcept
shutdown supervisor upon actor failure
Definition actor_config.h:181
typename Actor::config_t config_t
final config class
Definition actor_config.h:97
system_context_t & system_context
Definition actor_config.h:125
virtual bool validate() noexcept
checks whether config is valid, i.e. all necessary fields are set
Definition actor_config.h:197
builder_t && spawner_address(const address_ptr_t &value) &&noexcept
spawner address
Definition actor_config.h:168
builder_t && shutdown_timeout(const pt::time_duration &timeout) &&noexcept
setter for shutdown timeout
Definition actor_config.h:157
actor_config_builder_t(install_action_t &&action_, supervisor_t *supervisor_)
ctor with install action and raw pointer to supervisor
Definition supervisor.h:616
config_t config
Definition actor_config.h:128
builder_t && timeout(const pt::time_duration &timeout) &&noexcept
setter for init and shutdown timeout
Definition actor_config.h:143
typename Actor::template config_builder_t< Actor > builder_t
final builder class
Definition actor_config.h:94
static constexpr const std::uint32_t requirements_mask
Definition actor_config.h:116
actor_ptr_t finish() &&
constructs actor from the current config
Definition supervisor.h:622
std::uint32_t mask
Definition actor_config.h:131
intrusive_ptr_t< Actor > actor_ptr_t
intrusive pointer to actor
Definition actor_config.h:100
actor_config_builder_t(install_action_t &&action_, system_context_t &system_context_)
ctor with install action and pointer to system_context_t
Definition actor_config.h:137
supervisor_t * supervisor
Definition actor_config.h:122
static constexpr const std::uint32_t INIT_TIMEOUT
Definition actor_config.h:110
std::function< void(actor_ptr_t &)> install_action_t
actor post-constructor callback type
Definition actor_config.h:107
static constexpr const std::uint32_t SHUTDOWN_TIMEOUT
Definition actor_config.h:113
install_action_t install_action
Definition actor_config.h:119
std::function< plugin_storage_ptr_t()> plugins_constructor_t
constructs plugin_storage_ptr_t (type)
Definition actor_config.h:64
bool escalate_failure
shutdown supervisor upon child failure
Definition actor_config.h:82
pt::time_duration init_timeout
max actor initialization time
Definition actor_config.h:73
supervisor_t * supervisor
raw pointer to supervisor_t
Definition actor_config.h:70
actor_config_t(supervisor_t *supervisor_)
constructs actor_config_t from raw supervisor pointer
Definition actor_config.h:88
pt::time_duration shutdown_timeout
max actor shutdown time
Definition actor_config.h:76
plugins_constructor_t plugins_constructor
constructs plugin_storage_ptr_t
Definition actor_config.h:67
address_ptr_t spawner_address
address of the spawner
Definition actor_config.h:79
bool autoshutdown_supervisor
shutdown supervisor upon child down
Definition actor_config.h:85
abstract item to store plugins inside actor
Definition actor_config.h:30
virtual plugins_t get_plugins() noexcept=0
returns list of plugins pointers from the storage
templated plugin storage implementation
Definition actor_config.h:41
plugins_t get_plugins() noexcept override
returns list of plugins pointers from the storage
Definition actor_config.h:42
supervisor is responsible for managing actors (workers) lifetime
Definition supervisor.h:68
The system context holds root supervisor_t (intrusive pointer) and may be loop-related details in der...
Definition system_context.h:32