From dffb73330da1fed3caff5bfad19a58c131748f8b Mon Sep 17 00:00:00 2001 From: Shunichi Shinohara Date: Wed, 16 Dec 2015 17:56:17 +0900 Subject: [PATCH] Dialyzer and eunit fix --- src/machi_cinfo.erl | 4 ++-- src/machi_flu1_append_server.erl | 2 +- src/machi_flu_filename_mgr.erl | 10 +++++----- test/machi_cinfo_test.erl | 1 + 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/machi_cinfo.erl b/src/machi_cinfo.erl index 32cfa69..5968449 100644 --- a/src/machi_cinfo.erl +++ b/src/machi_cinfo.erl @@ -85,8 +85,8 @@ fitness(FluName) -> -spec flu1(atom()) -> [{atom(), term()}]. flu1(FluName) -> - State = machi_flu1:current_state(FluName), - machi_flu1:format_state(State). + State = machi_flu1_append_server:current_state(FluName), + machi_flu1_append_server:format_state(State). %% Internal functions diff --git a/src/machi_flu1_append_server.erl b/src/machi_flu1_append_server.erl index 54c0e9e..cd4457d 100644 --- a/src/machi_flu1_append_server.erl +++ b/src/machi_flu1_append_server.erl @@ -164,7 +164,7 @@ append_server_dispatch(From, CoC_Namespace, CoC_Locator, Other end, _ = gen_server:reply(From, Result), - exit(normal). + ok. handle_append(_N, _L, _Prefix, <<>>, _Csum, _Extra, _FluName, _EpochId) -> {error, bad_arg}; diff --git a/src/machi_flu_filename_mgr.erl b/src/machi_flu_filename_mgr.erl index 45e580e..293fdc3 100644 --- a/src/machi_flu_filename_mgr.erl +++ b/src/machi_flu_filename_mgr.erl @@ -67,12 +67,12 @@ ]). -define(TIMEOUT, 10 * 1000). --include("machi_projection.hrl"). %% included for pv1_epoch_n type +-include("machi_projection.hrl"). %% included for pv1_epoch type -record(state, {fluname :: atom(), tid :: ets:tid(), datadir :: string(), - epoch :: pv1_epoch_n() + epoch :: pv1_epoch() }). %% public API @@ -87,8 +87,8 @@ start_link(FluName, DataDir) when is_atom(FluName) andalso is_list(DataDir) -> N = make_filename_mgr_name(FluName), gen_server:start_link({local, N}, ?MODULE, [FluName, DataDir], []). --spec find_or_make_filename_from_prefix( FluName :: atom(), - EpochId :: pv1_epoch_n(), +-spec find_or_make_filename_from_prefix( FluName :: atom(), + EpochId :: pv1_epoch(), Prefix :: {prefix, string()}, machi_dt:coc_nl()) -> {file, Filename :: string()} | {error, Reason :: term() } | timeout. @@ -130,7 +130,7 @@ list_files_by_prefix(_FluName, Other) -> init([FluName, DataDir]) -> Tid = ets:new(make_filename_mgr_name(FluName), [named_table, {read_concurrency, true}]), {ok, #state{fluname = FluName, - epoch = 0, + epoch = ?DUMMY_PV1_EPOCH, datadir = DataDir, tid = Tid}}. diff --git a/test/machi_cinfo_test.erl b/test/machi_cinfo_test.erl index 9699df3..5e21083 100644 --- a/test/machi_cinfo_test.erl +++ b/test/machi_cinfo_test.erl @@ -38,6 +38,7 @@ smoke_test_() -> fun() -> machi_cinfo:private_projection(a) end, fun() -> machi_cinfo:fitness(a) end, fun() -> machi_cinfo:chain_manager(a) end, + fun() -> machi_cinfo:flu1(a) end, fun() -> machi_cinfo:dump() end ]}.