Move update_wedge_state() & wedge_myself() to machi_flu1_append_server.erl

This commit is contained in:
Scott Lystig Fritchie 2015-12-18 16:56:01 +09:00
parent b8297afc18
commit 7d262fd3ec
2 changed files with 12 additions and 7 deletions

View file

@ -87,13 +87,11 @@ stop(Pid) when is_pid(Pid) ->
error
end.
update_wedge_state(PidSpec, Boolean, EpochId)
when is_boolean(Boolean), is_tuple(EpochId) ->
gen_server:cast(PidSpec, {wedge_state_change, Boolean, EpochId}).
update_wedge_state(PidSpec, Boolean, EpochId) ->
machi_flu1_append_server:int_update_wedge_state(PidSpec, Boolean, EpochId).
wedge_myself(PidSpec, EpochId)
when is_tuple(EpochId) ->
gen_server:cast(PidSpec, {wedge_myself, EpochId}).
wedge_myself(PidSpec, EpochId) ->
machi_flu1_append_server:int_wedge_myself(PidSpec, EpochId).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -36,7 +36,7 @@
-export([init/1]).
-export([handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3]).
-export([int_update_wedge_state/3, int_wedge_myself/2]).
-export([current_state/1, format_state/1]).
-record(state, {
@ -67,6 +67,13 @@ format_state(State) ->
[_Name | Values] = tuple_to_list(State),
lists:zip(Fields, Values).
int_update_wedge_state(PidSpec, Boolean, EpochId)
when is_boolean(Boolean), is_tuple(EpochId) ->
gen_server:cast(PidSpec, {wedge_state_change, Boolean, EpochId}).
int_wedge_myself(PidSpec, EpochId)
when is_tuple(EpochId) ->
gen_server:cast(PidSpec, {wedge_myself, EpochId}).
init([Fluname, Witness_p, Wedged_p, EpochId]) ->
TID = ets:new(machi_flu1:ets_table_name(Fluname),