View Source Spawn.Cluster.StateHandoff.Controllers.CrdtController (spawn v1.0.0-rc.24)

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.

Summary

Functions

Cluster HostActor cleanup

Types

@type config() :: map()
@type data() :: any()
@type host() :: Actors.Registry.HostActor.t()
@type hosts() :: [Actors.Registry.HostActor.t()]
@type id() :: Eigr.Functions.Protocol.Actors.ActorId.t()
@type new_data() :: data()
@type node_type() :: term()
@type timer() :: {atom(), integer()}

Functions

Cluster HostActor cleanup