Messages
Messages to YAActL
actors have Message
as a common abstract type. Only three predefined messages are exported:
Response
: response message type from actor to any synchronous message (requiring a response),Request
: predefined message type for implementing requests to actors.Timeout
: answer ofreceive!
when a timeout occurs.
Messages other than the predefined ones can be implemented by a user.
Functions and Arguments
There are two types needed for transmitting functions and function arguments to actors with messages:
YAActL.Func
— TypeFunc(f, args...; kwargs...)
A structure for passing a function f
and its arguments to an actor.
YAActL.Args
— TypeArgs(args...; kwargs...)
A structure for updating arguments to an actor's behavior.
Internal Messages
Actors recognize and react to the following predefined internal messages:
YAActL.Become
— TypeBecome(x::Func)
An asynchronous Message
to an actor to change its behavior.
YAActL.Call
— TypeCall(arg, from::Link)
A synchronous Message
to an actor to execute its behavior with arg...
and to send the result as a Response
message to from
.
If the actor is set to state
dispatch, it updates its internal state with the result.
YAActL.Cast
— TypeCast(arg)
An asynchronous Message
to an actor to execute its behavior with arg...
without sending a response.
If the actor is set to state
dispatch, it updates its internal state with the result.
YAActL.Diag
— TypeDiag(from::Link)
A synchronous Message
to an actor to send a Response
message with its internal _ACT
variable to from
.
YAActL.Exec
— TypeExec(func::Func, from::Link)
A synchronous Message
to an actor to execute func
and to send a Response
message with the return value to from
.
YAActL.Init
— TypeInit(f::Func)
A Message
to an actor to execute the given Func
and to register it in the _ACT
variable.
YAActL.Query
— TypeQuery(s::Symbol, from::Link)
A Message
to an actor to send a Response
message with one of its internal state variables s
to from
.
s::Symbol
can be one of:sta
,:res
,:bhv
,:dsp
.
YAActL.Stop
— TypeStop(code=0)
A Message
causing an actor to stop with an exit code
. If present, it calls its term!
function with code
as last argument.
YAActL.Term
— TypeYAActL.Update
— TypeUpdate(s::Symbol, x)
An asynchronous Message
to an actor to update its internal state s
to x
.
s::Symbol
can be one of:sta
,:dsp
,:arg
,:lnk
.
Those messages are interfaced by the functions in the YAActL
API.
If an actor receives another subtype of Message
, it calls its behavior function with it as last argument.