Skip to content

Commit

Permalink
Pass remote_node and is_leader into handle_down
Browse files Browse the repository at this point in the history
  • Loading branch information
arcusfelis committed Feb 1, 2024
1 parent 87246cb commit 469f177
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/cets.erl
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,16 @@
}.
%% Status information returned `info/1'.

-type handle_down_fun() :: fun((#{remote_pid := server_pid(), table := table_name()}) -> ok).
-type handle_down_fun() :: fun(
(
#{
remote_pid := server_pid(),
remote_pid := node(),
table := table_name(),
is_leader := boolean()
}
) -> ok
).
%% Handler function which is called when the remote node goes down.

-type handle_conflict_fun() :: fun((tuple(), tuple()) -> tuple()).
Expand Down Expand Up @@ -896,10 +905,17 @@ handle_get_info(

%% Cleanup
-spec call_user_handle_down(server_pid(), state()) -> ok.
call_user_handle_down(RemotePid, #{tab := Tab, opts := Opts}) ->
call_user_handle_down(RemotePid, #{tab := Tab, opts := Opts, is_leader := IsLeader}) ->
case Opts of
#{handle_down := F} ->
FF = fun() -> F(#{remote_pid => RemotePid, table => Tab}) end,
FF = fun() ->
F(#{
remote_node => node(RemotePid),
remote_pid => RemotePid,
table => Tab,
is_leader => IsLeader
})
end,
Info = #{
task => call_user_handle_down,
table => Tab,
Expand Down

0 comments on commit 469f177

Please sign in to comment.