libcaf  0.13.2
Public Types | Public Member Functions | Protected Member Functions | List of all members
caf::io::broker Class Reference

A broker mediates between actor systems and other components in the network. More...

#include <broker.hpp>

Inheritance diagram for caf::io::broker:
caf::local_actor caf::abstract_actor caf::resumable caf::abstract_channel caf::ref_counted caf::memory_managed caf::io::basp_broker

Public Types

using super = abstract_event_based_actor< behavior, false, abstract_broker >
 
- Public Types inherited from caf::local_actor
using mailbox_type = detail::single_reader_queue< mailbox_element, detail::disposer >
 
- Public Types inherited from caf::resumable
enum  resume_result {
  resume_later,
  awaiting_message,
  done,
  shutdown_execution_unit
}
 

Public Member Functions

template<class F , class... Ts>
actor fork (F fun, connection_handle hdl, Ts &&...xs)
 
void initialize () override
 
 broker (middleman &parent_ref)
 
- Public Member Functions inherited from caf::local_actor
template<class T , spawn_options Os = no_spawn_options, class... Ts>
actor spawn (Ts &&...xs)
 
template<spawn_options Os = no_spawn_options, class... Ts>
actor spawn (Ts &&...xs)
 
template<class T , spawn_options Os = no_spawn_options, class Groups , class... Ts>
actor spawn_in_groups (const Groups &grps, Ts &&...xs)
 
template<class T , spawn_options Os = no_spawn_options, class... Ts>
actor spawn_in_groups (std::initializer_list< group > grps, Ts &&...xs)
 
template<class T , spawn_options Os = no_spawn_options, class... Ts>
actor spawn_in_group (const group &grp, Ts &&...xs)
 
template<spawn_options Os = no_spawn_options, class Groups , class... Ts>
actor spawn_in_groups (const Groups &grps, Ts &&...xs)
 
template<spawn_options Os = no_spawn_options, class... Ts>
actor spawn_in_groups (std::initializer_list< group > grps, Ts &&...xs)
 
template<spawn_options Os = no_spawn_options, class... Ts>
actor spawn_in_group (const group &grp, Ts &&...xs)
 
template<class T , spawn_options Os = no_spawn_options, class... Ts>
actor_handle_from_signature_list< typename T::signatures >::type spawn_typed (Ts &&...xs)
 
template<spawn_options Os = no_spawn_options, typename F , class... Ts>
infer_typed_actor_handle< typename detail::get_callable_trait< F >::result_type, typename detail::tl_head< typename detail::get_callable_trait< F >::arg_types >::type >::type spawn_typed (F fun, Ts &&...xs)
 
template<class... Ts>
void send (message_priority mp, const channel &dest, Ts &&...xs)
 Sends {xs...} to dest using the priority mp.
 
template<class... Ts>
void send (const channel &dest, Ts &&...xs)
 Sends {xs...} to dest using normal priority.
 
template<class... Sigs, class... Ts>
void send (message_priority mp, const typed_actor< Sigs...> &dest, Ts &&...xs)
 Sends {xs...} to dest using the priority mp.
 
template<class... Sigs, class... Ts>
void send (const typed_actor< Sigs...> &dest, Ts &&...xs)
 Sends {xs...} to dest using normal priority.
 
void send_exit (const actor_addr &dest, uint32_t reason)
 Sends an exit message to dest.
 
template<class ActorHandle >
void send_exit (const ActorHandle &dest, uint32_t reason)
 Sends an exit message to dest.
 
template<class... Ts>
void delayed_send (message_priority mp, const channel &dest, const duration &rtime, Ts &&...xs)
 Sends a message to dest that is delayed by rel_time using the priority mp. More...
 
template<class... Ts>
void delayed_send (const channel &dest, const duration &rtime, Ts &&...xs)
 Sends a message to dest that is delayed by rel_time.
 
template<class... Sigs, class... Ts>
void delayed_send (message_priority mp, const typed_actor< Sigs...> &dest, const duration &rtime, Ts &&...xs)
 Sends {xs...} delayed by rtime to dest using the priority mp.
 
template<class... Sigs, class... Ts>
void delayed_send (const typed_actor< Sigs...> &dest, const duration &rtime, Ts &&...xs)
 Sends {xs...} delayed by rtime to dest using the priority mp.
 
void join (const group &what)
 Causes this actor to subscribe to the group what. More...
 
void leave (const group &what)
 Causes this actor to leave the group what.
 
void quit (uint32_t reason=exit_reason::normal)
 Finishes execution of this actor after any currently running message handler is done. More...
 
bool trap_exit () const
 Checks whether this actor traps exit messages.
 
void trap_exit (bool value)
 Enables or disables trapping of exit messages.
 
messagecurrent_message ()
 Returns the currently processed message. More...
 
actor_addrcurrent_sender ()
 Returns the address of the sender of the current message. More...
 
void monitor (const actor_addr &whom)
 Adds a unidirectional monitor to whom. More...
 
void monitor (const actor &whom)
 Adds a unidirectional monitor to whom. More...
 
template<class... Ts>
void monitor (const typed_actor< Ts...> &whom)
 Adds a unidirectional monitor to whom. More...
 
void demonitor (const actor_addr &whom)
 Removes a monitor from whom.
 
void demonitor (const actor &whom)
 Removes a monitor from whom.
 
virtual void on_exit ()
 Can be overridden to perform cleanup code after an actor finished execution. More...
 
std::vector< group > joined_groups () const
 Returns all joined groups.
 
response_promise make_response_promise ()
 Creates a response_promise to response to a request later on.
 
void on_sync_failure (std::function< void()> fun)
 Sets the handler for unexpected synchronous response messages.
 
bool has_sync_failure_handler ()
 Checks wheter this actor has a user-defined sync failure handler.
 
template<class F >
void set_exception_handler (F f)
 Sets a custom exception handler for this actor. More...
 
messagelast_dequeued () CAF_DEPRECATED
 
actor_addrlast_sender () CAF_DEPRECATED
 
void send_tuple (message_priority mp, const channel &whom, message what) CAF_DEPRECATED
 
void send_tuple (const channel &whom, message what) CAF_DEPRECATED
 
void delayed_send_tuple (message_priority mp, const channel &whom, const duration &rtime, message data) CAF_DEPRECATED
 
void delayed_send_tuple (const channel &whom, const duration &rtime, message data) CAF_DEPRECATED
 
void attach_to_scheduler () override
 Initializes this object, e.g., by increasing the the reference count.
 
void detach_from_scheduler () override
 Uninitializes this object, e.g., by decrementing the the reference count.
 
resumable::resume_result resume (execution_unit *, size_t) override
 Resume any pending computation until it is either finished or needs to be re-scheduled later. More...
 
- Public Member Functions inherited from caf::abstract_actor
void attach (attachable_ptr ptr)
 Attaches ptr to this actor. More...
 
template<class F >
void attach_functor (F f)
 Convenience function that attaches the functor f to this actor. More...
 
actor_addr address () const
 Returns the logical actor address.
 
size_t detach (const attachable::token &what)
 Detaches the first attached object that matches what.
 
void link_to (const actor_addr &whom)
 Links this actor to whom.
 
template<class ActorHandle >
void link_to (const ActorHandle &whom)
 Links this actor to whom.
 
void unlink_from (const actor_addr &other)
 Unlinks this actor from whom.
 
template<class ActorHandle >
void unlink_from (const ActorHandle &other)
 Unlinks this actor from whom.
 
bool establish_backlink (const actor_addr &other)
 Establishes a link relation between this actor and other and returns whether the operation succeeded. More...
 
bool remove_backlink (const actor_addr &other)
 Removes the link relation between this actor and other and returns whether the operation succeeded. More...
 
uint32_t id () const
 Returns the unique ID of this actor.
 
uint32_t exit_reason () const
 Returns the actor's exit reason or exit_reason::not_exited if it's still alive. More...
 
virtual std::set< std::string > message_types () const
 Returns the set of accepted messages types as strings or an empty set if this actor is untyped. More...
 
execution_unithost () const
 Returns the execution unit currently used by this actor. More...
 
void host (execution_unit *new_host)
 Sets the execution unit for this actor.
 
- Public Member Functions inherited from caf::abstract_channel
virtual void enqueue (const actor_addr &sender, message_id mid, message content, execution_unit *host)=0
 Enqueues a new message to the channel.
 
virtual void enqueue (mailbox_element_ptr what, execution_unit *host)
 Enqueues a new message wrapped in a mailbox_element to the channel. More...
 
node_id node () const
 Returns the ID of the node this actor is running on.
 
bool is_remote () const
 Returns true if node_ptr returns.
 
bool is_abstract_actor () const
 
bool is_abstract_group () const
 
- Public Member Functions inherited from caf::ref_counted
 ref_counted (const ref_counted &)
 
ref_countedoperator= (const ref_counted &)
 
void ref () noexcept
 Increases reference count by one.
 
void deref () noexcept
 Decreases reference count by one and calls request_deletion when it drops to zero. More...
 
bool unique () const noexcept
 Queries whether there is exactly one reference.
 
size_t get_reference_count () const noexcept
 
- Public Member Functions inherited from caf::memory_managed
virtual void request_deletion (bool decremented_rc) noexcept
 Default implementations calls `delete this, but can be overriden in case deletion depends on some condition or the class doesn't use default new/delete. More...
 

Protected Member Functions

virtual behavior make_behavior ()
 
- Protected Member Functions inherited from caf::abstract_actor
 abstract_actor ()
 Creates a non-proxy instance.
 
 abstract_actor (actor_id aid, node_id nid)
 Creates a proxy instance for a proxy running on nid.
 
void cleanup (uint32_t reason)
 Called by the runtime system to perform cleanup actions for this actor. More...
 
bool exited () const
 Returns exit_reason() != exit_reason::not_exited.
 
- Protected Member Functions inherited from caf::abstract_channel
int flags () const
 
void flags (int new_value)
 

Additional Inherited Members

- Static Public Attributes inherited from caf::local_actor
static constexpr auto memory_cache_flag = detail::needs_embedding
 
- Static Public Attributes inherited from caf::abstract_channel
static constexpr int is_abstract_actor_flag = 0x100000
 
static constexpr int is_abstract_group_flag = 0x200000
 
- Protected Attributes inherited from caf::ref_counted
std::atomic< size_t > rc_
 

Detailed Description

A broker mediates between actor systems and other components in the network.


The documentation for this class was generated from the following file: