Gaffer Docs

The APE Pattern

I call the concurrency pattern used within Gaffer the APE Pattern. APE is short for Actors, Processes, and Events. These three fundamental constructs must be understood by clients of the library to use it effectively.

Actors

Actors encapsulate game state data. They can be complex, with geometries, textures, and so on, or they can be simpler forms of data.

The key is that Actors never manipulate their own data. They are essentially "dumb" actors.

Processes

Processes represent the unit of computation within the Gaffer runtime. They are simple objects that implement the Process interface, whose method of interest is update(...).

Processes have an ownership relationship with Actors. Each Actor is owned by one or more Processes, and it is this relationship that determines how Processes are spread across the cores of the system.

Events

Events provide the communication mechanism between processes and different sub systems. An event has a type and data corresponding to its type. When an event is fired, all listeners of that event type are given an opportunity to process it.