Internals

Actors have internal data structures controlling their behavior:

Actor State

Actors._ACTType
_ACT

Internal actor status variable.

Fields

  1. mode::Symbol: the actor mode,
  2. bhv::Any: behavior - a callable object,
  3. init::Any: initialization - a callable object,
  4. term::Any: termination - a callable object,
  5. self::Link: the actor's address,
  6. name::Union{Nothing,Symbol}: the actor's registered name.
  7. res::Any: the result of the last behavior execution,
  8. sta::Any: a variable for representing state,
  9. usr::Any: user variable for plugging in something,
  10. conn::Array{Connection,1}: connected actors.

see also: Bhv, Link

source
Actors.InfoType

Actor information

  • mode::Symbol: actor mode,
  • bhvf::Any: behavior function,
  • pid::Int: process identifier,
  • thrd::Int: thread,
  • task::Task: actor task address,
  • tid::String: proquint identifier based on task address,
  • name::Union{Nothing,Symbol}: name under which the actor is registered, nothing if not registered.
source

Actor Mode

More complex actor behaviors can be realized by changing their mode. Actors uses the following modes:

modebrief description
:defaultthe default actor mode.
:stickysticky actors do not exit if they get an Exit signal from a connected actor.
:systembehave as :sticky actors, but are internal actors _REF and _ROOT.
:supervisorreserved for actors with supervisor behavior.

Connections

The error handling between actors is realized by connections between them

Actors.ChildType
Child{L,T}(lk::L, start, info::T)

Connection to a supervised actor or task.

Fields

  • lk::L: Link or Task,
  • start::Any: callable object for restarting it,
  • init::Any: callable object for initialization (this is used for remote actors),
  • name::Union{Nothing,Symbol}: registered actor name, nothing if not registered,
  • info::T: named tuple with information about restart strategies, timeout, pollint ...
source

Supervision

A supervisor actor has a function object as behavior:

Actors.SupervisorType
Supervisor(; strategy=:one_for_one, max_restarts=3, max_seconds=5, kwargs...)

Supervisor functor with data and behavior.

Fields (acquaintances)

  • option::Dict{Symbol,Any}: supervisor option
  • childs::Array{Child,1}: supervised childs,
  • rtime::Array{Float64,1}: last restart times.

Options

  • strategy::Symbol: supervision strategy, can be either :one_for_one, :one_for_all or :rest_for_one.
  • max_restarts::Int: maximum number of restarts allowed in a time frame,
  • max_seconds::Float64: time frame in which max_restarts applies, defaults to 5,
  • kwargs...: further option to extend supervisor behavior.
source