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

View file

@ -51,7 +51,7 @@
-export([ -export([
child_spec/2, child_spec/2,
start_link/2, start_link/2,
find_or_make_filename_from_prefix/3, find_or_make_filename_from_prefix/4,
increment_prefix_sequence/2, increment_prefix_sequence/2,
list_files_by_prefix/2 list_files_by_prefix/2
]). ]).
@ -89,16 +89,21 @@ start_link(FluName, DataDir) when is_atom(FluName) andalso is_list(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_n(),
Prefix :: {prefix, string()} ) -> Prefix :: {prefix, string()},
{coc, riak_dt:coc_namespace(), riak_dt:coc_locator()}) ->
{file, Filename :: string()} | {error, Reason :: term() } | timeout. {file, Filename :: string()} | {error, Reason :: term() } | timeout.
% @doc Find the latest available or make a filename from a prefix. A prefix % @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 % 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}' % 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), N = make_filename_mgr_name(FluName),
gen_server:call(N, {find_filename, EpochId, Prefix}, ?TIMEOUT); gen_server:call(N, {find_filename, EpochId, Prefix}, ?TIMEOUT);
find_or_make_filename_from_prefix(_FluName, _EpochId, Other) -> find_or_make_filename_from_prefix(_FluName, _EpochId, Other, Other2) ->
lager:error("~p is not a valid prefix.", [Other]), lager:error("~p is not a valid prefix/CoC ~p", [Other, Other2]),
error(badarg). error(badarg).
-spec increment_prefix_sequence( FluName :: atom(), Prefix :: {prefix, string()} ) -> -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 = {bummer, {X, Y, erlang:get_stacktrace()}},
{Res, S} {Res, S}
end; end;
do_send_sync2({append_chunk, CoC_namespace, CoC_locator, do_send_sync2({append_chunk, CoC_Namespace, CoC_Locator,
Prefix, Chunk, CSum, ChunkExtra}, Prefix, Chunk, CSum, ChunkExtra},
#state{sock=Sock, sock_id=Index, count=Count}=S) -> #state{sock=Sock, sock_id=Index, count=Count}=S) ->
try try
ReqID = <<Index:64/big, Count:64/big>>, ReqID = <<Index:64/big, Count:64/big>>,
CSumT = convert_csum_req(CSum, Chunk), CSumT = convert_csum_req(CSum, Chunk),
Req = #mpb_appendchunkreq{coc_namespace=CoC_namespace, Req = #mpb_appendchunkreq{coc_namespace=CoC_Namespace,
coc_locator=CoC_locator, coc_locator=CoC_Locator,
prefix=Prefix, prefix=Prefix,
chunk=Chunk, chunk=Chunk,
csum=CSumT, csum=CSumT,