Basic Types

The following types are needed for using and extending Actors:

Actors.ResponseType
Response(y, from::Link=self())

A Msg representing a response to requests.

Fields

  • y: response content,
  • from::Link: sender link.
source
Actors.LinkType
Link{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.
source
Actors.BhvType
Bhv(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 to f,
  • kw...: stored keyword arguments,
  • c...: parameters from the incoming communication.
source

You can create your own message types with

Actors.@msgMacro
@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
source