9#include "plugin_base.h"
11#include <unordered_map>
13#include <forward_list>
17#pragma warning(disable : 4251)
20namespace rotor::plugin {
45 using plugin_base_t::plugin_base_t;
50 const std::type_index &
identity() const noexcept override;
63 virtual
void link(const
address_ptr_t &address,
bool operational_only = true,
67 template <
typename F>
void on_unlink(F &&callback)
noexcept { unlink_reaction = std::forward<F>(callback); }
82 enum class link_state_t { LINKING, OPERATIONAL, UNLINKING };
83 struct server_record_t {
84 link_callback_t callback;
88 using servers_map_t = std::unordered_map<address_ptr_t, server_record_t>;
90 using unlink_queue_t = std::list<unlink_req_t>;
92 void try_forget_links(
bool attempt_shutdown)
noexcept;
93 servers_map_t servers_map;
94 unlink_reaction_t unlink_reaction;
95 unlink_queue_t unlink_queue;
96 bool configured =
false;
intrusive_ptr_t< address_t > address_ptr_t
intrusive pointer for address
Definition address.hpp:57
intrusive_ptr_t< extended_error_t > extended_error_ptr_t
intrusive pointer to extended error type
Definition extended_error.h:25
std::size_t request_id_t
timer identifier type in the scope of the actor
Definition forward.hpp:34
boost::intrusive_ptr< T > intrusive_ptr_t
alias for intrusive pointer
Definition arc.hpp:27
universal primitive of concurrent computation
Definition actor_base.h:47
the generic message meant to hold user-specific payload
Definition message.h:83
allows actor to have active (client) role in linking
Definition link_client.h:34
virtual void on_link_response(message::link_response_t &message) noexcept
handler for link response
bool handle_init(message::init_request_t *message) noexcept override
polls plugin, whether it is done with initialization
const std::type_index & identity() const noexcept override
returns pointer, which uniquely identifiess plugin type
void forget_link(message::unlink_request_t &message) noexcept
continues previously suspended unlink request
virtual void on_unlink_request(message::unlink_request_t &message) noexcept
handler for unlink request
void on_unlink(F &&callback) noexcept
sets actor's callback on unlink request
Definition link_client.h:67
bool handle_shutdown(message::shutdown_request_t *message) noexcept override
polls plugin, whether it is done with shutdown
std::function< void(const extended_error_ptr_t &)> link_callback_t
callback action upon link
Definition link_client.h:36
std::function< bool(message::unlink_request_t &message)> unlink_reaction_t
unlink interceptor callback
Definition link_client.h:43
static const std::type_index class_identity
Definition link_client.h:48
base class for all actor plugins
Definition plugin_base.h:23