View Source Spawn.Cluster.StateHandoffCrdtController (spawn v1.0.0-rc3)

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

Link to this section 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()

Link to this section Functions

Cluster HostActor cleanup

Link to this function

get_by_id(id, node, data)

View Source
@spec get_by_id(id(), node(), data()) :: {new_data(), hosts()}
@spec handle_after_init(data()) :: new_data()
@spec handle_init(config()) :: new_data()
Link to this function

handle_nodedown_event(node, node_type, data)

View Source
@spec handle_nodedown_event(node(), node_type(), data()) :: new_data()
Link to this function

handle_nodeup_event(node, node_type, data)

View Source
@spec handle_nodeup_event(node(), node_type(), data()) :: new_data()
Link to this function

handle_terminate(node, data)

View Source
@spec handle_terminate(node(), data()) :: new_data()
Link to this function

handle_timer(arg1, data)

View Source
Link to this function

set(id, node, host, data)

View Source
@spec set(id(), node(), host(), data()) :: new_data()