Skip to content
devlaam edited this page Jul 13, 2023 · 38 revisions

Leucine: A small x-platform actor framework

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 $\textcolor{red}{ ^\mbox{\scriptsize{}PAC}}$ or text $\textcolor{red}{\mbox{\scriptsize{}PAGE UNDER CONSTRUCTION}}$

Introduction

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.

Getting started with different types of Actors

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.

Extending the capabilities of actors

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.

Monitoring the actors and lifetime management

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.

Advanced use

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.