actor-framework
Public Types | Public Member Functions | Friends | List of all members
caf::actor_registry Class Reference

A registry is used to associate actors to IDs or names. More...

#include <actor_registry.hpp>

Public Types

using name_map = std::unordered_map< std::string, strong_actor_ptr >
 

Public Member Functions

template<class T = strong_actor_ptr>
get (actor_id key) const
 Returns the local actor associated to key.
 
template<class T >
void put (actor_id key, const T &val)
 Associates a local actor with its ID.
 
void erase (actor_id key)
 Removes an actor from this registry, leaving reason for future reference. More...
 
size_t inc_running ()
 Increases running-actors-count by one. More...
 
size_t dec_running ()
 Decreases running-actors-count by one. More...
 
size_t running () const
 Returns the number of currently running actors.
 
void await_running_count_equal (size_t expected) const
 Blocks the caller until running-actors-count becomes expected (must be either 0 or 1). More...
 
template<class T = strong_actor_ptr>
get (const std::string &key) const
 Returns the actor associated with key or invalid_actor.
 
template<class T >
void put (const std::string &key, const T &value)
 Associates given actor to key.
 
void erase (const std::string &key)
 Removes a name mapping.
 
name_map named_actors () const
 

Friends

class actor_system
 

Detailed Description

A registry is used to associate actors to IDs or names.

This allows a middleman to lookup actor handles after receiving actor IDs via the network and enables developers to use well-known names to identify important actors independent from their ID at runtime. Note that the registry does not contain all actors of an actor system. The middleman registers actors as needed.

Member Function Documentation

◆ await_running_count_equal()

void caf::actor_registry::await_running_count_equal ( size_t  expected) const

Blocks the caller until running-actors-count becomes expected (must be either 0 or 1).

◆ dec_running()

size_t caf::actor_registry::dec_running ( )

Decreases running-actors-count by one.

Returns
the decreased count.

◆ erase()

void caf::actor_registry::erase ( actor_id  key)

Removes an actor from this registry, leaving reason for future reference.

◆ inc_running()

size_t caf::actor_registry::inc_running ( )

Increases running-actors-count by one.

Returns
the increased count.

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