From 4f7177067e7577971d1a6c88315c2e5eaf3e22b6 Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Thu, 9 Apr 2015 21:32:04 +0900 Subject: [PATCH] WIP: Type fixups --- include/machi_chain_manager.hrl | 8 ++++---- include/machi_projection.hrl | 2 +- src/machi_chain_manager1.erl | 4 ++-- test/machi_chain_manager1_converge_demo.erl | 10 +++++----- test/machi_chain_manager1_test.erl | 7 ++++--- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/include/machi_chain_manager.hrl b/include/machi_chain_manager.hrl index 849dbdc..9382fa6 100644 --- a/include/machi_chain_manager.hrl +++ b/include/machi_chain_manager.hrl @@ -29,13 +29,13 @@ flap_limit :: non_neg_integer(), proj :: projection(), %% - timer :: 'undefined' | reference(), - proj_history :: queue(), + timer :: 'undefined' | timer:tref(), + proj_history :: queue:queue(), flaps=0 :: integer(), flap_start = ?NOT_FLAPPING - :: erlang:now(), + :: erlang:timestamp(), runenv :: list(), %proplist() opts :: list(), %proplist() members_dict :: p_srvr_dict(), - proxies_dict :: orddict:orddict(pv1_server(), pid()) + proxies_dict :: orddict:orddict() }). diff --git a/include/machi_projection.hrl b/include/machi_projection.hrl index ea007c5..dfe043c 100644 --- a/include/machi_projection.hrl +++ b/include/machi_projection.hrl @@ -36,7 +36,7 @@ }). -type p_srvr() :: #p_srvr{}. --type p_srvr_dict() :: orddict:orddict(pv1_server(), p_srvr()). +-type p_srvr_dict() :: orddict:orddict(). -define(DUMMY_PV1_EPOCH, {0,<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>}). diff --git a/src/machi_chain_manager1.erl b/src/machi_chain_manager1.erl index 241bd1c..5552942 100644 --- a/src/machi_chain_manager1.erl +++ b/src/machi_chain_manager1.erl @@ -192,8 +192,8 @@ handle_call({test_set_active, Boolean}, _From, #ch_mgr{timer=TRef}=S) -> {true, undefined} -> S2 = set_active_timer(S), {reply, ok, S2}; - {false, TRef} when is_reference(TRef) -> - timer:cancel(TRef), + {false, _} -> + (catch timer:cancel(TRef)), {reply, ok, S#ch_mgr{timer=undefined}}; _ -> {reply, error, S} diff --git a/test/machi_chain_manager1_converge_demo.erl b/test/machi_chain_manager1_converge_demo.erl index 909202b..4b8df9a 100644 --- a/test/machi_chain_manager1_converge_demo.erl +++ b/test/machi_chain_manager1_converge_demo.erl @@ -128,11 +128,11 @@ long_doc() -> n of a naive/1st draft detection algorithm. ". -convergence_demo_test_() -> - {timeout, 98*300, fun() -> convergence_demo_testfun() end}. +%% convergence_demo_test_() -> +%% {timeout, 98*300, fun() -> convergence_demo_testfun() end}. -convergence_demo_testfun() -> - convergence_demo_testfun(3). +%% convergence_demo_testfun() -> +%% convergence_demo_testfun(3). t() -> t(3). @@ -355,7 +355,7 @@ convergence_demo_testfun(NumFLUs) -> after [ok = ?MGR:stop(MgrPid) || {_, MgrPid} <- MgrNamez], [ok = ?FLU_PC:quit(PPid) || {_, PPid} <- Namez], - [ok = ?FLU_C:stop(FLUPid) || FLUPid <- FLU_pids], + [ok = machi_flu1:stop(FLUPid) || FLUPid <- FLU_pids], ok = machi_partition_simulator:stop() end. diff --git a/test/machi_chain_manager1_test.erl b/test/machi_chain_manager1_test.erl index 20ec7f2..7152d40 100644 --- a/test/machi_chain_manager1_test.erl +++ b/test/machi_chain_manager1_test.erl @@ -48,12 +48,12 @@ unanimous_report(Namez) -> UniquePrivateEs = lists:usort(lists:flatten( - [machi_flu0:proj_list_all(FLU, private) || + [element(2, ?FLU_PC:list_all_projections(FLU, private)) || {_FLUName, FLU} <- Namez])), [unanimous_report(Epoch, Namez) || Epoch <- UniquePrivateEs]. unanimous_report(Epoch, Namez) -> - Projs = [{FLUName, case machi_flu0:proj_read(FLU, Epoch, private) of + Projs = [{FLUName, case ?FLU_PC:read_projection(FLU, private, Epoch) of {ok, T} -> T; _Else -> not_in_this_epoch end} || {FLUName, FLU} <- Namez], @@ -128,7 +128,8 @@ extract_chains_relative_to_flu(FLU, Report) -> lists:member(FLU, UPI) orelse lists:member(FLU, Repairing)]}. chain_to_projection(MyName, Epoch, UPI_list, Repairing_list, All_list) -> - ?MGR:make_projection(Epoch, MyName, All_list, + exit({todo_broken_fixme,?MODULE,?LINE}), + machi_projection:new(Epoch, MyName, All_list, All_list -- (UPI_list ++ Repairing_list), UPI_list, Repairing_list, []).