9#include "plugin_base.h"
10#include <unordered_set>
11#include "rotor/detail/child_info.h"
15#pragma warning(disable : 4251)
18namespace rotor::plugin {
36 const std::type_index &
identity() const noexcept override;
47 bool escalate) noexcept;
99 template <typename T> auto &
access() noexcept;
102 using actors_map_t = std::unordered_map<
address_ptr_t, detail::child_info_ptr_t>;
103 using spawning_map_t = std::unordered_map<
request_id_t, detail::child_info_ptr_t>;
105 bool has_initializing() const noexcept;
106 void init_continue() noexcept;
109 void request_shutdown(detail::child_info_t &child_state, const
extended_error_ptr_t &ec) noexcept;
110 void on_spawn_timer(
request_id_t timer_id,
bool cancelled) noexcept;
112 size_t active_actors() noexcept;
115 using initializing_actors_t = std::unordered_set<
address_ptr_t>;
118 actors_map_t actors_map;
119 spawning_map_t spawning_map;
namespace for rotor core messages (which just transform payloads)
Definition messages.hpp:317
intrusive_ptr_t< extended_error_t > extended_error_ptr_t
intrusive pointer to extended error type
Definition extended_error.h:25
std::function< actor_ptr_t(supervisor_t &, const address_ptr_t &)> factory_t
factory which allows to create actors lazily or on demand
Definition forward.hpp:45
restart_policy_t
spawner's actor restart policy
Definition policy.h:23
intrusive_ptr_t< actor_base_t > actor_ptr_t
intrusive pointer for actor
Definition forward.hpp:23
intrusive_ptr_t< address_t > address_ptr_t
intrusive pointer for address
Definition address.hpp:57
std::size_t request_id_t
timer identifier type in the scope of the actor
Definition forward.hpp:34
universal primitive of concurrent computation
Definition actor_base.h:47
supervisor's plugin for child-actors housekeeping
Definition child_manager.h:30
virtual void create_child(const actor_ptr_t &actor) noexcept
pre-initializes child and sends create_child message to the supervisor
auto & access() noexcept
generic non-public fields accessor
bool handle_unsubscription(const subscription_point_t &point, bool external) noexcept override
polls plugin, whether it is done with unsubscription
bool handle_init(message::init_request_t *) noexcept override
polls plugin, whether it is done with initialization
plugin_base_t()=default
default plugin ctor
bool handle_shutdown(message::shutdown_request_t *) noexcept override
polls plugin, whether it is done with shutdown
void activate(actor_base_t *actor) noexcept override
invoked by actor upon initialization.
virtual void on_shutdown_fail(actor_base_t &actor, const extended_error_ptr_t &ec) noexcept
reaction on child shutdown failure
void deactivate() noexcept override
deactivates plugin from an actor
static const std::type_index class_identity
Definition child_manager.h:34
virtual void on_shutdown_confirm(message::shutdown_response_t &message) noexcept
reaction on shutdown confirmation (i.e. perform some cleanings)
virtual void on_create(message::create_actor_t &message) noexcept
sends initialization request upon actor creation message
void handle_start(message::start_trigger_t *message) noexcept override
polls plugin, whether it is done with start
const std::type_index & identity() const noexcept override
returns pointer, which uniquely identifiess plugin type
virtual void remove_child(const actor_base_t &actor) noexcept
removes the child from the supervisor
virtual void spawn(factory_t factory, const pt::time_duration &period, restart_policy_t policy, size_t max_attempts, bool escalate) noexcept
records spawner (via generating a new address) and sends spawn_actor_t message to the supervisor
virtual void on_shutdown_trigger(message::shutdown_trigger_t &message) noexcept
reaction on shutdown trigger
virtual void on_init(message::init_response_t &message) noexcept
reaction on (maybe unsuccessful) init confirmation
virtual void on_spawn(message::spawn_actor_t &message) noexcept
actually attempts to spawn a new actor via spawner
plugin_base_t()=default
default plugin ctor
actor_base_t * actor
non-owning actor pointer
Definition plugin_base.h:179
pair of handler_base_t linked to particular address_t
Definition subscription_point.h:49