The cl-gserver Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-gserver Reference Manual

This is the cl-gserver Reference Manual, version 1.4.1, generated automatically by Declt version 3.0 "Montgomery Scott" on Mon Apr 19 14:52:11 2021 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

Introduction - Actor framework featuring actors and agents

cl-gserver is a 'message passing' library/framework with actors similar to Erlang or Akka.

Version 1.4.1: changed documentation to the excellent mgl-pax

Version 1.4: convenience macro for creating actor. See below for more details

Version 1.3.1: round-robin strategy for router

Version 1.3: agents can be created in actor-system

Version 1.2 introduces a breaking change

ask has been renamed to ask-s.

async-ask has been renamed to ask.

The proposed default way to query for a result from another actor should be an asynchronous ask. ask-s (synchronous) is of course still possible.

Version 1.0 of cl-gserver library comes with quite a few new features. One of the major new features is that an actor is not bound to it's own message dispatcher thread. Instead, when an actor-system is set-up, actors can use a shared pool of message dispatchers which effectively allows to create millions of actors.

It is now possible to create actor hierarchies. An actor can have child actors. An actor now can also 'watch' another actor to get notified about it's termination.

It is also possible to specify timeouts for the ask-s and ask functionality.

This new version is closer to Akka (the actor model framework on the JVM) than to GenServer on Erlang. This is because Common Lisp from a runtime perspective is closer to JVM than to Erlang/OTP. Threads in Common Lisp are heavy weight OS threads rather than user-space low weight 'Erlang' threads (I'd like to avoid 'green threads', because threads in Erlang are not really green threads). While on Erlang it is easily possible to spawn millions of processes/threads and so each actor (GenServer) has its own process, this model is not possible when the threads are OS threads, because of OS resource limits. This is the main reason for working with the message dispatcher pool instead.

But let's jump right into it. I'll explain more later.

Getting hands-on

Creating an actor-system

To use the shared dispatcher pool we have to create an actor-system first.

(defvar *system* (asys:make-actor-system))

When we eval *system* in the repl we see a bit of the structure:

#<ACTOR-SYSTEM shared-workers: 4, user actors: 0, internal actors: 0>

So the actor-system has by default four shared message dispatcher workers. Depending on how busy the system tends to be this default can of course be increased.

  1. Shutting down the system

    Shutting down an actor system may be necessary depending on how it's used. It can be done by:

    (ac:shutdown *system*)
    

    This will stop all dispatcher workers and all other actors that have been spawned in the system.

Creating actors

Actors kind of live within an actor-context. An actor-context contains a collection (of actors) and defines a Common Lisp protocol that spawns a set of generic functions.

There are two 'things' that host an actor-context. This is:

  1. the actor-system. Creating actors on the actor-system will create root actors.
  2. the actor. Creating actors on the context of an actor will create a child actor.

Here we now use the actor-context protocol/API nicknamed ac.

(ac:actor-of *system* (lambda ()
                        (act:make-actor 
                             (lambda (self msg state)
                               (let ((output (format nil "Hello ~a" msg)))
                                 (format t "~a~%" output)
                                 (cons output state)))
                             :name "answerer")))

The convenience version is just this, which you can generally use instead of ac:actor-of:

(act:actor-of (*system* "answerer")
  (lambda (self msg state)
    (let ((output (format nil "Hello ~a" msg)))
      (format t "~a~%" output)
      (cons output state))))

This creates a root actor on the *system*. Notice that the actor is not assigned to a variable. It is now registered in the system. The main argument to the actor-of function is a 'creator-function' which when evaluated returns an actor created with the main actor constructor make-actor.

make-actor requires as main parameter a 'receive' function which should look familiar if you know the previous version of cl-gserver. The parameters to the 'receive' function are still the tuple of:

  1. self - the instance of the actor
  2. msg - the received message of when this 'receive' function is called
  3. state - the current state of the actor

make-actor also allows to specify the initial state, a name, and a custom actor type. By default a standard actor of type 'actor is created. But you can subclass 'actor and specify your own. make-actor is still the facility to create them. If you require custom initialization for the custom actor do so in specializing initialize-instance function.

The return value of the 'receive' function should also be familiar. It is the cons with car being sent back to sender (in case of ask/ask-s) and cdr set as the new state of the actor.

The function actor-of still returns the actor as can be seen on the repl when this is executed. So it is of course possible to store the actor in a dynamic or lexical context. However, when the lexical context ends, the actor will still live as part of the actor context.

Here we see a few details of the actor. Among which is the name and also the type of message-box it uses. By default it is a message-box/dp which is the type of a shared message dispatcher message-box.

#<ACTOR answerer, running: T, state: NIL, message-box: #<MESSAGE-BOX/DP mesgb-9541, processed messages: 0, max-queue-size: 0, queue: #<QUEUE-UNBOUNDED #x3020029918FD>>>

Had we stored the actor to a variable, say *answerer* we can create a child actor of that by doing:

(ac:actor-of (act:context *answerer*) 
                          (lambda ()
                            (act:make-actor
                             (lambda (self msg state)
                               (let ((output (format nil "~a" "Hello-child ~a" msg)))
                                 (format t "~a~%" output)
                               (cons output state)))
                             :name "child-answerer")))

This will create a new actor on the context of the parent actor. The context is retrieved with (act:context *answerer*).

Convenience macro for creating actors

The macro actor-of in the actor package allows creating actors more easily. Internally it uses ac:actor-of and act:make-actor functions. But is removes a bit of typing. It also allows to specify either an actor-system, an actor-context or just an actor as context argument. The macro figures out the real context required to create the actor. Similarly as for make-actor it is possible to specify state, name and a custom actor type to the macro.

Here is an example:

(act:actor-of (*system*) 
  (lambda (self msg state)
    (cons "Hello world" state)))

It is sufficient to just specify the 'receive' lambda. The macro will add the rest.

Dispatchers :pinned vs. :shared

By default an actor created using actor-of uses a :shared dispatcher type which uses the shared message dispatchers that are setup in the system. It is also possible to create actors with their own dispatcher thread, those are called :pinned actors. Just provide the :pinned value to the dispatcher-type key parameter.

Finding actors in the context

If actors are not directly stored in a dynamic or lexical context they can still be looked up and used. The actor-context protocol contains a function find-actors which works like this:

(first (ac:find-actors 
                 *system*
                 (lambda (actor) (string= "answerer" 
                                          (act-cell:name actor)))))

find-actors takes as first parameter the actor context. This can be either the actor system, or the context of an actor. The second parameter is a test function. This example makes a string comparison on the actor name. So the above function will output:

#<ACTOR answerer, running: T, state: NIL, message-box: #<MESSAGE-BOX/DP mesgb-9687, processed messages: 0, max-queue-size: 0, queue: #<QUEUE-UNBOUNDED #x30200263C95D>>>

This function only does a simple flat search. The functionality of looking up an actor in the system generally will be expanded upon.

tell, ask-s and ask

Let's send some messages.

tell

tell is a fire-and-forget kind of send type. It doesn't expect a result in return.

And because of that, and in order to demonstrate it does something, it has to have a side-effect. So it dumps some string to the console using format, because we couldn't otherwise tell if the message was received and processed (see the *answerer* actor definitions above).

CL-USER> (act:tell *answerer* "Foo")
T
CL-USER> 
Hello Foo

So we see that tell returns immediately with T. But to see the 'Hello Foo' it takes another hit on the return key, because the REPL is not asynchronous.

tell with sender

tell accepts a 'sender', which has to be an actor. So we can do like this:

CL-USER> (act:tell *child-answerer* "Foo" *answerer*)
T
CL-USER> 
Hello-child Foo
Hello Hello-child Foo

This sends "Foo" to *child-answerer*, but *child-answerer* sends the response to *answerer*. So we see outputs of both actors.

ask-s

ask-s blocks until the message was processed by the actor. This call returns the car part of the cons return of the behavior function. Insofar an ask-s call is more resource intensive than just a tell.

(act:ask-s *answerer* "Bar")

Will respond with: 'Hello Bar'

ask

ask combines both ask-s and tell. From ask-s it 'inherits' returning a result, even though it's a future result. Internally it is implemented using tell. In order to wait for a result a temporary actor is spawned that waits until it receives the result from the actor where the message was sent to. With this received result the future is fulfilled. So ask is async, it returns immediately with a future. That future can be queried until it is fulfilled. Better is though to setup an on-completed handler function on it.

So we can do:

(future:on-completed
          (act:ask *answerer* "Buzz")
          (lambda (result)
            (format t "Received result: ~a~%" result)))

Well, one step at a time:

(act:ask *answerer* "Buzz")

Returns with:

#<FUTURE promise: #<PROMISE finished: NIL errored: NIL forward: NIL #x302002EAD6FD>>

Then we can setup a completion handler on the future:

(future:on-completed 
          *
          (lambda (result)
            (format t "Received result: ~a~%" result)))

Remember '*' is the last result in the REPL which is the future here.

This will print after a bit:

Hello Buzz
Received result: Hello Buzz

ask-s and ask with timeout

A timeout (in seconds) can be specified for both ask-s and ask and is done like so:

To demonstrate this we could setup an example 'sleeper' actor:

(ac:actor-of *system* 
             (lambda () (act:make-actor 
                           (lambda (self msg state)
                             (sleep 5)))))

If we store this to *sleeper* and do the following, the ask-s will return a handler-error with an ask-timeout condition.

(act:ask-s *sleeper* "Foo" :time-out 2)
(:HANDLER-ERROR . #<CL-GSERVER.UTILS:ASK-TIMEOUT #x30200319F97D>)

This works similar with the ask only that the future will be fulfilled with the handler-error cons.

To get a readable error message of the condition we can do:

CL-USER> (format t "~a" (cdr *))
A timeout set to 2 seconds occurred. Cause: 
#<BORDEAUX-THREADS:TIMEOUT #x302002FAB73D> 

Long running operations in receive

Be careful with doing long running computations in the receive function message handler, because it will block message processing. It is advised to use a third-party thread-pool or a library like lparallel to do the computations with and return early from the receive message handler.

Considering the required cons return result of the receive function, in case a result computation is delegated to a thread-pool the receive function should return with (cons :no-reply <state>). The :no-reply will instruct the actor to not send a result to a sender automatically should a sender be available (for the cases of tell or ask). The computation result can be 'awaited' for in an asynchronous manner and a response to *sender* can be sent manually by just doing a (tell *sender* <my-computation-result>). The sender of the original message is set to the dynamic variable *sender*.

Due to an asynchronous callback of a computation running is a separate thread, the *sender* must be copied into a lexical environment because at the time of when the callback is executed the *sender* can have a different value.

This behavior must be part of the messaging protocol that is being defined for the actors at play.

Changing behavior

An actor can change behavior. The behavior is just a lambda that has to take three parameters:

  1. the actor's instance - usually called self
  2. the received message - maybe call msg?
  3. the current state of the actor

The behavior then can pattern match (or do some matching by other means) on the received message alone, or in combination with the current state.

The default behavior of the actor is given on actor construction using the default constructor make-actor.

During the lifetime of an actor the behavior can be changed using become.

So we remember the *answerer* which responds with 'Hello Foo' when we send (act:ask-s *answerer* "Foo"). We can now change the behavior with:

(act:become *answerer* 
            (lambda (self msg state)
              (cons (format nil "my new behavior for: ~a" msg) state)))

When we now send (act:ask-s *answerer* "Foo") we will get the response: 'my new behavior for: Foo'.

Reverting become / unbecome

To revert back to the default behavior as defined by the receive function of the constructor you may call unbecome.

Creating actors without a system

It is still possible to create actors without a system. This is how you do it:

;; make an actor
(defvar *my-actor* (act:make-actor (lambda (self msg state)
                                     (cons "Foo" state))
                                   :name "Lone-actor"))
;; setup a thread based message box
(setf (act-cell:msgbox *my-actor*) 
      (make-instance 'mesgb:message-box/bt))

You have to take care yourself about stopping the actor and freeing resources.

Agents

An Agent is a specialized Actor. It is meant primarily for maintaining state and comes with some conveniences to do that.

To use an Agent import cl-gserver.agent package.

There is no need to subclass an Agent. Rather create a facade to customize an agent. See below.

An Agent provides three functions to use it.

All three take a lambda. The lambda for make-agent does not take a parameter. It should return the initial state of the agent. agent-get and agent-update both take a lambda that must support one parameter. This parameter represents the current state of the agent.

Let's make a simple example:

First create an agent with an initial state of 0.

(defparameter *my-agent* (make-agent (lambda () 0)))

Now update the state several times (agent-update is asynchronous and returns t immediately):

(agent-update *my-agent* (lambda (state) (1+ state)))

Finally get the state:

(agent-get *my-agent* #'identity)

This agent-get just uses the identity function to return the state as is.

So this simple agent represents a counter.

It is important to note that the retrieves state, i.e. with identity should not be modified outside the agent.

Using an agent within an actor-system

The make-agent constructor function allows to provides an optional system argument that, when given, makes the constructor create the agent within the given actor-system. This implies that the systems shared messages dispatcher is used for the agent and no separate thread is created for the agents message box.

It also implies that the agent is destroyed then the actor-system is destroyed.

However, while actors can create hierarchies, agents can not. Also the API for creating agents in systems is different to actors. This is to make explicit that agents are treated slightly differently than actors even though under the hood agents are actors.

Wrapping an agent

While you can use the agent as in the example above it is usually advised to wrap an agent behind a more simple facade that doesn't work with lambdas.

For example could a facade for the counter above look like this:

(defvar *counter-agent* nil)

(defun init-agent (initial-value)
  (setf *counter-agent* (make-agent (lambda () initial-value))))

(defun increment () (agent-update *counter-agent* #'1+))
(defun decrement () (agent-update *counter-agent* #'1-))
(defun counter-value () (agent-get *counter-agent* #'identity))

Alternatively, one can wrap an agent inside a class and provide methods for simplified access to it.

Router

A Router is a facade over a set of actors. Routers are either created with a set of actors using the default constructor router:make-router or actors can be added later.

Routers implement part of the actor protocol, so it allows to use tell, ask-s or ask which it forwards to a 'routee' (one of the actors of a router) by passing all of the given parameters. The routee is chosen by applying a strategy. The built-in default strategy a routee is chosen randomly.

The strategy can be configured when creating a router using the constructors &key parameter :strategy. The strategy is just a function that takes the number of routees and returns a routee index to be chosen for the next operation.

Currently available strategies: :random and :round-robin.

Custom strategies can be implemented.

Dispatchers

:shared

A :shared dispatcher is a separate facility that is set up in the actor-system. It consists of a configurable pool of 'dispatcher workers' (which are in fact actors). Those dispatcher workers execute the message handling in behalf of the actor and with the actors message handling code. This is protected by a lock so that every only one dispatcher will run code on an actor. This is to ensure protection from data race conditions of the state data of the actor (or other slots of the actor).

Using this dispatcher allows to create a large number of actors. The actors as such are generally very cheap.

:pinned

The :pinned dispatcher is represented by a thread that operates on the actors message queue. It handles one message after the other with the actors message handling code. This also ensures protection from data race conditions of the state of the actor.

This variant is slightly faster (see below) but requires one thread per actor.

Benchmarks

Hardware specs:

All

The benchmark was created by having 8 threads throwing each 125k (1m alltogether) messages at 1 actor. The timing was taken for when the actor did finish processing those 1m messages. The messages were sent by either all tell, ask-s, or ask to an actor whose message-box worked using a single thread (:pinned) or a dispatched message queue (:shared / dispatched) with 8 workers.

Of course a tell is in most cases the fastest one, because it's the least resource intensive and there is no place that is blocking in this workflow.

SBCL (v2.0.10)

Even though SBCL is by far the fastest one with tell on both :pinned and dispatched, it had massive problems on dispatched - ask-s where I had to lower the number of messages to 200k alltogether. Beyond that value SBCL didn't get it worked out.

CCL (v1.12)

CCL is on acceptable average speed. The problems CCL had was heap exhaustion for both the ask tasks where the number of messages had to be reduced to 80k. Which is not a lot. Beyond this value the runtime would crash. However, CCL for some reason had no problems where SBCL was struggling with the dispatched - ask-s.

ABCL (1.8)

The pleasant surprise was ABCL. While not being the fastest it is the most robust. Where SBCL and CCL were struggling you could throw anything at ABCL and it'll cope with it. I'm assuming that this is because of the massively battle proven Java Runtime.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 cl-gserver

Author

Manfred Bergmann

License

AGPL

Description

Actor framework featuring actors and agents for easy access to state and asynchronous operations.

Version

1.4.1

Dependencies
Source

cl-gserver.asd (file)

Component

src (module)


Next: , Previous: , Up: Top   [Contents][Index]

3 Modules

Modules are listed depth-first from the system components tree.


Next: , Previous: , Up: Modules   [Contents][Index]

3.1 cl-gserver/src

Parent

cl-gserver (system)

Location

src/

Components

Previous: , Up: Modules   [Contents][Index]

3.2 cl-gserver/src/core

Dependency

utils.lisp (file)

Parent

src (module)

Location

src/core/

Components

Next: , Previous: , Up: Top   [Contents][Index]

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.1 cl-gserver.asd

Location

cl-gserver.asd

Systems

cl-gserver (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.2 cl-gserver/src/dispatcher-api.lisp

Parent

src (module)

Location

src/dispatcher-api.lisp

Packages

cl-gserver.dispatcher

Exported Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.3 cl-gserver/src/actor-system-api.lisp

Dependency

dispatcher-api.lisp (file)

Parent

src (module)

Location

src/actor-system-api.lisp

Packages

cl-gserver.actor-system


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.4 cl-gserver/src/actor-context-api.lisp

Dependency

actor-system-api.lisp (file)

Parent

src (module)

Location

src/actor-context-api.lisp

Packages

cl-gserver.actor-context

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.5 cl-gserver/src/actor-api.lisp

Dependency

actor-context-api.lisp (file)

Parent

src (module)

Location

src/actor-api.lisp

Packages

cl-gserver.actor

Exported Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.6 cl-gserver/src/utils.lisp

Dependency

actor-api.lisp (file)

Parent

src (module)

Location

src/utils.lisp

Packages

cl-gserver.utils

Exported Definitions
Internal Definitions

wait-time (method)


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.7 cl-gserver/src/core/queue.lisp

Parent

core (module)

Location

src/core/queue.lisp

Packages

cl-gserver.queue

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.8 cl-gserver/src/core/message-box.lisp

Parent

core (module)

Location

src/core/message-box.lisp

Packages

cl-gserver.messageb

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.9 cl-gserver/src/core/actor-cell.lisp

Parent

core (module)

Location

src/core/actor-cell.lisp

Packages

cl-gserver.actor-cell

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.10 cl-gserver/src/fcomputation.lisp

Dependency

core (module)

Parent

src (module)

Location

src/fcomputation.lisp

Packages

cl-gserver.future

Exported Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.11 cl-gserver/src/actor.lisp

Dependency

fcomputation.lisp (file)

Parent

src (module)

Location

src/actor.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.12 cl-gserver/src/agent.lisp

Dependency

actor.lisp (file)

Parent

src (module)

Location

src/agent.lisp

Packages

cl-gserver.agent

Exported Definitions
Internal Definitions

receive (function)


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.13 cl-gserver/src/router.lisp

Dependency

agent.lisp (file)

Parent

src (module)

Location

src/router.lisp

Packages

cl-gserver.router

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.14 cl-gserver/src/dispatcher.lisp

Dependency

router.lisp (file)

Parent

src (module)

Location

src/dispatcher.lisp

Exported Definitions
Internal Definitions

receive (function)


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.15 cl-gserver/src/actor-context.lisp

Dependency

dispatcher.lisp (file)

Parent

src (module)

Location

src/actor-context.lisp

Exported Definitions
Internal Definitions

Previous: , Up: Lisp files   [Contents][Index]

4.1.16 cl-gserver/src/actor-system.lisp

Dependency

actor-context.lisp (file)

Parent

src (module)

Location

src/actor-system.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

5.1 cl-gserver.dispatcher

Source

dispatcher-api.lisp (file)

Nickname

disp

Use List

common-lisp

Exported Definitions
Internal Definitions

receive (function)


Next: , Previous: , Up: Packages   [Contents][Index]

5.2 cl-gserver.actor-system

Source

actor-system-api.lisp (file)

Nickname

asys

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Packages   [Contents][Index]

5.3 cl-gserver.actor-context

Source

actor-context-api.lisp (file)

Nickname

ac

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Packages   [Contents][Index]

5.4 cl-gserver.actor

Source

actor-api.lisp (file)

Nickname

act

Use List

common-lisp

Used By List

cl-gserver.agent

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Packages   [Contents][Index]

5.5 cl-gserver.utils

Source

utils.lisp (file)

Nickname

utils

Use List

common-lisp

Used By List
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Packages   [Contents][Index]

5.6 cl-gserver.queue

Source

queue.lisp (file)

Nickname

queue

Use List

common-lisp

Used By List

cl-gserver.messageb

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Packages   [Contents][Index]

5.7 cl-gserver.messageb

Source

message-box.lisp (file)

Nickname

mesgb

Use List
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Packages   [Contents][Index]

5.8 cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Nickname

act-cell

Use List
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Packages   [Contents][Index]

5.9 cl-gserver.future

Source

fcomputation.lisp (file)

Nickname

future

Use List
Exported Definitions

Next: , Previous: , Up: Packages   [Contents][Index]

5.10 cl-gserver.agent

Source

agent.lisp (file)

Nickname

agt

Use List
Exported Definitions
Internal Definitions

receive (function)


Previous: , Up: Packages   [Contents][Index]

5.11 cl-gserver.router

Source

router.lisp (file)

Nickname

router

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

6.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.1 Special variables

Special Variable: *sender*

The ‘*sender*‘ is dynamically bound and available in ‘receive‘ function, when it is known.

Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.2 Macros

Macro: actor-of (CONTEXT &optional NAME &key DISPATCHER STATE TYPE) &body BODY

Simple interface for creating an actor.
This macro is not to confuse with the actor-context function ‘actor-of‘.
Internally it calls ‘ac:actor-of‘.
‘context‘ is either an ‘actor-system‘, an ‘actor-context‘, or an ‘actor‘ (any type of actor). The new actor is created in the given context.
- ‘name‘ is optional. Specify when a static name is needed.
- ‘:state‘ key can be used to initialize with a state.
- ‘:dispatcher‘ key can be used to define the message dispatcher manually.
Options are ‘:shared‘ (default) and ‘:pinned‘.
- ‘:type‘ can specify a custom actor class. See ‘make-actor‘ for more info.

Package

cl-gserver.actor

Source

actor-api.lisp (file)

Macro: filter FUN LIST
Package

cl-gserver.utils

Source

utils.lisp (file)

Macro: with-submit-handler (MSGBOX MESSAGE WITHREPLY-P TIME-OUT) &rest BODY

Macro to let the caller specify a message handler function. Use this instead of ‘submit‘.

Package

cl-gserver.messageb

Source

message-box.lisp (file)

Macro: with-waitfor (WAIT-TIME) &body BODY
Package

cl-gserver.utils

Source

utils.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.3 Functions

Function: add-routee ROUTER ROUTEE

Adds a routee/actor to the router.

Package

cl-gserver.router

Source

router.lisp (file)

Function: agent-get AGENT GET-FUN

Gets the current state of the ‘agent‘.
‘get-fun‘ must accept one parameter. That is the current-state of the ‘agent‘.
To return the current state ‘get-fun‘ may be just the ‘identity‘ function.
Beware that this function does directly access the state of the agent for performance reasons. It does not go through message processing.
See ‘agent-test‘ for examples.

Package

cl-gserver.agent

Source

agent.lisp (file)

Function: agent-stop AGENT

Stops the message handling of the agent.

Package

cl-gserver.agent

Source

agent.lisp (file)

Function: agent-update AGENT UPDATE-FUN

Updates the ‘agent‘ state.
‘update-fun‘ must accept one parameter. That is the current state of the ‘agent‘. The return value of ‘update-fun‘ will be taken as the new state of the ‘agent‘.

Package

cl-gserver.agent

Source

agent.lisp (file)

Function: assert-cond ASSERT-FUN MAX-TIME &optional SLEEP-TIME
Package

cl-gserver.utils

Source

utils.lisp (file)

Function: call ACTOR-CELL MESSAGE &key TIME-OUT

Send a message to a actor-cell instance and wait for a result.
Specify a timeout in seconds if you require a result within a certain period of time. Be aware though that this is a resource intensive wait based on a waiting thread. The result can be of different types.
Success result: <returned-state>
Unhandled result: ‘:unhandled‘
Error result: ‘(cons :handler-error <condition>)’
In case of time-out the error condition is a bt:timeout.

Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Function: cast ACTOR-CELL MESSAGE &optional SENDER

Sends a message to a actor-cell asynchronously. There is no result. If a ‘sender’ is specified the result will be sent to the sender.

Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Function: collect-backtrace CONDITION
Package

cl-gserver.utils

Source

utils.lisp (file)

Function: complete-p FUTURE

Is ‘future‘ completed? Returns either ‘t‘ or ‘nil‘.

Package

cl-gserver.future

Source

fcomputation.lisp (file)

Function: get-result FUTURE

Get the computation result. If not yet available ‘:not-ready‘ is returned.

Package

cl-gserver.future

Source

fcomputation.lisp (file)

Function: make-actor-context ACTOR-SYSTEM &optional ID

Creates an ‘actor-context‘. Requires a reference to ‘actor-system‘ ‘id‘ is an optional value that can identify the ‘actor-context‘.

Package

cl-gserver.actor-context

Source

actor-context.lisp (file)

Function: make-actor-system &key SHARED-DISPATCHER-WORKERS

Creates an ‘actor-system‘.
Allows to configure the amount of workers for the ‘shared-dispatcher‘.

Package

cl-gserver.actor-system

Source

actor-system.lisp (file)

Function: make-agent STATE-FUN &optional SYSTEM

Makes a new ‘agent‘ instance.
‘state-fun‘ is a function that takes no parameter and provides the initial state of the ‘agent‘ as return value.

Optionally an ‘actor-system‘ can be specified. If specified the agent will be registered in the ‘system‘ and destroyed with it should the actor-system be destroyed. In addition the agent will use the systems shared message dispatcher and will _not_ create it’s own.

Package

cl-gserver.agent

Source

agent.lisp (file)

Function: make-delayed-cancellable-message INNER-MSG DELAY &optional CANCELLED-P
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: make-dispatcher &key NUM-WORKERS

Default constructor.
This creates a ‘shared-dispatcher‘ with ‘num-workers‘ number of workers. Each worker is based on a ‘:pinned‘ actor meaning that it has its own thread.

Package

cl-gserver.dispatcher

Source

dispatcher.lisp (file)

Function: make-dispatcher-worker NUM

Constructor for creating a worker.
‘num‘ only has the purpose to give the worker a name which includes a number.

Package

cl-gserver.dispatcher

Source

dispatcher.lisp (file)

Function: make-future EXECUTE-FUN

Creates a future. ‘execute-fun‘ is the lambda that is executed when the future is created.
‘execute-fun‘ takes a parameter which is the ‘resolve-fun‘ funtion. ‘resolve-fun‘ function
takes the ‘promise‘ as parameter which is the computed value. Calling ‘resolve-fun‘ with the promise
will fulfill the ‘future‘.
Manually calling ‘resolve-fun‘ to fulfill the ‘future‘ is in contrast to just fulfill the ‘future‘ from a return value. The benefit of the ‘resolve-fun‘ is flexibility. In a multi-threaded environment ‘execute-fun‘ could spawn a thread, in which case ‘execute-fun‘ would return immediately but no promise can be given at that time. The ‘resolve-fun‘ can be called from a thread and provide the promise.

Create a future with:

“‘elisp
(make-future (lambda (resolve-fun)
(let ((promise (delayed-computation)))
(bt:make-thread (lambda ()
(sleep 0.5)
(funcall resolve-fun promise))))))
“‘

Package

cl-gserver.future

Source

fcomputation.lisp (file)

Function: make-router &key STRATEGY ROUTEES

Default constructor of router.
Built-in strategies: ‘:random‘, ‘:round-robin‘.
Specify your own strategy by providing a function that takes a ‘fixnum‘ as parameter which represents the number of routees and returns a ‘fixnum‘ that represents the index of the routee to choose.

Specify ‘routees‘ if you know them upfront.

Package

cl-gserver.router

Source

router.lisp (file)

Function: make-timer DELAY RUN-FUN
Package

cl-gserver.utils

Source

utils.lisp (file)

Function: mkstr &rest ARGS

Converts all parameters to string and concatenates them.

Package

cl-gserver.utils

Source

utils.lisp (file)

Function: on-completed FUTURE COMPLETED-FUN

Install an on-completion handler function on the given ‘future‘.
If the ‘future‘ is already complete then the ‘completed-fun‘ function is called immediately.
‘completed-fun‘ takes a parameter which represents the fulfilled promise (the value with which the ‘future‘ was fulfilled).

Package

cl-gserver.future

Source

fcomputation.lisp (file)

Function: routees ROUTER

Returns the routees as list.

Package

cl-gserver.router

Source

router.lisp (file)

Function: running-p ACTOR-CELL

Returns true if this server is running. ‘nil‘ otherwise.

Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Function: stop ROUTER

Stops all routees.

Package

cl-gserver.router

Source

router.lisp (file)

Function: wait-cond COND-FUN &optional SLEEP-TIME MAX-TIME
Package

cl-gserver.utils

Source

utils.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.4 Generic functions

Generic Function: actor-of CONTEXT CREATE-FUN &key DISPATCH-TYPE QUEUE-SIZE

Creates and adds actors to the given context.

Both an ‘actor-system‘ and an ‘actor‘ are composed of an ‘actor-context‘.
When an ‘actor-system‘ is specified as context (‘actor-system‘ implements parts of the protocol) then the new actor will be a new root actor.

When the new actor should be a child of another actor, then the ‘actor-context‘ of the (to be) parent ‘actor‘ should be specified.
Creating an actor via ‘actor-of‘ will also add the ‘actor-context‘ as watcher of the actor. This watching can be used for different purposes. Right now the ‘actor‘ is removed from the context when it was stopped.

Specify the dispatcher type (‘disp-type‘) as either:
‘:shared‘ to have this actor use the shared message dispatcher of the context
‘:pinned‘ to have this actor run it’s own message box thread (faster, but more resource are bound.)

Specify ‘queue-size‘ with:
0: for a unbounded queue
gt 0: for a bounded queue (preferably a size > 100)

Package

cl-gserver.actor-context

Source

actor-context-api.lisp (file)

Methods
Method: actor-of (SELF actor-system) CREATE-FUN &key DISPATCH-TYPE QUEUE-SIZE

See ‘ac:actor-of‘

Source

actor-system.lisp (file)

Method: actor-of (SELF actor-context) CREATE-FUN &key DISPATCH-TYPE QUEUE-SIZE

See ‘ac:actor-of‘

Source

actor-context.lisp (file)

Generic Function: after-stop ACTOR-CELL

Generic function definition that is called after the actor cell has stopped.

Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Methods
Method: after-stop (SELF actor-cell)

Empty implementation so that we can call it anyway even if there are no other implementations.

Generic Function: all-actors CONTEXT

Retrieves all actors of this context as a list

Package

cl-gserver.actor-context

Source

actor-context-api.lisp (file)

Methods
Method: all-actors (SELF actor-system)

See ‘ac:all-actors‘

Source

actor-system.lisp (file)

Method: all-actors (SELF actor-context)

See ‘ac:all-actors‘

Source

actor-context.lisp (file)

Generic Function: ask ACTOR MESSAGE &key TIME-OUT

This returns a ‘future‘.
Specify ‘timeout‘ if a message is to be expected after a certain time.
An ‘:handler-error‘ with ‘timeout‘ condition will be returned is the call timed out.

An ‘ask‘ is similar to a ‘ask-s‘ in that the caller gets back a result
but it doesn’t have to actively wait for it. Instead a ‘future‘ wraps the result.
However, the internal message handling is based on ‘tell‘.
How this works is that the message to the target ‘actor‘ is not ’sent’ using the callers thread
but instead an anonymous ‘actor‘ is started behind the scenes and this in fact makes tells
the message to the target ‘actor‘. It does sent itself along as ’sender’.
The target ‘actor‘ tells a response back to the initial ‘sender‘. When that happens and the anonymous ‘actor‘ received the response the ‘future‘ will be fulfilled with the ‘promise‘.

Package

cl-gserver.actor

Source

actor-api.lisp (file)

Methods
Method: ask (SELF router) MESSAGE &key TIME-OUT

Posts the message to one routee. The routee is chosen from the router ‘strategy‘. Otherwise see: ‘act:ask‘.

Source

router.lisp (file)

Method: ask (SELF actor) MESSAGE &key TIME-OUT
Source

actor.lisp (file)

Generic Function: ask-s ACTOR MESSAGE &key TIME-OUT

Sends a message to the ‘actor‘. ‘ask-s‘ is synchronous and waits for a result.
Specify ‘timeout‘ if a message is to be expected after a certain time.
An ‘:handler-error‘ with ‘timeout‘ condition will be returned if the call timed out.

‘ask-s‘ assumes, no matter if ‘ask-s‘ is issued from outside or inside an actor, that the response is delivered back to the caller. That’s why ‘ask-s‘ does block the execution until the result is available. The ‘receive‘ function handler must specify the result as the ‘car‘ of the cons result.

Package

cl-gserver.actor

Source

actor-api.lisp (file)

Methods
Method: ask-s (SELF router) MESSAGE &key TIME-OUT

Posts the message to one routee. The routee is chosen from the router ‘strategy‘. Otherwise see: ‘act:ask-s‘.

Source

router.lisp (file)

Method: ask-s (SELF actor) MESSAGE &key TIME-OUT
Source

actor.lisp (file)

Generic Function: become ACTOR NEW-BEHAVIOR

Changes the receive of the actor to the given ‘new-behavior‘ function.
The ‘new-behavior‘ function must accept 3 parameters: the actor instance, the message and the current state.

Package

cl-gserver.actor

Source

actor-api.lisp (file)

Methods
Method: become (SELF actor) NEW-BEHAVIOR
Source

actor.lisp (file)

Generic Function: cancelled-p OBJECT
Generic Function: (setf cancelled-p) NEW-VALUE OBJECT
Package

cl-gserver.messageb

Methods
Method: cancelled-p (DELAYED-CANCELLABLE-MESSAGE delayed-cancellable-message)

automatically generated reader method

Source

message-box.lisp (file)

Method: (setf cancelled-p) NEW-VALUE (DELAYED-CANCELLABLE-MESSAGE delayed-cancellable-message)

automatically generated writer method

Source

message-box.lisp (file)

Generic Function: cause CONDITION
Package

cl-gserver.utils

Methods
Method: cause (CONDITION ask-timeout)
Source

utils.lisp (file)

Generic Function: context ACTOR

This is the ‘actor-context‘ every actor is composed of.
When the actor is created from scratch it has no ‘actor-context‘.
When created through the ‘actor-context‘s, or system’s ‘actor-of‘ function an ‘actor-context‘ will be set.

Package

cl-gserver.actor

Source

actor-api.lisp (file)

Writer

(setf context) (generic function)

Methods
Method: context (ACTOR actor)

automatically generated reader method

Source

actor.lisp (file)

Generic Function: (setf context) NEW-VALUE OBJECT
Package

cl-gserver.actor

Reader

context (generic function)

Methods
Method: (setf context) NEW-VALUE (ACTOR actor)

automatically generated writer method

Source

actor.lisp (file)

Generic Function: dispatch DISPATCHER DISPATCHER-EXEC-FUN

Dispatches a function (‘dispatch-exec-fun‘) to a worker of the dispatcher to execute there. ‘dispatch‘ does a ‘ask-s‘ to a ‘dispatcher‘ worker, which means this call will block.

Package

cl-gserver.dispatcher

Source

dispatcher-api.lisp (file)

Methods
Method: dispatch (SELF shared-dispatcher) DISPATCH-EXEC-FUN
Source

dispatcher.lisp (file)

Generic Function: dispatch-async DISPATCHER DISPATCHER-EXEC-FUN

Dispatches a function to a worker of the dispatcher to execute there. ‘dispatch-async‘ does a ‘tell‘ to a ‘dispatcher‘ worker and is asynchronous.

Package

cl-gserver.dispatcher

Source

dispatcher-api.lisp (file)

Methods
Method: dispatch-async (SELF shared-dispatcher) DISPATCH-EXEC-FUN
Source

dispatcher.lisp (file)

Generic Function: dispatchers OBJECT
Package

cl-gserver.actor-system

Methods
Method: dispatchers (ACTOR-SYSTEM actor-system)

Internal API: contains a list of available message dispatchers.

Source

actor-system.lisp (file)

Generic Function: emptyq-p QUEUE-BASE

Returns ‘T’ if there is no element in the queue.

Package

cl-gserver.queue

Source

queue.lisp (file)

Methods
Method: emptyq-p (SELF queue-bounded)
Method: emptyq-p (SELF queue-unbounded)
Generic Function: find-actor-by-name CONTEXT NAME

Returns an actor for the given name, when it exists.

Package

cl-gserver.actor-context

Source

actor-context-api.lisp (file)

Methods
Method: find-actor-by-name (SELF actor-system) NAME

See ‘ac:find-actor-by-name‘

Source

actor-system.lisp (file)

Method: find-actor-by-name (SELF actor-context) NAME

See ‘ac:find-actor-by-name‘

Source

actor-context.lisp (file)

Generic Function: find-actors CONTEXT TEST-FUN

Returns actors of this context where ‘test-fun‘ provides ’truth’.

Package

cl-gserver.actor-context

Source

actor-context-api.lisp (file)

Methods
Method: find-actors (SELF actor-system) TEST-FUN

See ‘ac:find-actors‘

Source

actor-system.lisp (file)

Method: find-actors (SELF actor-context) TEST-FUN

See ‘ac:find-actors‘

Source

actor-context.lisp (file)

Generic Function: handle-call ACTOR-CELL MESSAGE CURRENT-STATE

Handles calls to the server. Must be implemented by subclasses.
The convention here is to return a ‘cons‘ with values to be returned to caller as ‘car‘, and the new state as ‘cdr‘. ‘handle-call‘ is executed in the default message dispatcher thread.

Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Methods
Method: handle-call (SELF actor) MESSAGE STATE
Source

actor.lisp (file)

Generic Function: handle-cast ACTOR-CELL MESSAGE CURRENT-STATE

Handles casts to the server. Must be implemented by subclasses.
Same convention as for ’handle-call’ except that no return is sent to the caller. This function returns immediately.

Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Methods
Method: handle-cast (SELF actor) MESSAGE STATE
Source

actor.lisp (file)

Generic Function: id OBJECT
Package

cl-gserver.actor-context

Methods
Method: id (ACTOR-CONTEXT actor-context)

The id of this actor-context. Usually a string.

Source

actor-context-api.lisp (file)

Generic Function: inner-msg OBJECT
Package

cl-gserver.messageb

Methods
Method: inner-msg (DELAYED-CANCELLABLE-MESSAGE delayed-cancellable-message)

automatically generated reader method

Source

message-box.lisp (file)

Generic Function: make-actor RECEIVE &key NAME STATE TYPE

Default constructor of an ‘actor‘.
Specify a custom actor class as the ‘:type‘ key which defaults to ’actor.
Say you have a custom actor ‘custom-actor‘ and want ‘make-actor‘ create an instance of it.
Then specify ‘:type ’custom-actor‘ on ‘make-actor‘ function.
If you have additional initializations to make you can do so in ‘initialize-instance‘.

The ‘receive‘ parameter is a function that should take 3 parameters.
That is:
1. the actor ‘instance‘ itself,
2. the ‘message‘ and
3. the ‘current-state‘ of the actor.

The ‘receive‘ can then decide how to handle the message.
In any case it has to return a ‘cons‘ of message to be sent back to caller (‘car‘), if applicable.
And the new state of the actor.
I.e.: ‘(cons <my-response> <my-new-state>)‘

If the operation was an ‘ask-s‘ or ‘ask‘ then the ‘car‘ part of the ‘cons‘ will be sent back to the caller.
In case of a ‘tell‘ operation there will be no response and the ‘car‘ of the ‘cons‘ is ignored,
if there is no sender. If there is a sender defined, then the ‘car‘ of the ‘cons‘ is sent to the sender.
It is possible to specify ‘:no-reply‘ in this case which has the effect that this result is _not_ sent to the sender even if one exists. This is for the case that the user wants to handle the state and the any notifications to a sender himself. It is useful when the ‘receive‘ message handler is executed in a special thread-pool, because long running operations within ‘receive‘ will block the message handling of the actor.

The ‘:no-reply‘ result works for ‘ask‘ and ‘tell‘, because also ‘ask‘ is based on ‘tell‘.
‘ask-s‘ is really only useful if a synchronous result is required and should be avoided otherwise.

Package

cl-gserver.actor

Source

actor-api.lisp (file)

Methods
Method: make-actor RECEIVE &key NAME STATE TYPE
Source

actor.lisp (file)

Generic Function: msgbox OBJECT
Generic Function: (setf msgbox) NEW-VALUE OBJECT
Package

cl-gserver.actor-cell

Methods
Method: msgbox (ACTOR-CELL actor-cell)
Method: (setf msgbox) NEW-VALUE (ACTOR-CELL actor-cell)

The ‘message-box‘. By default the ‘actor‘/‘actor-cell‘ has no message-box.
When the actor is created through the ‘actor-context‘ of an actor, or the ‘actor-system‘ then it will be populated with a message-box.

Source

actor-cell.lisp (file)

Generic Function: name OBJECT
Package

cl-gserver.actor-cell

Methods
Method: name (ACTOR-CELL actor-cell)

The name of the actor/actor-cell. If no name is specified a default one is applied.

Source

actor-cell.lisp (file)

Generic Function: notify CONTEXT ACTOR NOTIFICATION

Notify the ‘actor-context‘ about something that happened to an actor. Current exists:

- ‘:stopped‘: this will remove the actor from the context.

Package

cl-gserver.actor-context

Source

actor-context-api.lisp (file)

Methods
Method: notify (SELF actor-context) ACTOR NOTIFICATION
Source

actor-context.lisp (file)

Generic Function: path ACTOR

The path of the actor, including the actor itself.
The path denotes a tree which starts at the system context.

Package

cl-gserver.actor

Source

actor-api.lisp (file)

Methods
Method: path (SELF actor)
Source

actor.lisp (file)

Generic Function: popq QUEUE-BASE

Pops the first element. Blocks until an element arrives.

Package

cl-gserver.queue

Source

queue.lisp (file)

Methods
Method: popq (SELF queue-bounded)
Method: popq (SELF queue-unbounded)
Generic Function: pre-start ACTOR-CELL STATE

Generic function definition that called from ‘initialize-instance‘.

Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Methods
Method: pre-start (SELF actor-cell) STATE

Empty implementation so that we can call it anyway even if there are no other implementations.

Generic Function: pushq QUEUE-BASE ELEMENT

Pushes an element to the queue.

Package

cl-gserver.queue

Source

queue.lisp (file)

Methods
Method: pushq (SELF queue-bounded) ELEMENT
Method: pushq (SELF queue-unbounded) ELEMENT
Generic Function: shutdown DISPATCHER

Shutting down the dispatcher and all workers.

Package

cl-gserver.dispatcher

Source

dispatcher-api.lisp (file)

Methods
Method: shutdown (SELF shared-dispatcher)
Source

dispatcher.lisp (file)

Generic Function: shutdown CONTEXT

Stops all actors in this context.
When the context is an ‘actor-context‘ this still stop the actor context and all its actors. For the ‘actor-system‘ it will stop the whole system with all actors.

Package

cl-gserver.actor-context

Source

actor-context-api.lisp (file)

Methods
Method: shutdown (SELF actor-system)

See ‘ac:shutdown‘

Source

actor-system.lisp (file)

Method: shutdown (SELF actor-context)

See ‘ac:shutdown‘

Source

actor-context.lisp (file)

Generic Function: state OBJECT
Package

cl-gserver.actor-cell

Methods
Method: state (ACTOR-CELL actor-cell)

The encapsulated state.

Source

actor-cell.lisp (file)

Generic Function: stop CONTEXT ACTOR

Stops the given actor on the context.
The context may either be an ‘actor-context‘, or an ‘actor-system‘.

Package

cl-gserver.actor-context

Source

actor-context-api.lisp (file)

Methods
Method: stop (SELF actor-system) ACTOR

See ‘ac:stop‘

Source

actor-system.lisp (file)

Method: stop (SELF actor-context) ACTOR

See ‘ac:stop‘

Source

actor-context.lisp (file)

Generic Function: stop MESSAGE-BOX-BASE

Stops the message processing.

Package

cl-gserver.messageb

Source

message-box.lisp (file)

Methods
Method: stop (SELF message-box/dp)
Method: stop (SELF message-box/bt)
Method: stop (SELF message-box-base)
Generic Function: stop ACTOR-CELL

Stops the actor-cell.

Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Methods
Method: stop (SELF actor)

If this actor has an ‘actor-context‘, also stop all children. In any case stop the actor-cell.

Source

actor.lisp (file)

Method: stop (SELF actor-cell)
Generic Function: strategy-fun OBJECT
Package

cl-gserver.router

Methods
Method: strategy-fun (ROUTER router)

The router strategy function.
The ‘strategy‘ is a function with a ‘fixnum‘ as input and a ‘fixnum‘ as output. The input represents the number of routees.
The output represents the index of the routee to choose by calling the function.

Source

router.lisp (file)

Generic Function: submit MESSAGE-BOX-BASE MESSAGE WITHREPLY-P TIME-OUT HANDLER-FUN

Submit a message to the mailbox to be queued and handled.

Package

cl-gserver.messageb

Source

message-box.lisp (file)

Methods
Method: submit (SELF message-box/dp) MESSAGE WITHREPLY-P TIME-OUT HANDLER-FUN

Submitting a message on a multi-threaded ‘dispatcher‘ is different as submitting on a single threaded message-box. On a single threaded message-box the order of message processing is guaranteed even when submitting from multiple threads. On the ‘dispatcher‘ this is not the case. The order cannot be guaranteed when messages are processed by different ‘dispatcher‘ threads. However, we still guarantee a ’single-threadedness’ regarding the state of the actor. This is achieved here by protecting the ‘handler-fun‘ execution with a lock.

The ‘time-out‘ with the ’dispatcher mailbox’ assumes that the message received the dispatcher queue
and the handler in a reasonable amount of time, so that the effective time-out applies on the actual
handling of the message on the dispatcher queue thread.

Method: submit (SELF message-box/bt) MESSAGE WITHREPLY-P TIME-OUT HANDLER-FUN

Alternatively use ‘with-submit-handler‘ from your code to handle the message after it was ’popped’ from the queue. The ‘handler-fun‘ argument here will be ‘funcall‘ed when the message was ’popped’.

Generic Function: system OBJECT
Package

cl-gserver.actor-context

Methods
Method: system (ACTOR-CONTEXT actor-context)

A reference to the ‘actor-system‘.

Source

actor-context-api.lisp (file)

Generic Function: tell ACTOR MESSAGE &optional SENDER

Sends a message to the ‘actor‘. ‘tell‘ is asynchronous. There is no result.
If a ‘sender‘ is specified a message result of the target actor of the ‘tell‘ will be sent back to the ‘sender‘

Generally ‘tell‘ does not expect a response. But a ‘sender‘ can be specified as optionl parameter to ‘tell‘.
If a ‘sender‘ is specified, then the message handling behavior will send the ‘car‘ of the ‘cons‘ result to the specified ‘sender‘.

A ‘sender‘ can also be part of the message contract.

‘tell‘ can be used in two environments:

1. outside an actor

By default this sends a message as fire & forget. Since this is not inside an actor, no actor can be inferred as ‘sender‘. A ‘sender‘ can be defined as optional parameter as part of ‘tell‘.

2. inside an actors as part of the ‘receive‘ function

As ‘sender‘ can be specified when ‘tell‘ is used inside of an actor. Currently the framework doesn’t automatically infer the ‘sender‘ when no ‘sender‘ is explicitly specified.

=> This is a future enhancement.

Package

cl-gserver.actor

Source

actor-api.lisp (file)

Methods
Method: tell (SELF router) MESSAGE &optional SENDER

Posts the message to one routee. The routee is chosen from the router ‘strategy‘. Otherwise see: ‘act:tell‘.

Source

router.lisp (file)

Method: tell (SELF actor) MESSAGE &optional SENDER
Source

actor.lisp (file)

Generic Function: unbecome ACTOR

Reverts any behavior applied via ‘become‘ back to the default ‘receive‘ function.

Package

cl-gserver.actor

Source

actor-api.lisp (file)

Methods
Method: unbecome (SELF actor)
Source

actor.lisp (file)

Generic Function: unwatch ACTOR WATCHER

Unregisters ‘watcher‘ of ‘actor‘.

Package

cl-gserver.actor

Source

actor-api.lisp (file)

Methods
Method: unwatch (SELF actor) WATCHER
Source

actor.lisp (file)

Generic Function: watch ACTOR WATCHER

Registers ‘watcher‘ as a watcher of ‘actor‘.
Watching lets the watcher know about lifecycle changes of the actor being watched.
I.e.: when it stopped. The message being sent in this case is: ‘(cons :stopped actor-instance)‘

Package

cl-gserver.actor

Source

actor-api.lisp (file)

Methods
Method: watch (SELF actor) WATCHER
Source

actor.lisp (file)

Generic Function: watchers ACTOR

Returns a list of watchers of ‘actor‘.

Package

cl-gserver.actor

Source

actor-api.lisp (file)

Methods
Method: watchers (ACTOR actor)

List of watchers of this actor.

Source

actor.lisp (file)

Generic Function: workers DISPATCHER

Returns the workers of this dispatcher.
But better do not touch them.
Only use the defined interface here to talk to them.

Package

cl-gserver.dispatcher

Source

dispatcher-api.lisp (file)

Methods
Method: workers (SELF shared-dispatcher)
Source

dispatcher.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.5 Conditions

Condition: actor-name-exists ()
Package

cl-gserver.actor-context

Source

actor-context-api.lisp (file)

Direct superclasses

error (condition)

Direct methods

name (method)

Direct slots
Slot: name
Initargs

:name

Readers

name (generic function)

Condition: ask-timeout ()
Package

cl-gserver.utils

Source

utils.lisp (file)

Direct superclasses

serious-condition (condition)

Direct methods
Direct slots
Slot: wait-time
Initargs

:wait-time

Initform

(quote nil)

Readers

wait-time (generic function)

Slot: cause
Initargs

:cause

Initform

(quote nil)

Readers

cause (generic function)


Previous: , Up: Exported definitions   [Contents][Index]

6.1.6 Classes

Class: actor ()

This is the ‘actor‘ class.
The ‘actor‘ does its message handling using the ‘receive‘ function.
There is asynchronous ‘tell‘ (no response) and synchronous ‘ask-s‘ and asynchronous ‘ask‘ (with response). To stop an actors message processing in order to cleanup resouces you should tell (either ‘tell‘ or ‘ask-s‘) the ‘:stop‘ message. It will respond with ‘:stopped‘ (in case of ‘ask(-s)‘).

Package

cl-gserver.actor

Source

actor.lisp (file)

Direct superclasses

actor-cell (class)

Direct subclasses
Direct methods
Direct slots
Slot: receive

‘receive‘ is a function that has to take 3 parameters:
- ‘self‘: the actor instance
- ‘msg‘: the received message
- ‘state‘: the current state of the actor
The ‘sender‘ of the message, if available, is accessible with ‘*sender*‘ from within the receive function or a behavior.

Initargs

:receive

Initform

(error "'receive' must be specified!")

Readers

receive (generic function)

Slot: behavior

Behavior function applied via ‘become‘ and reverted via ‘unbecome‘ ‘behavior’ function takes the same parameters as ‘receive‘.

Slot: context
Readers

context (generic function)

Writers

(setf context) (generic function)

Slot: watchers

List of watchers of this actor.

Initform

(quote nil)

Readers

watchers (generic function)

Class: actor-cell ()

‘actor-cell‘ is the base of the ‘actor‘.
It is meant to encapsulate state, but also to execute async operations.
State can be changed by calling into the server via ‘call‘ or ‘cast‘.
Where ‘call‘ is waiting for a result and ‘cast‘ does not.
For each ‘call‘ and ‘cast‘ handlers must be implemented by subclasses.

It uses a ‘message-box‘ to processes the received messages.
When the ‘actor‘/‘actor-cell‘ was created ad-hoc (out of the ‘actor-system‘/‘actor-context‘),
it will not have a message-box and can’t process messages.
When the ‘actor‘ is created through the ‘actor-system‘ or ‘actor-context‘,
one can decide what kind of message-box/dispatcher should be used for the new ‘actor‘.

See ‘actor-context‘ ‘actor-of‘ method for more information on this.

To stop an ‘actor‘ message handling and you can send the ‘:stop‘ message
either via ‘call‘ (which will respond with ‘:stopped‘) or ‘cast‘.
This is to cleanup thread resources when the Gserver is not needed anymore.

Note: the ‘actor-cell‘ uses ‘call‘ and ‘cast‘ functions which translate to ‘ask-s‘ and ‘tell‘ on the ‘actor‘.

Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Direct superclasses

standard-object (class)

Direct subclasses

actor (class)

Direct methods
Direct slots
Slot: name

The name of the actor/actor-cell. If no name is specified a default one is applied.

Initargs

:name

Initform

(string (gensym "actor-"))

Readers

name (generic function)

Slot: state

The encapsulated state.

Initargs

:state

Readers

state (generic function)

Slot: internal-state

The internal state of the server.

Initform

(cl-gserver.actor-cell::make-actor-cell-state)

Slot: msgbox

The ‘message-box‘. By default the ‘actor‘/‘actor-cell‘ has no message-box.
When the actor is created through the ‘actor-context‘ of an actor, or the ‘actor-system‘ then it will be populated with a message-box.

Readers

msgbox (generic function)

Writers

(setf msgbox) (generic function)

Class: actor-context ()

‘actor-context‘ deals with creating and maintaining actors.
The ‘actor-system‘ and the ‘actor‘ itself are composed of an ‘actor-context‘.

Package

cl-gserver.actor-context

Source

actor-context-api.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: id

The id of this actor-context. Usually a string.

Initargs

:id

Readers

id (generic function)

Slot: actors

A list of actors.
This is internal API. Use ‘all-actors‘ or ‘find-actors‘ instead.

Initform

(cl-hamt:empty-dict)

Readers

actors (generic function)

Slot: system

A reference to the ‘actor-system‘.

Readers

system (generic function)

Class: actor-system ()

An ‘actor-system‘ is the opening facility. The first thing you do is to create an ‘actor-system‘ using the main constructor ‘make-actor-system‘. With the ‘actor-system‘ you can create actors via the ‘ac:actor-context‘ protocol function: ‘ac:actor-of‘.

Or even simpler via ‘act:actor-of‘ which is a convenience macro:

“‘elisp
(act:actor-of (*system*)
(lambda (self msg state)
;; do stuff
(cons "done" state)))
“‘

Package

cl-gserver.actor-system

Source

actor-system.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: dispatchers

Internal API: contains a list of available message dispatchers.

Initform

(quote nil)

Readers

dispatchers (generic function)

Slot: internal-actor-context

Internal API: an actor context reserved for agents/actors used by the system.

Readers

internal-actor-context (generic function)

Slot: user-actor-context

Internal API: an actor context for agents/actors created by the user.

Readers

user-actor-context (generic function)

Class: agent ()

Specialized ‘actor‘ class called ‘agent‘.
It is meant primarily to encapsulate state.
To access state it provides ‘agent-get‘ and ‘agent-update‘ to update state. Stop an agent with ‘agent-stop‘ to free resources (threads).

Package

cl-gserver.agent

Source

agent.lisp (file)

Direct superclasses

actor (class)

Class: delayed-cancellable-message ()
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: inner-msg
Initargs

:inner-msg

Readers

inner-msg (generic function)

Slot: cancelled-p
Type

boolean

Initargs

:cancelled-p

Readers

cancelled-p (generic function)

Writers

(setf cancelled-p) (generic function)

Slot: cancel-timer
Readers

cancel-timer (generic function)

Writers

(setf cancel-timer) (generic function)

Slot: cancel-delay

Delay after which the message gets cancelled and will not be processed.
If it has not been processed yet.
When ‘nil‘ no timer is created and this is treated as an ordinary wrapped message.

Initargs

:cancel-delay

Readers

cancel-delay (generic function)

Class: dispatch-worker ()

Specialized ‘actor‘ used as ‘worker‘ is the message ‘dispatcher‘.

Package

cl-gserver.dispatcher

Source

dispatcher.lisp (file)

Direct superclasses

actor (class)

Class: dispatcher-base ()

A ‘dispatcher‘ contains a pool of ‘actors‘ that operate as workers where work is dispatched to.

Package

cl-gserver.dispatcher

Source

dispatcher.lisp (file)

Direct superclasses

standard-object (class)

Direct subclasses

shared-dispatcher (class)

Class: future ()

The wrapped [blackbird](https://orthecreedence.github.io/blackbird/) ‘promise‘, here called ‘future‘. Not all features of blackbird’s ‘promise‘ are supported.
This ‘future‘ wrapper changes the terminology. A ‘future‘ is a delayed computation.
A ‘promise‘ is the fulfillment of the delayed computation.

The ‘future‘ is used as part of ‘act:ask‘ but is available as a general utility.

Package

cl-gserver.future

Source

fcomputation.lisp (file)

Direct superclasses

standard-object (class)

Direct methods

print-object (method)

Direct slots
Slot: promise
Class: message-box/bt ()

Bordeaux-Threads based message-box with a single thread operating on a message queue.
This is used when the actor is created using a ‘:pinned‘ dispatcher type.
There is a limit on the maximum number of actors/agents that can be created with
this kind of queue because each message-box (and with that each actor) requires exactly one thread.

Package

cl-gserver.messageb

Source

message-box.lisp (file)

Direct superclasses

message-box-base (class)

Direct methods
  • stop (method)
  • submit (method)
  • initialize-instance (method)
Direct slots
Slot: queue-thread

The thread that pops queue items.

Slot: should-run

Flag that indicates whether the message processing should commence.

Initform

t

Class: message-box/dp ()

This message box is a message-box that uses the ‘system‘s ‘dispatcher‘.
This has the advantage that an almost unlimited actors/agents can be created.
This message-box doesn’t ’own’ a thread. It uses the ‘dispatcher‘ to handle the message processing. The ‘dispatcher‘ is kind of like a thread pool.

Package

cl-gserver.messageb

Source

message-box.lisp (file)

Direct superclasses

message-box-base (class)

Direct methods
Direct slots
Slot: dispatcher

The dispatcher from the system.

Initargs

:dispatcher

Initform

(error "must be set!")

Readers

dispatcher (generic function)

Slot: lock
Initform

(bordeaux-threads:make-lock)

Class: queue-bounded ()

Bounded queue.

Package

cl-gserver.queue

Source

queue.lisp (file)

Direct superclasses

queue-base (class)

Direct methods
Direct slots
Slot: queue
Slot: lock
Initform

(bordeaux-threads:make-lock)

Slot: cvar
Initform

(bordeaux-threads:make-condition-variable)

Slot: max-items
Initargs

:max-items

Initform

1000

Slot: yield-threshold
Class: queue-unbounded ()

Unbounded queue based on lparallels cons-queue.

Package

cl-gserver.queue

Source

queue.lisp (file)

Direct superclasses

queue-base (class)

Direct methods
Direct slots
Slot: queue
Initform

(lparallel.cons-queue:make-cons-queue)

Class: router ()

A router combines a pool of actors and implements the actor-api protocol.
So a ‘tell‘, ‘ask-s‘ and ‘ask‘ is delegated to one of the routers routees.
While a router implements parts of the actor protocol it doesn’t implement all.
I.e. a router cannot be ‘watch‘ed.
A router ‘strategy‘ defines how one of the actors is determined as the forwarding target of the message.

Package

cl-gserver.router

Source

router.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: routees

The routees.

Initform

(make-array 2 :adjustable t :fill-pointer 0)

Slot: strategy-fun

The router strategy function.
The ‘strategy‘ is a function with a ‘fixnum‘ as input and a ‘fixnum‘ as output. The input represents the number of routees.
The output represents the index of the routee to choose by calling the function.

Initargs

:strategy-fun

Initform

(cl-gserver.router::get-strategy-fun :random)

Readers

strategy-fun (generic function)

Class: shared-dispatcher ()

A shared dispatcher.
Internally it uses a ‘router:router‘ to drive the ‘dispatch-worker‘s. The default strategy of choosing a worker is ‘:random‘.

A ‘shared-dispatcher‘ is automatically setup by an ‘asys:actor-system‘.

Package

cl-gserver.dispatcher

Source

dispatcher.lisp (file)

Direct superclasses

dispatcher-base (class)

Direct methods
Direct slots
Slot: router
Initform

(cl-gserver.router:make-router :strategy :random)


Previous: , Up: Definitions   [Contents][Index]

6.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.1 Special variables

Special Variable: *built-in-strategies*
Package

cl-gserver.router

Source

router.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.2 Macros

Macro: with-sender SENDER &rest BODY
Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Macro: with-waiting-actor ACTOR MESSAGE SYSTEM TIME-OUT &rest BODY
Package

cl-gserver.actor

Source

actor.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.3 Functions

Function: %actor-of SYSTEM CREATE-FUN DISPATCH-TYPE &key CONTEXT-KEY QUEUE-SIZE

Private API to create system actors. Context-key is either ‘:internal‘ or ‘:user‘ Users should use ‘actor-of‘.

Package

cl-gserver.actor-system

Source

actor-system.lisp (file)

Function: %all-actors SYSTEM CONTEXT-KEY
Package

cl-gserver.actor-system

Source

actor-system.lisp (file)

Function: %find-actor-by-name SYSTEM NAME &key CONTEXT-KEY

Private API to find an actor by name in the specified context.

Package

cl-gserver.actor-system

Source

actor-system.lisp (file)

Function: %find-actors SYSTEM TEST-FUN &key CONTEXT-KEY

Private API to find actors in both contexts the actor-system supports. Users should use ‘find-actors‘.

Package

cl-gserver.actor-system

Source

actor-system.lisp (file)

Function: actor-cell-state-p OBJECT
Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Function: actor-cell-state-running INSTANCE
Function: (setf actor-cell-state-running) VALUE INSTANCE
Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Function: actor-context-for-key CONTEXT-KEY SYSTEM
Package

cl-gserver.actor-system

Source

actor-system.lisp (file)

Function: add-actor CONTEXT ACTOR
Package

cl-gserver.actor-context

Source

actor-context.lisp (file)

Function: backpressure-if-necessary-on QUEUE YIELD-THRESHOLD
Package

cl-gserver.queue

Source

queue.lisp (file)

Function: copy-actor-cell-state INSTANCE
Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Function: copy-message-item/bt INSTANCE
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: copy-message-item/dp INSTANCE
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: create-actor CONTEXT CREATE-FUN DISPATCH-TYPE QUEUE-SIZE
Package

cl-gserver.actor-context

Source

actor-context.lisp (file)

Function: dequeue/no-wait QUEUE
Package

cl-gserver.queue

Source

queue.lisp (file)

Function: dequeue/wait QUEUE CVAR LOCK
Package

cl-gserver.queue

Source

queue.lisp (file)

Function: dispatch/noreply MSGBOX DISPATCHER DISPATCHER-FUN

Used by ‘ask’.

Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: dispatch/reply MSGBOX PUSH-ITEM DISPATCHER DISPATCHER-FUN TIME-OUT

Used by ‘ask-s’

Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: dispatch/reply/no-timeout MSGBOX DISPATCHER DISPATCHER-FUN
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: dispatch/reply/timeout MSGBOX TIME-OUT PUSH-ITEM DISPATCHER DISPATCHER-FUN
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: dispatcher-exec-fun MSGBOX

This function is effectively executed on a dispatcher actor.
It knows the message-box of the origin actor and acts on it.
It pops the ,essage from the message-boxes queue and calls the ‘handler-fun‘ on it. The ‘handler-fun’ is part of the message item.

Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: get-queue-count QUEUE
Package

cl-gserver.queue

Source

queue.lisp (file)

Function: get-shared-dispatcher SYSTEM
Package

cl-gserver.actor-context

Source

actor-context.lisp (file)

Function: get-strategy-fun STRATEGY
Package

cl-gserver.router

Source

router.lisp (file)

Function: get-strategy-index ROUTER
Package

cl-gserver.router

Source

router.lisp (file)

Function: handle-message-internal ACTOR-CELL MSG

A ‘:stop‘ message will response with ‘:stopping‘ and the user handlers are not called. Otherwise the result is ‘:resume‘ to resume user message handling.

Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Function: handle-popped-item POPPED-ITEM MSGBOX

Handles the popped message. Means: calls the ‘handler-fun‘ on the message.

Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: make-actor-cell-state &key (RUNNING RUNNING)
Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Function: make-message-item/bt &key (MESSAGE MESSAGE) (WITHREPLY-P WITHREPLY-P) (WITHREPLY-LOCK WITHREPLY-LOCK) (WITHREPLY-CVAR WITHREPLY-CVAR) (TIME-OUT TIME-OUT) (CANCELLED-P CANCELLED-P) (HANDLER-FUN HANDLER-FUN)
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: make-message-item/dp &key (MESSAGE MESSAGE) (CANCELLED-P CANCELLED-P) (HANDLER-FUN HANDLER-FUN)
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: make-random-strategy ()

The default, built-in strategy: random.

Package

cl-gserver.router

Source

router.lisp (file)

Function: make-round-robin-strategy ()

Returns a let-over-lambda that implements a round-robin strategy.

Package

cl-gserver.router

Source

router.lisp (file)

Function: message-box-for-dispatch-type CONTEXT DISPATCH-TYPE QUEUE-SIZE
Package

cl-gserver.actor-context

Source

actor-context.lisp (file)

Function: message-item/bt-cancelled-p INSTANCE
Function: (setf message-item/bt-cancelled-p) VALUE INSTANCE
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: message-item/bt-handler-fun INSTANCE
Function: (setf message-item/bt-handler-fun) VALUE INSTANCE
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: message-item/bt-message INSTANCE
Function: (setf message-item/bt-message) VALUE INSTANCE
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: message-item/bt-p OBJECT
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: message-item/bt-time-out INSTANCE
Function: (setf message-item/bt-time-out) VALUE INSTANCE
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: message-item/bt-withreply-cvar INSTANCE
Function: (setf message-item/bt-withreply-cvar) VALUE INSTANCE
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: message-item/bt-withreply-lock INSTANCE
Function: (setf message-item/bt-withreply-lock) VALUE INSTANCE
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: message-item/bt-withreply-p INSTANCE
Function: (setf message-item/bt-withreply-p) VALUE INSTANCE
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: message-item/dp-cancelled-p INSTANCE
Function: (setf message-item/dp-cancelled-p) VALUE INSTANCE
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: message-item/dp-handler-fun INSTANCE
Function: (setf message-item/dp-handler-fun) VALUE INSTANCE
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: message-item/dp-message INSTANCE
Function: (setf message-item/dp-message) VALUE INSTANCE
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: message-item/dp-p OBJECT
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: message-processing-loop MSGBOX

The message processing loop.

Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: notify-watchers-about-stop ACTOR
Package

cl-gserver.actor

Source

actor.lisp (file)

Function: pop-queue-and-process MSGBOX

This blocks until a new queue item arrived.

Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: process-handler-result HANDLE-RESULT ACTOR-CELL
Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Function: process-not-handled ACTOR-CELL
Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Function: process-queue-item MSGBOX ITEM

The ‘time-out’ handling in here is to make sure that handling of the message is ’interrupted’.
This should happen in conjunction with the outer time-out in ‘submit/reply’.

Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: process-response ACTOR-CELL HANDLE-RESULT SENDER

This function is called on the queue thread, so it’s thread safe!

Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Function: receive SELF MESSAGE CURRENT-STATE

The worker receive function.

Package

cl-gserver.dispatcher

Source

dispatcher.lisp (file)

Function: receive SELF MESSAGE CURRENT-STATE

This is the agents actor receive function implementation.
This rarely (if at all) needs to change because the agent is very specific.

Package

cl-gserver.agent

Source

agent.lisp (file)

Function: remove-actor CONTEXT ACTOR
Package

cl-gserver.actor-context

Source

actor-context.lisp (file)

Function: reply-value CONS-RESULT
Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Function: stop-children ACTOR
Package

cl-gserver.actor

Source

actor.lisp (file)

Function: submit-message ACTOR-CELL MESSAGE WITHREPLY-P SENDER TIME-OUT

Submitting a message.
In case of ‘withreply-p‘, the ‘response‘ is filled because submitting to the message-box is synchronous. Otherwise submitting is asynchronous and ‘response‘ is just ‘t‘.
In case the actor-cell was stopped it will respond with just ‘:stopped‘.
In case no messge-box is configured this function respnds with ‘:no-message-handling‘.

Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Function: submit/no-reply MSGBOX QUEUE MESSAGE HANDLER-FUN

This is quite efficient, no locking necessary.

Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: submit/reply MSGBOX QUEUE MESSAGE TIME-OUT HANDLER-FUN

This requires some more action. This function has to provide a result and so it’s has to wait until The queue thread has processed the message.

Package

cl-gserver.messageb

Source

message-box.lisp (file)

Function: update-state ACTOR-CELL CONS-RESULT
Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Function: verify-actor CONTEXT ACTOR

Checks certain things on the actor before it is attached to the context.

Package

cl-gserver.actor-context

Source

actor-context.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.4 Generic functions

Generic Function: actors OBJECT
Package

cl-gserver.actor-context

Methods
Method: actors (ACTOR-CONTEXT actor-context)

A list of actors.
This is internal API. Use ‘all-actors‘ or ‘find-actors‘ instead.

Source

actor-context-api.lisp (file)

Generic Function: cancel-delay OBJECT
Package

cl-gserver.messageb

Methods
Method: cancel-delay (DELAYED-CANCELLABLE-MESSAGE delayed-cancellable-message)

Delay after which the message gets cancelled and will not be processed.
If it has not been processed yet.
When ‘nil‘ no timer is created and this is treated as an ordinary wrapped message.

Source

message-box.lisp (file)

Generic Function: cancel-timer OBJECT
Generic Function: (setf cancel-timer) NEW-VALUE OBJECT
Package

cl-gserver.messageb

Methods
Method: cancel-timer (DELAYED-CANCELLABLE-MESSAGE delayed-cancellable-message)

automatically generated reader method

Source

message-box.lisp (file)

Method: (setf cancel-timer) NEW-VALUE (DELAYED-CANCELLABLE-MESSAGE delayed-cancellable-message)

automatically generated writer method

Source

message-box.lisp (file)

Generic Function: dispatcher OBJECT
Package

cl-gserver.messageb

Methods
Method: dispatcher (MESSAGE-BOX/DP message-box/dp)

The dispatcher from the system.

Source

message-box.lisp (file)

Generic Function: handle-message ACTOR-CELL MESSAGE WITHREPLY-P

The message handler which is usually called after the message was popped from a queue.

Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Methods
Method: handle-message ACTOR-CELL MESSAGE WITHREPLY-P

This function is submitted as ‘handler-fun‘ to message-box.

Method: handle-message ACTOR-CELL (MESSAGE delayed-cancellable-message) WITHREPLY-P

We check here if the message is of type ‘delayed-cancellable-message‘, and if it got cancelled, in which case we respond just with ‘:cancelled‘.

Generic Function: handle-message-user ACTOR-CELL MESSAGE WITHREPLY-P

The user defined message handler.
Effectively this calls the ‘handle-call‘ or ‘handle-cast‘ functions.

Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Methods
Method: handle-message-user ACTOR-CELL MESSAGE (WITHREPLY-P (eql nil))
Method: handle-message-user ACTOR-CELL MESSAGE (WITHREPLY-P (eql t))
Method: handle-message-user ACTOR-CELL MESSAGE WITHREPLY-P before
Generic Function: internal-actor-context OBJECT
Package

cl-gserver.actor-system

Methods
Method: internal-actor-context (ACTOR-SYSTEM actor-system)

Internal API: an actor context reserved for agents/actors used by the system.

Source

actor-system.lisp (file)

Generic Function: max-queue-size OBJECT
Package

cl-gserver.messageb

Methods
Method: max-queue-size (MESSAGE-BOX-BASE message-box-base)

0 or nil will make an unbounded queue.
A value ‘> 0‘ will make a bounded queue.
Don’t make it too small. A queue size of 1000 might be a good choice.

Source

message-box.lisp (file)

Generic Function: name CONDITION
Package

cl-gserver.actor-context

Methods
Method: name (CONDITION actor-name-exists)
Source

actor-context-api.lisp (file)

Generic Function: name OBJECT
Package

cl-gserver.messageb

Methods
Method: name (MESSAGE-BOX-BASE message-box-base)

The name of the message-box.
The default name is concatenated of "mesgb-" and a ‘gensym‘ generated random number.

Source

message-box.lisp (file)

Generic Function: receive OBJECT
Package

cl-gserver.actor

Methods
Method: receive (ACTOR actor)

‘receive‘ is a function that has to take 3 parameters:
- ‘self‘: the actor instance
- ‘msg‘: the received message
- ‘state‘: the current state of the actor
The ‘sender‘ of the message, if available, is accessible with ‘*sender*‘ from within the receive function or a behavior.

Source

actor.lisp (file)

Generic Function: user-actor-context OBJECT
Package

cl-gserver.actor-system

Methods
Method: user-actor-context (ACTOR-SYSTEM actor-system)

Internal API: an actor context for agents/actors created by the user.

Source

actor-system.lisp (file)

Generic Function: wait-time CONDITION
Package

cl-gserver.utils

Methods
Method: wait-time (CONDITION ask-timeout)
Source

utils.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.5 Structures

Structure: actor-cell-state ()
Package

cl-gserver.actor-cell

Source

actor-cell.lisp (file)

Direct superclasses

structure-object (structure)

Direct slots
Slot: running
Type

boolean

Initform

t

Readers

actor-cell-state-running (function)

Writers

(setf actor-cell-state-running) (function)

Structure: message-item/bt ()
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Direct superclasses

structure-object (structure)

Direct slots
Slot: message
Readers

message-item/bt-message (function)

Writers

(setf message-item/bt-message) (function)

Slot: withreply-p
Type

boolean

Readers

message-item/bt-withreply-p (function)

Writers

(setf message-item/bt-withreply-p) (function)

Slot: withreply-lock
Readers

message-item/bt-withreply-lock (function)

Writers

(setf message-item/bt-withreply-lock) (function)

Slot: withreply-cvar
Readers

message-item/bt-withreply-cvar (function)

Writers

(setf message-item/bt-withreply-cvar) (function)

Slot: time-out
Readers

message-item/bt-time-out (function)

Writers

(setf message-item/bt-time-out) (function)

Slot: cancelled-p
Type

boolean

Readers

message-item/bt-cancelled-p (function)

Writers

(setf message-item/bt-cancelled-p) (function)

Slot: handler-fun
Type

function

Readers

message-item/bt-handler-fun (function)

Writers

(setf message-item/bt-handler-fun) (function)

Structure: message-item/dp ()
Package

cl-gserver.messageb

Source

message-box.lisp (file)

Direct superclasses

structure-object (structure)

Direct slots
Slot: message
Readers

message-item/dp-message (function)

Writers

(setf message-item/dp-message) (function)

Slot: cancelled-p
Type

boolean

Readers

message-item/dp-cancelled-p (function)

Writers

(setf message-item/dp-cancelled-p) (function)

Slot: handler-fun
Type

function

Readers

message-item/dp-handler-fun (function)

Writers

(setf message-item/dp-handler-fun) (function)


Previous: , Up: Internal definitions   [Contents][Index]

6.2.6 Classes

Class: async-waitor-actor ()
Package

cl-gserver.actor

Source

actor.lisp (file)

Direct superclasses

actor (class)

Class: message-box-base ()

The user does not need to create a message-box manually. It is automatically created and added to the ‘actor‘ when the actor is created through ‘act:actor-of‘ or ‘ac:actor-of‘.

Package

cl-gserver.messageb

Source

message-box.lisp (file)

Direct superclasses

standard-object (class)

Direct subclasses
Direct methods
Direct slots
Slot: name

The name of the message-box.
The default name is concatenated of "mesgb-" and a ‘gensym‘ generated random number.

Initargs

:name

Initform

(string (gensym "mesgb-"))

Readers

name (generic function)

Slot: processed-messages
Initform

0

Slot: queue

Which type of queue will be used depends on the ‘max-queue-size‘ setting.

Slot: max-queue-size

0 or nil will make an unbounded queue.
A value ‘> 0‘ will make a bounded queue.
Don’t make it too small. A queue size of 1000 might be a good choice.

Initargs

:max-queue-size

Initform

0

Readers

max-queue-size (generic function)

Class: queue-base ()

The base queue.

Package

cl-gserver.queue

Source

queue.lisp (file)

Direct superclasses

standard-object (class)

Direct subclasses
Direct slots
Slot: queue

Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   C   F   L   M  
Index Entry  Section

C
cl-gserver.asd: The cl-gserver․asd file
cl-gserver/src: The cl-gserver/src module
cl-gserver/src/actor-api.lisp: The cl-gserver/src/actor-api․lisp file
cl-gserver/src/actor-context-api.lisp: The cl-gserver/src/actor-context-api․lisp file
cl-gserver/src/actor-context.lisp: The cl-gserver/src/actor-context․lisp file
cl-gserver/src/actor-system-api.lisp: The cl-gserver/src/actor-system-api․lisp file
cl-gserver/src/actor-system.lisp: The cl-gserver/src/actor-system․lisp file
cl-gserver/src/actor.lisp: The cl-gserver/src/actor․lisp file
cl-gserver/src/agent.lisp: The cl-gserver/src/agent․lisp file
cl-gserver/src/core: The cl-gserver/src/core module
cl-gserver/src/core/actor-cell.lisp: The cl-gserver/src/core/actor-cell․lisp file
cl-gserver/src/core/message-box.lisp: The cl-gserver/src/core/message-box․lisp file
cl-gserver/src/core/queue.lisp: The cl-gserver/src/core/queue․lisp file
cl-gserver/src/dispatcher-api.lisp: The cl-gserver/src/dispatcher-api․lisp file
cl-gserver/src/dispatcher.lisp: The cl-gserver/src/dispatcher․lisp file
cl-gserver/src/fcomputation.lisp: The cl-gserver/src/fcomputation․lisp file
cl-gserver/src/router.lisp: The cl-gserver/src/router․lisp file
cl-gserver/src/utils.lisp: The cl-gserver/src/utils․lisp file

F
File, Lisp, cl-gserver.asd: The cl-gserver․asd file
File, Lisp, cl-gserver/src/actor-api.lisp: The cl-gserver/src/actor-api․lisp file
File, Lisp, cl-gserver/src/actor-context-api.lisp: The cl-gserver/src/actor-context-api․lisp file
File, Lisp, cl-gserver/src/actor-context.lisp: The cl-gserver/src/actor-context․lisp file
File, Lisp, cl-gserver/src/actor-system-api.lisp: The cl-gserver/src/actor-system-api․lisp file
File, Lisp, cl-gserver/src/actor-system.lisp: The cl-gserver/src/actor-system․lisp file
File, Lisp, cl-gserver/src/actor.lisp: The cl-gserver/src/actor․lisp file
File, Lisp, cl-gserver/src/agent.lisp: The cl-gserver/src/agent․lisp file
File, Lisp, cl-gserver/src/core/actor-cell.lisp: The cl-gserver/src/core/actor-cell․lisp file
File, Lisp, cl-gserver/src/core/message-box.lisp: The cl-gserver/src/core/message-box․lisp file
File, Lisp, cl-gserver/src/core/queue.lisp: The cl-gserver/src/core/queue․lisp file
File, Lisp, cl-gserver/src/dispatcher-api.lisp: The cl-gserver/src/dispatcher-api․lisp file
File, Lisp, cl-gserver/src/dispatcher.lisp: The cl-gserver/src/dispatcher․lisp file
File, Lisp, cl-gserver/src/fcomputation.lisp: The cl-gserver/src/fcomputation․lisp file
File, Lisp, cl-gserver/src/router.lisp: The cl-gserver/src/router․lisp file
File, Lisp, cl-gserver/src/utils.lisp: The cl-gserver/src/utils․lisp file

L
Lisp File, cl-gserver.asd: The cl-gserver․asd file
Lisp File, cl-gserver/src/actor-api.lisp: The cl-gserver/src/actor-api․lisp file
Lisp File, cl-gserver/src/actor-context-api.lisp: The cl-gserver/src/actor-context-api․lisp file
Lisp File, cl-gserver/src/actor-context.lisp: The cl-gserver/src/actor-context․lisp file
Lisp File, cl-gserver/src/actor-system-api.lisp: The cl-gserver/src/actor-system-api․lisp file
Lisp File, cl-gserver/src/actor-system.lisp: The cl-gserver/src/actor-system․lisp file
Lisp File, cl-gserver/src/actor.lisp: The cl-gserver/src/actor․lisp file
Lisp File, cl-gserver/src/agent.lisp: The cl-gserver/src/agent․lisp file
Lisp File, cl-gserver/src/core/actor-cell.lisp: The cl-gserver/src/core/actor-cell․lisp file
Lisp File, cl-gserver/src/core/message-box.lisp: The cl-gserver/src/core/message-box․lisp file
Lisp File, cl-gserver/src/core/queue.lisp: The cl-gserver/src/core/queue․lisp file
Lisp File, cl-gserver/src/dispatcher-api.lisp: The cl-gserver/src/dispatcher-api․lisp file
Lisp File, cl-gserver/src/dispatcher.lisp: The cl-gserver/src/dispatcher․lisp file
Lisp File, cl-gserver/src/fcomputation.lisp: The cl-gserver/src/fcomputation․lisp file
Lisp File, cl-gserver/src/router.lisp: The cl-gserver/src/router․lisp file
Lisp File, cl-gserver/src/utils.lisp: The cl-gserver/src/utils․lisp file

M
Module, cl-gserver/src: The cl-gserver/src module
Module, cl-gserver/src/core: The cl-gserver/src/core module

Jump to:   C   F   L   M  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   %   (  
A   B   C   D   E   F   G   H   I   M   N   O   P   R   S   T   U   V   W  
Index Entry  Section

%
%actor-of: Internal functions
%all-actors: Internal functions
%find-actor-by-name: Internal functions
%find-actors: Internal functions

(
(setf actor-cell-state-running): Internal functions
(setf cancel-timer): Internal generic functions
(setf cancel-timer): Internal generic functions
(setf cancelled-p): Exported generic functions
(setf cancelled-p): Exported generic functions
(setf context): Exported generic functions
(setf context): Exported generic functions
(setf message-item/bt-cancelled-p): Internal functions
(setf message-item/bt-handler-fun): Internal functions
(setf message-item/bt-message): Internal functions
(setf message-item/bt-time-out): Internal functions
(setf message-item/bt-withreply-cvar): Internal functions
(setf message-item/bt-withreply-lock): Internal functions
(setf message-item/bt-withreply-p): Internal functions
(setf message-item/dp-cancelled-p): Internal functions
(setf message-item/dp-handler-fun): Internal functions
(setf message-item/dp-message): Internal functions
(setf msgbox): Exported generic functions
(setf msgbox): Exported generic functions

A
actor-cell-state-p: Internal functions
actor-cell-state-running: Internal functions
actor-context-for-key: Internal functions
actor-of: Exported macros
actor-of: Exported generic functions
actor-of: Exported generic functions
actor-of: Exported generic functions
actors: Internal generic functions
actors: Internal generic functions
add-actor: Internal functions
add-routee: Exported functions
after-stop: Exported generic functions
after-stop: Exported generic functions
agent-get: Exported functions
agent-stop: Exported functions
agent-update: Exported functions
all-actors: Exported generic functions
all-actors: Exported generic functions
all-actors: Exported generic functions
ask: Exported generic functions
ask: Exported generic functions
ask: Exported generic functions
ask-s: Exported generic functions
ask-s: Exported generic functions
ask-s: Exported generic functions
assert-cond: Exported functions

B
backpressure-if-necessary-on: Internal functions
become: Exported generic functions
become: Exported generic functions

C
call: Exported functions
cancel-delay: Internal generic functions
cancel-delay: Internal generic functions
cancel-timer: Internal generic functions
cancel-timer: Internal generic functions
cancelled-p: Exported generic functions
cancelled-p: Exported generic functions
cast: Exported functions
cause: Exported generic functions
cause: Exported generic functions
collect-backtrace: Exported functions
complete-p: Exported functions
context: Exported generic functions
context: Exported generic functions
copy-actor-cell-state: Internal functions
copy-message-item/bt: Internal functions
copy-message-item/dp: Internal functions
create-actor: Internal functions

D
dequeue/no-wait: Internal functions
dequeue/wait: Internal functions
dispatch: Exported generic functions
dispatch: Exported generic functions
dispatch-async: Exported generic functions
dispatch-async: Exported generic functions
dispatch/noreply: Internal functions
dispatch/reply: Internal functions
dispatch/reply/no-timeout: Internal functions
dispatch/reply/timeout: Internal functions
dispatcher: Internal generic functions
dispatcher: Internal generic functions
dispatcher-exec-fun: Internal functions
dispatchers: Exported generic functions
dispatchers: Exported generic functions

E
emptyq-p: Exported generic functions
emptyq-p: Exported generic functions
emptyq-p: Exported generic functions

F
filter: Exported macros
find-actor-by-name: Exported generic functions
find-actor-by-name: Exported generic functions
find-actor-by-name: Exported generic functions
find-actors: Exported generic functions
find-actors: Exported generic functions
find-actors: Exported generic functions
Function, %actor-of: Internal functions
Function, %all-actors: Internal functions
Function, %find-actor-by-name: Internal functions
Function, %find-actors: Internal functions
Function, (setf actor-cell-state-running): Internal functions
Function, (setf message-item/bt-cancelled-p): Internal functions
Function, (setf message-item/bt-handler-fun): Internal functions
Function, (setf message-item/bt-message): Internal functions
Function, (setf message-item/bt-time-out): Internal functions
Function, (setf message-item/bt-withreply-cvar): Internal functions
Function, (setf message-item/bt-withreply-lock): Internal functions
Function, (setf message-item/bt-withreply-p): Internal functions
Function, (setf message-item/dp-cancelled-p): Internal functions
Function, (setf message-item/dp-handler-fun): Internal functions
Function, (setf message-item/dp-message): Internal functions
Function, actor-cell-state-p: Internal functions
Function, actor-cell-state-running: Internal functions
Function, actor-context-for-key: Internal functions
Function, add-actor: Internal functions
Function, add-routee: Exported functions
Function, agent-get: Exported functions
Function, agent-stop: Exported functions
Function, agent-update: Exported functions
Function, assert-cond: Exported functions
Function, backpressure-if-necessary-on: Internal functions
Function, call: Exported functions
Function, cast: Exported functions
Function, collect-backtrace: Exported functions
Function, complete-p: Exported functions
Function, copy-actor-cell-state: Internal functions
Function, copy-message-item/bt: Internal functions
Function, copy-message-item/dp: Internal functions
Function, create-actor: Internal functions
Function, dequeue/no-wait: Internal functions
Function, dequeue/wait: Internal functions
Function, dispatch/noreply: Internal functions
Function, dispatch/reply: Internal functions
Function, dispatch/reply/no-timeout: Internal functions
Function, dispatch/reply/timeout: Internal functions
Function, dispatcher-exec-fun: Internal functions
Function, get-queue-count: Internal functions
Function, get-result: Exported functions
Function, get-shared-dispatcher: Internal functions
Function, get-strategy-fun: Internal functions
Function, get-strategy-index: Internal functions
Function, handle-message-internal: Internal functions
Function, handle-popped-item: Internal functions
Function, make-actor-cell-state: Internal functions
Function, make-actor-context: Exported functions
Function, make-actor-system: Exported functions
Function, make-agent: Exported functions
Function, make-delayed-cancellable-message: Exported functions
Function, make-dispatcher: Exported functions
Function, make-dispatcher-worker: Exported functions
Function, make-future: Exported functions
Function, make-message-item/bt: Internal functions
Function, make-message-item/dp: Internal functions
Function, make-random-strategy: Internal functions
Function, make-round-robin-strategy: Internal functions
Function, make-router: Exported functions
Function, make-timer: Exported functions
Function, message-box-for-dispatch-type: Internal functions
Function, message-item/bt-cancelled-p: Internal functions
Function, message-item/bt-handler-fun: Internal functions
Function, message-item/bt-message: Internal functions
Function, message-item/bt-p: Internal functions
Function, message-item/bt-time-out: Internal functions
Function, message-item/bt-withreply-cvar: Internal functions
Function, message-item/bt-withreply-lock: Internal functions
Function, message-item/bt-withreply-p: Internal functions
Function, message-item/dp-cancelled-p: Internal functions
Function, message-item/dp-handler-fun: Internal functions
Function, message-item/dp-message: Internal functions
Function, message-item/dp-p: Internal functions
Function, message-processing-loop: Internal functions
Function, mkstr: Exported functions
Function, notify-watchers-about-stop: Internal functions
Function, on-completed: Exported functions
Function, pop-queue-and-process: Internal functions
Function, process-handler-result: Internal functions
Function, process-not-handled: Internal functions
Function, process-queue-item: Internal functions
Function, process-response: Internal functions
Function, receive: Internal functions
Function, receive: Internal functions
Function, remove-actor: Internal functions
Function, reply-value: Internal functions
Function, routees: Exported functions
Function, running-p: Exported functions
Function, stop: Exported functions
Function, stop-children: Internal functions
Function, submit-message: Internal functions
Function, submit/no-reply: Internal functions
Function, submit/reply: Internal functions
Function, update-state: Internal functions
Function, verify-actor: Internal functions
Function, wait-cond: Exported functions

G
Generic Function, (setf cancel-timer): Internal generic functions
Generic Function, (setf cancelled-p): Exported generic functions
Generic Function, (setf context): Exported generic functions
Generic Function, (setf msgbox): Exported generic functions
Generic Function, actor-of: Exported generic functions
Generic Function, actors: Internal generic functions
Generic Function, after-stop: Exported generic functions
Generic Function, all-actors: Exported generic functions
Generic Function, ask: Exported generic functions
Generic Function, ask-s: Exported generic functions
Generic Function, become: Exported generic functions
Generic Function, cancel-delay: Internal generic functions
Generic Function, cancel-timer: Internal generic functions
Generic Function, cancelled-p: Exported generic functions
Generic Function, cause: Exported generic functions
Generic Function, context: Exported generic functions
Generic Function, dispatch: Exported generic functions
Generic Function, dispatch-async: Exported generic functions
Generic Function, dispatcher: Internal generic functions
Generic Function, dispatchers: Exported generic functions
Generic Function, emptyq-p: Exported generic functions
Generic Function, find-actor-by-name: Exported generic functions
Generic Function, find-actors: Exported generic functions
Generic Function, handle-call: Exported generic functions
Generic Function, handle-cast: Exported generic functions
Generic Function, handle-message: Internal generic functions
Generic Function, handle-message-user: Internal generic functions
Generic Function, id: Exported generic functions
Generic Function, inner-msg: Exported generic functions
Generic Function, internal-actor-context: Internal generic functions
Generic Function, make-actor: Exported generic functions
Generic Function, max-queue-size: Internal generic functions
Generic Function, msgbox: Exported generic functions
Generic Function, name: Exported generic functions
Generic Function, name: Internal generic functions
Generic Function, name: Internal generic functions
Generic Function, notify: Exported generic functions
Generic Function, path: Exported generic functions
Generic Function, popq: Exported generic functions
Generic Function, pre-start: Exported generic functions
Generic Function, pushq: Exported generic functions
Generic Function, receive: Internal generic functions
Generic Function, shutdown: Exported generic functions
Generic Function, shutdown: Exported generic functions
Generic Function, state: Exported generic functions
Generic Function, stop: Exported generic functions
Generic Function, stop: Exported generic functions
Generic Function, stop: Exported generic functions
Generic Function, strategy-fun: Exported generic functions
Generic Function, submit: Exported generic functions
Generic Function, system: Exported generic functions
Generic Function, tell: Exported generic functions
Generic Function, unbecome: Exported generic functions
Generic Function, unwatch: Exported generic functions
Generic Function, user-actor-context: Internal generic functions
Generic Function, wait-time: Internal generic functions
Generic Function, watch: Exported generic functions
Generic Function, watchers: Exported generic functions
Generic Function, workers: Exported generic functions
get-queue-count: Internal functions
get-result: Exported functions
get-shared-dispatcher: Internal functions
get-strategy-fun: Internal functions
get-strategy-index: Internal functions

H
handle-call: Exported generic functions
handle-call: Exported generic functions
handle-cast: Exported generic functions
handle-cast: Exported generic functions
handle-message: Internal generic functions
handle-message: Internal generic functions
handle-message: Internal generic functions
handle-message-internal: Internal functions
handle-message-user: Internal generic functions
handle-message-user: Internal generic functions
handle-message-user: Internal generic functions
handle-message-user: Internal generic functions
handle-popped-item: Internal functions

I
id: Exported generic functions
id: Exported generic functions
inner-msg: Exported generic functions
inner-msg: Exported generic functions
internal-actor-context: Internal generic functions
internal-actor-context: Internal generic functions

M
Macro, actor-of: Exported macros
Macro, filter: Exported macros
Macro, with-sender: Internal macros
Macro, with-submit-handler: Exported macros
Macro, with-waitfor: Exported macros
Macro, with-waiting-actor: Internal macros
make-actor: Exported generic functions
make-actor: Exported generic functions
make-actor-cell-state: Internal functions
make-actor-context: Exported functions
make-actor-system: Exported functions
make-agent: Exported functions
make-delayed-cancellable-message: Exported functions
make-dispatcher: Exported functions
make-dispatcher-worker: Exported functions
make-future: Exported functions
make-message-item/bt: Internal functions
make-message-item/dp: Internal functions
make-random-strategy: Internal functions
make-round-robin-strategy: Internal functions
make-router: Exported functions
make-timer: Exported functions
max-queue-size: Internal generic functions
max-queue-size: Internal generic functions
message-box-for-dispatch-type: Internal functions
message-item/bt-cancelled-p: Internal functions
message-item/bt-handler-fun: Internal functions
message-item/bt-message: Internal functions
message-item/bt-p: Internal functions
message-item/bt-time-out: Internal functions
message-item/bt-withreply-cvar: Internal functions
message-item/bt-withreply-lock: Internal functions
message-item/bt-withreply-p: Internal functions
message-item/dp-cancelled-p: Internal functions
message-item/dp-handler-fun: Internal functions
message-item/dp-message: Internal functions
message-item/dp-p: Internal functions
message-processing-loop: Internal functions
Method, (setf cancel-timer): Internal generic functions
Method, (setf cancelled-p): Exported generic functions
Method, (setf context): Exported generic functions
Method, (setf msgbox): Exported generic functions
Method, actor-of: Exported generic functions
Method, actor-of: Exported generic functions
Method, actors: Internal generic functions
Method, after-stop: Exported generic functions
Method, all-actors: Exported generic functions
Method, all-actors: Exported generic functions
Method, ask: Exported generic functions
Method, ask: Exported generic functions
Method, ask-s: Exported generic functions
Method, ask-s: Exported generic functions
Method, become: Exported generic functions
Method, cancel-delay: Internal generic functions
Method, cancel-timer: Internal generic functions
Method, cancelled-p: Exported generic functions
Method, cause: Exported generic functions
Method, context: Exported generic functions
Method, dispatch: Exported generic functions
Method, dispatch-async: Exported generic functions
Method, dispatcher: Internal generic functions
Method, dispatchers: Exported generic functions
Method, emptyq-p: Exported generic functions
Method, emptyq-p: Exported generic functions
Method, find-actor-by-name: Exported generic functions
Method, find-actor-by-name: Exported generic functions
Method, find-actors: Exported generic functions
Method, find-actors: Exported generic functions
Method, handle-call: Exported generic functions
Method, handle-cast: Exported generic functions
Method, handle-message: Internal generic functions
Method, handle-message: Internal generic functions
Method, handle-message-user: Internal generic functions
Method, handle-message-user: Internal generic functions
Method, handle-message-user: Internal generic functions
Method, id: Exported generic functions
Method, inner-msg: Exported generic functions
Method, internal-actor-context: Internal generic functions
Method, make-actor: Exported generic functions
Method, max-queue-size: Internal generic functions
Method, msgbox: Exported generic functions
Method, name: Exported generic functions
Method, name: Internal generic functions
Method, name: Internal generic functions
Method, notify: Exported generic functions
Method, path: Exported generic functions
Method, popq: Exported generic functions
Method, popq: Exported generic functions
Method, pre-start: Exported generic functions
Method, pushq: Exported generic functions
Method, pushq: Exported generic functions
Method, receive: Internal generic functions
Method, shutdown: Exported generic functions
Method, shutdown: Exported generic functions
Method, shutdown: Exported generic functions
Method, state: Exported generic functions
Method, stop: Exported generic functions
Method, stop: Exported generic functions
Method, stop: Exported generic functions
Method, stop: Exported generic functions
Method, stop: Exported generic functions
Method, stop: Exported generic functions
Method, stop: Exported generic functions
Method, strategy-fun: Exported generic functions
Method, submit: Exported generic functions
Method, submit: Exported generic functions
Method, system: Exported generic functions
Method, tell: Exported generic functions
Method, tell: Exported generic functions
Method, unbecome: Exported generic functions
Method, unwatch: Exported generic functions
Method, user-actor-context: Internal generic functions
Method, wait-time: Internal generic functions
Method, watch: Exported generic functions
Method, watchers: Exported generic functions
Method, workers: Exported generic functions
mkstr: Exported functions
msgbox: Exported generic functions
msgbox: Exported generic functions

N
name: Exported generic functions
name: Exported generic functions
name: Internal generic functions
name: Internal generic functions
name: Internal generic functions
name: Internal generic functions
notify: Exported generic functions
notify: Exported generic functions
notify-watchers-about-stop: Internal functions

O
on-completed: Exported functions

P
path: Exported generic functions
path: Exported generic functions
pop-queue-and-process: Internal functions
popq: Exported generic functions
popq: Exported generic functions
popq: Exported generic functions
pre-start: Exported generic functions
pre-start: Exported generic functions
process-handler-result: Internal functions
process-not-handled: Internal functions
process-queue-item: Internal functions
process-response: Internal functions
pushq: Exported generic functions
pushq: Exported generic functions
pushq: Exported generic functions

R
receive: Internal functions
receive: Internal functions
receive: Internal generic functions
receive: Internal generic functions
remove-actor: Internal functions
reply-value: Internal functions
routees: Exported functions
running-p: Exported functions

S
shutdown: Exported generic functions
shutdown: Exported generic functions
shutdown: Exported generic functions
shutdown: Exported generic functions
shutdown: Exported generic functions
state: Exported generic functions
state: Exported generic functions
stop: Exported functions
stop: Exported generic functions
stop: Exported generic functions
stop: Exported generic functions
stop: Exported generic functions
stop: Exported generic functions
stop: Exported generic functions
stop: Exported generic functions
stop: Exported generic functions
stop: Exported generic functions
stop: Exported generic functions
stop-children: Internal functions
strategy-fun: Exported generic functions
strategy-fun: Exported generic functions
submit: Exported generic functions
submit: Exported generic functions
submit: Exported generic functions
submit-message: Internal functions
submit/no-reply: Internal functions
submit/reply: Internal functions
system: Exported generic functions
system: Exported generic functions

T
tell: Exported generic functions
tell: Exported generic functions
tell: Exported generic functions

U
unbecome: Exported generic functions
unbecome: Exported generic functions
unwatch: Exported generic functions
unwatch: Exported generic functions
update-state: Internal functions
user-actor-context: Internal generic functions
user-actor-context: Internal generic functions

V
verify-actor: Internal functions

W
wait-cond: Exported functions
wait-time: Internal generic functions
wait-time: Internal generic functions
watch: Exported generic functions
watch: Exported generic functions
watchers: Exported generic functions
watchers: Exported generic functions
with-sender: Internal macros
with-submit-handler: Exported macros
with-waitfor: Exported macros
with-waiting-actor: Internal macros
workers: Exported generic functions
workers: Exported generic functions

Jump to:   %   (  
A   B   C   D   E   F   G   H   I   M   N   O   P   R   S   T   U   V   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
A   B   C   D   H   I   L   M   N   P   Q   R   S   T   U   W   Y  
Index Entry  Section

*
*built-in-strategies*: Internal special variables
*sender*: Exported special variables

A
actors: Exported classes

B
behavior: Exported classes

C
cancel-delay: Exported classes
cancel-timer: Exported classes
cancelled-p: Exported classes
cancelled-p: Internal structures
cancelled-p: Internal structures
cause: Exported conditions
context: Exported classes
cvar: Exported classes

D
dispatcher: Exported classes
dispatchers: Exported classes

H
handler-fun: Internal structures
handler-fun: Internal structures

I
id: Exported classes
inner-msg: Exported classes
internal-actor-context: Exported classes
internal-state: Exported classes

L
lock: Exported classes
lock: Exported classes

M
max-items: Exported classes
max-queue-size: Internal classes
message: Internal structures
message: Internal structures
msgbox: Exported classes

N
name: Exported conditions
name: Exported classes
name: Internal classes

P
processed-messages: Internal classes
promise: Exported classes

Q
queue: Exported classes
queue: Exported classes
queue: Internal classes
queue: Internal classes
queue-thread: Exported classes

R
receive: Exported classes
routees: Exported classes
router: Exported classes
running: Internal structures

S
should-run: Exported classes
Slot, actors: Exported classes
Slot, behavior: Exported classes
Slot, cancel-delay: Exported classes
Slot, cancel-timer: Exported classes
Slot, cancelled-p: Exported classes
Slot, cancelled-p: Internal structures
Slot, cancelled-p: Internal structures
Slot, cause: Exported conditions
Slot, context: Exported classes
Slot, cvar: Exported classes
Slot, dispatcher: Exported classes
Slot, dispatchers: Exported classes
Slot, handler-fun: Internal structures
Slot, handler-fun: Internal structures
Slot, id: Exported classes
Slot, inner-msg: Exported classes
Slot, internal-actor-context: Exported classes
Slot, internal-state: Exported classes
Slot, lock: Exported classes
Slot, lock: Exported classes
Slot, max-items: Exported classes
Slot, max-queue-size: Internal classes
Slot, message: Internal structures
Slot, message: Internal structures
Slot, msgbox: Exported classes
Slot, name: Exported conditions
Slot, name: Exported classes
Slot, name: Internal classes
Slot, processed-messages: Internal classes
Slot, promise: Exported classes
Slot, queue: Exported classes
Slot, queue: Exported classes
Slot, queue: Internal classes
Slot, queue: Internal classes
Slot, queue-thread: Exported classes
Slot, receive: Exported classes
Slot, routees: Exported classes
Slot, router: Exported classes
Slot, running: Internal structures
Slot, should-run: Exported classes
Slot, state: Exported classes
Slot, strategy-fun: Exported classes
Slot, system: Exported classes
Slot, time-out: Internal structures
Slot, user-actor-context: Exported classes
Slot, wait-time: Exported conditions
Slot, watchers: Exported classes
Slot, withreply-cvar: Internal structures
Slot, withreply-lock: Internal structures
Slot, withreply-p: Internal structures
Slot, yield-threshold: Exported classes
Special Variable, *built-in-strategies*: Internal special variables
Special Variable, *sender*: Exported special variables
state: Exported classes
strategy-fun: Exported classes
system: Exported classes

T
time-out: Internal structures

U
user-actor-context: Exported classes

W
wait-time: Exported conditions
watchers: Exported classes
withreply-cvar: Internal structures
withreply-lock: Internal structures
withreply-p: Internal structures

Y
yield-threshold: Exported classes

Jump to:   *  
A   B   C   D   H   I   L   M   N   P   Q   R   S   T   U   W   Y  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   A   C   D   F   M   P   Q   R   S  
Index Entry  Section

A
actor: Exported classes
actor-cell: Exported classes
actor-cell-state: Internal structures
actor-context: Exported classes
actor-name-exists: Exported conditions
actor-system: Exported classes
agent: Exported classes
ask-timeout: Exported conditions
async-waitor-actor: Internal classes

C
cl-gserver: The cl-gserver system
cl-gserver.actor: The cl-gserver․actor package
cl-gserver.actor-cell: The cl-gserver․actor-cell package
cl-gserver.actor-context: The cl-gserver․actor-context package
cl-gserver.actor-system: The cl-gserver․actor-system package
cl-gserver.agent: The cl-gserver․agent package
cl-gserver.dispatcher: The cl-gserver․dispatcher package
cl-gserver.future: The cl-gserver․future package
cl-gserver.messageb: The cl-gserver․messageb package
cl-gserver.queue: The cl-gserver․queue package
cl-gserver.router: The cl-gserver․router package
cl-gserver.utils: The cl-gserver․utils package
Class, actor: Exported classes
Class, actor-cell: Exported classes
Class, actor-context: Exported classes
Class, actor-system: Exported classes
Class, agent: Exported classes
Class, async-waitor-actor: Internal classes
Class, delayed-cancellable-message: Exported classes
Class, dispatch-worker: Exported classes
Class, dispatcher-base: Exported classes
Class, future: Exported classes
Class, message-box-base: Internal classes
Class, message-box/bt: Exported classes
Class, message-box/dp: Exported classes
Class, queue-base: Internal classes
Class, queue-bounded: Exported classes
Class, queue-unbounded: Exported classes
Class, router: Exported classes
Class, shared-dispatcher: Exported classes
Condition, actor-name-exists: Exported conditions
Condition, ask-timeout: Exported conditions

D
delayed-cancellable-message: Exported classes
dispatch-worker: Exported classes
dispatcher-base: Exported classes

F
future: Exported classes

M
message-box-base: Internal classes
message-box/bt: Exported classes
message-box/dp: Exported classes
message-item/bt: Internal structures
message-item/dp: Internal structures

P
Package, cl-gserver.actor: The cl-gserver․actor package
Package, cl-gserver.actor-cell: The cl-gserver․actor-cell package
Package, cl-gserver.actor-context: The cl-gserver․actor-context package
Package, cl-gserver.actor-system: The cl-gserver․actor-system package
Package, cl-gserver.agent: The cl-gserver․agent package
Package, cl-gserver.dispatcher: The cl-gserver․dispatcher package
Package, cl-gserver.future: The cl-gserver․future package
Package, cl-gserver.messageb: The cl-gserver․messageb package
Package, cl-gserver.queue: The cl-gserver․queue package
Package, cl-gserver.router: The cl-gserver․router package
Package, cl-gserver.utils: The cl-gserver․utils package

Q
queue-base: Internal classes
queue-bounded: Exported classes
queue-unbounded: Exported classes

R
router: Exported classes

S
shared-dispatcher: Exported classes
Structure, actor-cell-state: Internal structures
Structure, message-item/bt: Internal structures
Structure, message-item/dp: Internal structures
System, cl-gserver: The cl-gserver system

Jump to:   A   C   D   F   M   P   Q   R   S