View Source Spawn.Cluster.StateHandoff (spawn v0.5.1)

This handles state handoff in a cluster.

It uses the DeltaCrdt library to handle a distributed state, which is an eventually consistent replicated data type. The module starts a GenServer that monitors nodes in the cluster, and when a new node comes up it sends a "set_neighbours" message to that node's GenServer process with its own DeltaCrdt process ID. This is done to ensure that changes in either node's state are reflected across both.

The module also handles other messages like "handoff" and "get" to put and retrieve data from the DeltaCrdt state, respectively.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Cluster HostActor cleanup

Pickup the stored entity data for a actor

Join this crdt with one on another node by adding it as a neighbour

Store a actor and entity in the handoff crdt

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Cluster HostActor cleanup

Pickup the stored entity data for a actor

Join this crdt with one on another node by adding it as a neighbour

Store a actor and entity in the handoff crdt