Basic Types
The following types are needed for using and extending Actors
:
Actors.Msg
— TypeAbstract type for messages to actors.
Actors.Request
— TypeRequest(x, from::Link)
A generic Msg
for user requests.
Actors.Response
— TypeResponse(y, from::Link=self())
A Msg
representing a response to requests.
Fields
y
: response content,from::Link
: sender link.
Actors.Link
— TypeLink{C} <: ActorInterfaces.Classic.Addr
Link(chn::C, pid::Int, type::Symbol) where C
A mailbox for communicating with actors. A concrete type of this must be returned by an actor on creation with spawn
.
Fields/Parameters
chn::C
: C can be any type and characterizes the interface to an actor,pid::Int
: the pid (worker process identifier) of the actor,mode::Symbol
: a symbol characterizing the actor mode.
Actors.Bhv
— TypeBhv(func, a...; kw...)(c...)
A callable struct to represent actor behavior. It is executed with parameters from the incoming communication.
Parameters
f
: a callable object,a...
: stored acquaintance parameters tof
,kw...
: stored keyword arguments,c...
: parameters from the incoming communication.
You can create your own message types with
Actors.@msg
— Macro@msg [Msg] A B C
Define empty structs as message types. Msg
is an existing abstract datatype.
To call @msg Msg A B C
is equivalent to
struct A <: Msg end
struct B <: Msg end
struct C <: Msg end
To call @msg D E F
is equivalent to
struct D end
struct E end
struct F end