Expand description
A runtime node: activations, turns, the outbox, timers, supervision and migrations.
A Node owns the in-memory activations of one process. Its scheduler is synchronous and
deterministic: Node::pump drains finished background turns, fires due timers, runs one
turn for every actor with a deliverable message and deactivates idle actors;
Node::run_until_idle pumps until nothing is left to do at the current time, and
Node::run is the async loop that sleeps until the next timer or wake-up. Datamodels need
not be Send, so a node stays on one thread (tokio::task::LocalSet); everything outside
it talks to it through a NodeHandle, which is Send + Sync.
One turn of a virtual actor:
- receive the oldest message not deferred by the active states;
- drop it if its message id is already journaled, if it is a second reply to a request, or if it is a timer that was cancelled;
- stamp the time, run the start macrostep (first entry only) and one macrostep;
- append the entry with compare-and-set at the expected position, carrying the current-state delta and the fencing token; on a conflict step down without dispatching;
- acknowledge the message, then dispatch the recorded sends (the outbox), arm timers, start and cancel invocations, record dead letters, and write a snapshot every N entries.
Structs§
- Actor
State - An actor’s state at a journal position.
- Dead
Letter - A recorded dead letter.
- Node
- A runtime node. See the module documentation.
- Node
Builder - Builds a
Node. - Node
Config - Node settings.
- Node
Handle - A handle on a node for callers outside the actor system: send, ask, register resolvers,
shut down. It is
Send + Syncand cheap to clone. - Node
Stats - Counters for observing a node.
Enums§
- Activation
Error - Why an actor could not be activated.
- AskError
- Why an external ask failed.
- Crash
Point - Where a node simulates a crash (for tests of the journal protocol): the node stops at that point of the next turn and does nothing afterwards, as if the process died.
- Delivery
Error - Why a message could not be delivered.
- Migrate
Error - Why a migration or fork was refused.
- Remove
Error - Why a chart version could not be removed.