View Source Spawn.Cluster.StateHandoff.ControllerBehaviour behaviour (spawn v1.0.0-rc.18)

Behavior for managing the state of clustered processes a.k.a lookups.

Summary

Callbacks

Cleanup action.

Fetch the ActorHost process reference by id. In case id is the hash of the ActorId but here the struct ActorId is passed as a parameter. An implementations must handle this.

Any procedure to be executed after the StateHandoffManager is initialized. Executed during callback call to handle_continue.

Any initialization code required by implementations of this behavior. Must return the state to be added in the StateHandoffManager.

If necessary any procedure to be executed during a nodedown event

If necessary any procedure to be executed during a nodeup event

Perform any necessary cleanups during StateHandoffManager termination. Generally excluding references to all processes owned by the terminating node.

Adds a reference to an ActorHost process.

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()}

Callbacks

@callback clean(node(), data()) :: any()

Cleanup action.

@callback get_by_id(id(), data()) :: {new_data(), hosts()}

Fetch the ActorHost process reference by id. In case id is the hash of the ActorId but here the struct ActorId is passed as a parameter. An implementations must handle this.

@callback handle_after_init(data()) :: new_data()

Any procedure to be executed after the StateHandoffManager is initialized. Executed during callback call to handle_continue.

@callback handle_init(config()) :: new_data() | {new_data(), timer()}

Any initialization code required by implementations of this behavior. Must return the state to be added in the StateHandoffManager.

Link to this callback

handle_nodedown_event(node, node_type, data)

View Source
@callback handle_nodedown_event(node(), node_type(), data()) :: new_data()

If necessary any procedure to be executed during a nodedown event

Link to this callback

handle_nodeup_event(node, node_type, data)

View Source
@callback handle_nodeup_event(node(), node_type(), data()) :: new_data()

If necessary any procedure to be executed during a nodeup event

Link to this callback

handle_terminate(node, data)

View Source
@callback handle_terminate(node(), data()) :: new_data()

Perform any necessary cleanups during StateHandoffManager termination. Generally excluding references to all processes owned by the terminating node.

@callback handle_timer(any(), data()) :: new_data() | {new_data(), timer()}
Link to this callback

set(id, node, host, data)

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

Adds a reference to an ActorHost process.