Add a new optional callback, or similar, that gets called when a node joins or leaves the Erlang cluster.
The callback can take decisions on what to do with this information, such as adding or removing the node
as one of its members.
Suggestion:
Update ra_server_proc:leader state, that already handles nodeup/nodedown, to call a new optional callback.
To cause a randomized delay, perhaps add a erlang:send_after with a new info message, something like
(erlang:send_after(SOMERANDOMNUMBER, self(), {delayed_node_status_update, Node, Status}))
and a new clause to leader, something like
leader(info, {delayed_node_status_update, Node, Status}, State0) ->
Effects = ra_server:NEW_OPT_CALLBACK(State0#state.server_state, Node, Status),
{State, Actions} = ?HANDLE_EFFECTS(Effects,
cast, State0),
{keep_state, State, Actions};
Would perhaps also be good to send along the members of the raft, so that the user code does not have to call ra:members()
Add a new optional callback, or similar, that gets called when a node joins or leaves the Erlang cluster.
The callback can take decisions on what to do with this information, such as adding or removing the node
as one of its members.
Suggestion:
Update
ra_server_proc:leaderstate, that already handles nodeup/nodedown, to call a new optional callback.To cause a randomized delay, perhaps add a
erlang:send_afterwith a newinfomessage, something like(erlang:send_after(SOMERANDOMNUMBER, self(), {delayed_node_status_update, Node, Status}))and a new clause to leader, something like
Would perhaps also be good to send along the members of the raft, so that the user code does not have to call ra:members()