Internals
Actors have internal data structures controlling their behavior:
Actor State
Actors._ACT
— Type_ACT
Internal actor status variable.
Fields
mode::Symbol
: the actor mode,bhv::Any
: behavior - a callable object,init::Any
: initialization - a callable object,term::Any
: termination - a callable object,self::Link
: the actor's address,name::Union{Nothing,Symbol}
: the actor's registered name.res::Any
: the result of the last behavior execution,sta::Any
: a variable for representing state,usr::Any
: user variable for plugging in something,conn::Array{Connection,1}
: connected actors.
Actors.Info
— TypeActor 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.
Actor Mode
More complex actor behaviors can be realized by changing their mode. Actors
uses the following modes:
mode | brief description |
---|---|
:default | the default actor mode. |
:sticky | sticky actors do not exit if they get an Exit signal from a connected actor. |
:system | behave as :sticky actors, but are internal actors _REF and _ROOT . |
:supervisor | reserved for actors with supervisor behavior. |
Connections
The error handling between actors is realized by connections between them
Actors.Connection
— TypeAbstract type for connections between actors.
Actors.Peer
— TypeConnection to a peer actor
Actors.Monitor
— TypeConnection to a monitor
Actors.Monitored
— TypeConnection to a monitored actor or task
Actors.Super
— TypeConnection to a supervisor.
Actors.Child
— TypeChild{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 ...
Supervision
A supervisor actor has a function object as behavior:
Actors.Supervisor
— TypeSupervisor(; strategy=:one_for_one, max_restarts=3, max_seconds=5, kwargs...)
Supervisor functor with data and behavior.
Fields (acquaintances)
option::Dict{Symbol,Any}
: supervisor optionchilds::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 whichmax_restarts
applies, defaults to 5,kwargs...
: further option to extend supervisor behavior.