diff options
Diffstat (limited to 'src/mem3.erl')
-rw-r--r-- | src/mem3.erl | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mem3.erl b/src/mem3.erl index 33257c40..81a383c2 100644 --- a/src/mem3.erl +++ b/src/mem3.erl @@ -305,9 +305,13 @@ handle_join(join, ExtNodes, PingNode, #mem{args=Args} = State) -> % now use this info to join the ring int_join(ExtNodes, NewState); -handle_join(replace, [_OldNode | _], _PingNode, _State) -> - % TODO implement me - ok; +handle_join(replace, [OldNode | _], PingNode, State) -> + handle_join(replace, {OldNode, []}, PingNode, State); +handle_join(replace, {OldNode, NewOpts}, PingNode, _State) -> + OldState = #mem{nodes=OldNodes} = get_pingnode_state(PingNode), + {Order, OldNode, _OldOpts} = lists:keyfind(OldNode, 2, OldNodes), + NewNodes = lists:keyreplace(OldNode, 2, OldNodes, {Order, node(), NewOpts}), + int_join([], OldState#mem{nodes=NewNodes}); handle_join(leave, [_OldNode | _], _PingNode, _State) -> % TODO implement me |