Ss/flu1 factorization2 #55

Merged
shino merged 5 commits from ss/flu1-factorization2 into master 2015-12-18 08:19:17 +00:00
4 changed files with 9 additions and 8 deletions
Showing only changes of commit dffb73330d - Show all commits

View file

@ -85,8 +85,8 @@ fitness(FluName) ->
-spec flu1(atom()) -> [{atom(), term()}]. -spec flu1(atom()) -> [{atom(), term()}].
flu1(FluName) -> flu1(FluName) ->
State = machi_flu1:current_state(FluName), State = machi_flu1_append_server:current_state(FluName),
machi_flu1:format_state(State). machi_flu1_append_server:format_state(State).
%% Internal functions %% Internal functions

View file

@ -164,7 +164,7 @@ append_server_dispatch(From, CoC_Namespace, CoC_Locator,
Other Other
end, end,
_ = gen_server:reply(From, Result), _ = gen_server:reply(From, Result),
exit(normal). ok.
handle_append(_N, _L, _Prefix, <<>>, _Csum, _Extra, _FluName, _EpochId) -> handle_append(_N, _L, _Prefix, <<>>, _Csum, _Extra, _FluName, _EpochId) ->
{error, bad_arg}; {error, bad_arg};

View file

@ -67,12 +67,12 @@
]). ]).
-define(TIMEOUT, 10 * 1000). -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(), -record(state, {fluname :: atom(),
tid :: ets:tid(), tid :: ets:tid(),
datadir :: string(), datadir :: string(),
epoch :: pv1_epoch_n() epoch :: pv1_epoch()
}). }).
%% public API %% public API
@ -88,7 +88,7 @@ start_link(FluName, DataDir) when is_atom(FluName) andalso is_list(DataDir) ->
gen_server:start_link({local, N}, ?MODULE, [FluName, DataDir], []). gen_server:start_link({local, N}, ?MODULE, [FluName, DataDir], []).
-spec find_or_make_filename_from_prefix( FluName :: atom(), -spec find_or_make_filename_from_prefix( FluName :: atom(),
EpochId :: pv1_epoch_n(), EpochId :: pv1_epoch(),
Prefix :: {prefix, string()}, Prefix :: {prefix, string()},
machi_dt:coc_nl()) -> machi_dt:coc_nl()) ->
{file, Filename :: string()} | {error, Reason :: term() } | timeout. {file, Filename :: string()} | {error, Reason :: term() } | timeout.
@ -130,7 +130,7 @@ list_files_by_prefix(_FluName, Other) ->
init([FluName, DataDir]) -> init([FluName, DataDir]) ->
Tid = ets:new(make_filename_mgr_name(FluName), [named_table, {read_concurrency, true}]), Tid = ets:new(make_filename_mgr_name(FluName), [named_table, {read_concurrency, true}]),
{ok, #state{fluname = FluName, {ok, #state{fluname = FluName,
epoch = 0, epoch = ?DUMMY_PV1_EPOCH,
datadir = DataDir, datadir = DataDir,
tid = Tid}}. tid = Tid}}.

View file

@ -38,6 +38,7 @@ smoke_test_() ->
fun() -> machi_cinfo:private_projection(a) end, fun() -> machi_cinfo:private_projection(a) end,
fun() -> machi_cinfo:fitness(a) end, fun() -> machi_cinfo:fitness(a) end,
fun() -> machi_cinfo:chain_manager(a) end, fun() -> machi_cinfo:chain_manager(a) end,
fun() -> machi_cinfo:flu1(a) end,
fun() -> machi_cinfo:dump() end fun() -> machi_cinfo:dump() end
]}. ]}.