Push TODO closer to actual TODO work site, standardize var spelling

This commit is contained in:
Scott Lystig Fritchie 2015-10-20 00:20:04 +09:00
parent 10a27ce7dd
commit c3002d9852
3 changed files with 21 additions and 15 deletions

View file

@ -449,11 +449,11 @@ do_pb_hl_request2({high_echo, Msg}, S) ->
{Msg, S};
do_pb_hl_request2({high_auth, _User, _Pass}, S) ->
{-77, S};
do_pb_hl_request2({high_append_chunk, CoC_namespace, CoC_locator,
do_pb_hl_request2({high_append_chunk, CoC_Namespace, CoC_Locator,
Prefix, ChunkBin, TaggedCSum,
ChunkExtra}, #state{high_clnt=Clnt}=S) ->
Chunk = {TaggedCSum, ChunkBin},
Res = machi_cr_client:append_chunk_extra(Clnt, CoC_namespace, CoC_locator,
Res = machi_cr_client:append_chunk_extra(Clnt, CoC_Namespace, CoC_Locator,
Prefix, Chunk,
ChunkExtra),
{Res, S};
@ -704,8 +704,9 @@ handle_append(_N, _L, _Prefix, <<>>, _Csum, _Extra, _FluName, _EpochId) ->
{error, bad_arg};
handle_append(CoC_Namespace, CoC_Locator,
Prefix, Chunk, Csum, Extra, FluName, EpochId) ->
io:format(user, "TODO: CoC_Namespace, CoC_Locator ~p ~p\n", [CoC_Namespace, CoC_Locator]),
Res = machi_flu_filename_mgr:find_or_make_filename_from_prefix(FluName, EpochId, {prefix, Prefix}),
CoC = {coc, CoC_Namespace, CoC_Locator},
Res = machi_flu_filename_mgr:find_or_make_filename_from_prefix(
FluName, EpochId, {prefix, Prefix}, CoC),
case Res of
{file, F} ->
case machi_flu_metadata_mgr:start_proxy_pid(FluName, {file, F}) of

View file

@ -51,7 +51,7 @@
-export([
child_spec/2,
start_link/2,
find_or_make_filename_from_prefix/3,
find_or_make_filename_from_prefix/4,
increment_prefix_sequence/2,
list_files_by_prefix/2
]).
@ -87,18 +87,23 @@ 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(),
Prefix :: {prefix, string()} ) ->
-spec find_or_make_filename_from_prefix( FluName :: atom(),
EpochId :: pv1_epoch_n(),
Prefix :: {prefix, string()},
{coc, riak_dt:coc_namespace(), riak_dt:coc_locator()}) ->
{file, Filename :: string()} | {error, Reason :: term() } | timeout.
% @doc Find the latest available or make a filename from a prefix. A prefix
% should be in the form of a tagged tuple `{prefix, P}'. Returns a tagged
% tuple in the form of `{file, F}' or an `{error, Reason}'
find_or_make_filename_from_prefix(FluName, EpochId, {prefix, Prefix}) when is_atom(FluName) ->
find_or_make_filename_from_prefix(FluName, EpochId,
{prefix, Prefix},
{coc, CoC_Namespace, CoC_Locator})
when is_atom(FluName) ->
io:format(user, "TODO: CoC_Namespace, CoC_Locator ~p ~p\n", [CoC_Namespace, CoC_Locator]),
N = make_filename_mgr_name(FluName),
gen_server:call(N, {find_filename, EpochId, Prefix}, ?TIMEOUT);
find_or_make_filename_from_prefix(_FluName, _EpochId, Other) ->
lager:error("~p is not a valid prefix.", [Other]),
gen_server:call(N, {find_filename, EpochId, Prefix}, ?TIMEOUT);
find_or_make_filename_from_prefix(_FluName, _EpochId, Other, Other2) ->
lager:error("~p is not a valid prefix/CoC ~p", [Other, Other2]),
error(badarg).
-spec increment_prefix_sequence( FluName :: atom(), Prefix :: {prefix, string()} ) ->

View file

@ -281,14 +281,14 @@ do_send_sync2({auth, User, Pass}, #state{sock=Sock}=S) ->
Res = {bummer, {X, Y, erlang:get_stacktrace()}},
{Res, S}
end;
do_send_sync2({append_chunk, CoC_namespace, CoC_locator,
do_send_sync2({append_chunk, CoC_Namespace, CoC_Locator,
Prefix, Chunk, CSum, ChunkExtra},
#state{sock=Sock, sock_id=Index, count=Count}=S) ->
try
ReqID = <<Index:64/big, Count:64/big>>,
CSumT = convert_csum_req(CSum, Chunk),
Req = #mpb_appendchunkreq{coc_namespace=CoC_namespace,
coc_locator=CoC_locator,
Req = #mpb_appendchunkreq{coc_namespace=CoC_Namespace,
coc_locator=CoC_Locator,
prefix=Prefix,
chunk=Chunk,
csum=CSumT,