Crate lunatic_runtime[][src]

Expand description

The lunatic vm is a system for creating actors from WebAssembly modules. This lunatic-runtime library allows you to embed the lunatic vm inside your Rust code.

The actor model in computer science is a mathematical model of concurrent computation that treats actor as the universal primitive of concurrent computation. In response to a message it receives, an actor can: make local decisions, create more actors, send more messages, and determine how to respond to the next message received. Actors may modify their own private state, but can only affect each other indirectly through messaging (removing the need for lock-based synchronization).

Source: https://en.wikipedia.org/wiki/Actor_model

Note: If you are looking to build actors in Rust and compile them to lunatic compatible Wasm modules, checkout out the lunatic crate.

Core Concepts

  • Environment - defines the characteristics of Processes that are spawned into it. An Environment is created with an EnvConfig to tweak various settings, like maximum memory and compute usage.

  • WasmProcess - a handle to send signals and messages to spawned Wasm processes. It implements the Process trait.

Plugins

TODO

WebAssembly module requirements

TODO

Modules

The Message is a special variant of a Signal that can be sent to processes. The most common kind of Message is a DataMessage, but there are also some special kinds of messages, like the Message::Signal, that is received if a linked process dies.

Plugins are WebAssembly modules that can be attached to an Environment. They have 2 tasks:

Registries allow you to define “well-known” processes in the environment that can be looked up by name and version.

Structs

Configuration structure for environments.

A WasmProcess represents an instance of a Wasm module that is being executed.

Enums

The environment represents a set of characteristics that processes spawned from it will have.

The reason of a process finishing

Signals can be sent to processes to interact with them.

Traits

The Process is the main abstraction unit in lunatic.

Functions

Spawns a process from a closure.