rotor
Event loop friendly C++ actor micro-framework
 
Loading...
Searching...
No Matches
rotor::actor_config_builder_t< Actor > Struct Template Reference

CRTP actor config builder. More...

#include <actor_config.h>

Public Types

using builder_t = typename Actor::template config_builder_t< Actor >
 final builder class
 
using config_t = typename Actor::config_t
 final config class
 
using actor_ptr_t = intrusive_ptr_t< Actor >
 intrusive pointer to actor
 
using install_action_t = std::function< void(actor_ptr_t &)>
 actor post-constructor callback type
 

Public Member Functions

 actor_config_builder_t (install_action_t &&action_, supervisor_t *supervisor_)
 ctor with install action and raw pointer to supervisor
 
 actor_config_builder_t (install_action_t &&action_, system_context_t &system_context_)
 ctor with install action and pointer to system_context_t
 
builder_t && timeout (const pt::time_duration &timeout) &&noexcept
 setter for init and shutdown timeout
 
builder_t && init_timeout (const pt::time_duration &timeout) &&noexcept
 setter for init timeout
 
builder_t && shutdown_timeout (const pt::time_duration &timeout) &&noexcept
 setter for shutdown timeout
 
builder_t && spawner_address (const address_ptr_t &value) &&noexcept
 spawner address
 
builder_t && escalate_failure (bool value=true) &&noexcept
 shutdown supervisor upon actor failure
 
builder_t && autoshutdown_supervisor (bool value=true) &&noexcept
 shutdown supervisor when an actor is down
 
virtual bool validate () noexcept
 checks whether config is valid, i.e. all necessary fields are set
 
actor_ptr_t finish () &&
 constructs actor from the current config
 

Public Attributes

install_action_t install_action
 post-construction callback
 
supervisor_tsupervisor
 raw pointer to supervisor_t (is null for top-level supervisors)
 
system_context_tsystem_context
 reference to system_context_t
 
config_t config
 the currently build config
 
std::uint32_t mask = builder_t::requirements_mask
 required fields mask (used for validation)
 

Static Public Attributes

static constexpr const std::uint32_t INIT_TIMEOUT = 1 << 0
 bit mask for init timeout validation
 
static constexpr const std::uint32_t SHUTDOWN_TIMEOUT = 1 << 1
 bit mask for shutdown timeout validation
 
static constexpr const std::uint32_t requirements_mask = INIT_TIMEOUT | SHUTDOWN_TIMEOUT
 bit mask for all required fields
 

Detailed Description

template<typename Actor>
struct rotor::actor_config_builder_t< Actor >

CRTP actor config builder.

Member Typedef Documentation

◆ install_action_t

template<typename Actor >
using rotor::actor_config_builder_t< Actor >::install_action_t = std::function<void(actor_ptr_t &)>

actor post-constructor callback type

For example, supervisor on_init() is invoked early (right after instantiation)

Member Function Documentation

◆ autoshutdown_supervisor()

template<typename Actor >
builder_t && rotor::actor_config_builder_t< Actor >::autoshutdown_supervisor ( bool  value = true) &&
inlinenoexcept

shutdown supervisor when an actor is down

This policy is ignored when actor is spawned.

◆ escalate_failure()

template<typename Actor >
builder_t && rotor::actor_config_builder_t< Actor >::escalate_failure ( bool  value = true) &&
inlinenoexcept

shutdown supervisor upon actor failure

When actor is shut down due to failure, trigger it's supervisor to shutdown.

This policy is ignored when actor is spawned.

◆ spawner_address()

template<typename Actor >
builder_t && rotor::actor_config_builder_t< Actor >::spawner_address ( const address_ptr_t value) &&
inlinenoexcept

spawner address

This value must be set, when actor is create via spawner (i.e. in factory_t)

◆ validate()

template<typename Actor >
virtual bool rotor::actor_config_builder_t< Actor >::validate ( )
inlinevirtualnoexcept

checks whether config is valid, i.e. all necessary fields are set

Reimplemented in rotor::supervisor_config_builder_t< Supervisor >.


The documentation for this struct was generated from the following files: