-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Welcome! Where to start? See the guide below! Although every page can be read on its own, each page may require the knowledge of pages listed before. So if you are new to (Leucine) actors, it is best to read (or at least scan) the pages from the start, and for reference you can dive in at any spot.
Note, these pages are now ready and reflect the state of
art for Leucine version 0.5.x, sometimes with minor differences.
If a new version appears, these texts
will updated to the latest release as soon as possible.
Every page that is under construction or may be outdated carries the
label
Start here if you are new to actors or want to know what the Leucine has to offer.
In the following of this documentation the possibilities of Leucine will be discussed by presenting several examples. These are kept as brief as possible, just to illustrate how the different capabilities can be used. You can use these as starting point for better solutions.
For all these examples we assume that you have added the latest version of Leucine to your libraries (in SBT like this):
libraryDependencies += "com.sense2act" %% "leucine" % "<latest-version>"
that the packages are imported and that there is a global actor context available (unless said otherwise). Like this:
import s2a.leucine.actors.*
/* Define the default actor context */
given ActorContext = ActorContext.system
Note that there other actor contexts possible, but this is the 'default' one. When possible links to Scastie are presented, so you may directly run the code to experiment with. This all should work as soon as this bug is resolved.
This section contains the short examples of how to use the different types of actors. Start with the first item to get an introduction in the subject.
-
AcceptActor
: Receiving your letters from anyone -
SelectActor
: Select specific actors as senders -
RestrictActor
: Couple letters to actors -
RefuseActor
: Offloading a single task -
WideActor
: Open to the world
There are several mixins (aids) that extend what an actor is capable of. Most of them are orthogonal and can be combined at will. Each will slightly increase the footprint and workload of an actor. Usually that is not a problem, but if large numbers of actors are needed, it is better to only mixin what you really need.
-
TimingAid
: Send letters later, or handle I/O -
FamilyAid
: Actors within a hierarchical structure$\textcolor{red}{ ^\mbox{\scriptsize{}PAC}}$ -
StashAid
: Save received letters for later processing -
ProtectAid
: Keep mailboxes of manageable size -
ProcessAid
: Reading letters with partial functions -
MonitorAid
: Defining what is traced
Actors are created and destroyed. This can be done manually, by the garbage collector or by the system. And during the lifetime of an actor a lot can happen. This section discusses the in and outs of this process.
-
ActorGuard
: Lifetime management of all actors -
Actor.Stop
: Different ways to stop an actor -
Actor.Mail
: Catch unhandled messages -
ActorMonitor
: Trace what the actors are doing
Some possibilities of this actor system are not yet discussed and are also not relevant in every day use. Nevertheless these need to be discussed to be complete.
-
ActorContext
: Choose fromsystem,
emulated
or roll your own -
SystemParameters
: UseDefaultParameters
of roll your own