View Source Spawn.Cluster.StateHandoff.ControllerBehaviour behaviour (spawn v2.0.0-RC7)

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

data()

@type data() :: any()

host()

@type host() :: Actors.Registry.HostActor.t()

hosts()

@type hosts() :: [Actors.Registry.HostActor.t()]

id()

@type id() :: Spawn.Actors.ActorId.t()

new_data()

@type new_data() :: data()

node_type()

@type node_type() :: term()

opts()

@type opts() :: Keyword.t()

timer()

@type timer() :: {atom(), integer()}

Callbacks

clean(node, data)

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

Cleanup action.

get_by_id(id, data)

@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.

handle_after_init(data)

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

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

handle_init(opts)

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

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

handle_nodedown_event(node, node_type, data)

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

If necessary any procedure to be executed during a nodedown event

handle_nodeup_event(node, node_type, data)

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

If necessary any procedure to be executed during a nodeup event

handle_terminate(node, data)

@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.

handle_timer(any, data)

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

set(id, node, host, data)

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

Adds a reference to an ActorHost process.