Remove straggler CoC items in code
This commit is contained in:
parent
0a8c4156c2
commit
5a65a164c3
6 changed files with 27 additions and 27 deletions
|
@ -254,6 +254,8 @@ message Mpb_ChecksumListResp {
|
|||
// High level API: list_files() request & response
|
||||
|
||||
message Mpb_ListFilesReq {
|
||||
// TODO: Add flag for file glob/regexp/other filter type
|
||||
// TODO: What else could go wrong?
|
||||
}
|
||||
|
||||
message Mpb_ListFilesResp {
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
file_prefix/0,
|
||||
inet_host/0,
|
||||
inet_port/0,
|
||||
locator/0,
|
||||
namespace/0,
|
||||
namespace_version/0,
|
||||
ns_info/0,
|
||||
|
|
|
@ -220,7 +220,7 @@ do_pb_ll_request(PB_request, S) ->
|
|||
{Rs, NewS} = do_pb_ll_request3(Cmd0, S),
|
||||
{RqID, Cmd0, Rs, NewS};
|
||||
{RqID, Cmd0} ->
|
||||
io:format(user, "TODO: epoch at pos 2 in tuple is probably broken now, wheeeeeeeeeeeeeeeeee\n", []),
|
||||
io:format(user, "TODO: epoch at pos 2 in tuple is probably broken now, whee: ~p\n", [Cmd0]),
|
||||
EpochID = element(2, Cmd0), % by common convention
|
||||
{Rs, NewS} = do_pb_ll_request2(EpochID, Cmd0, S),
|
||||
{RqID, Cmd0, Rs, NewS}
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
-module(machi_flu_metadata_mgr).
|
||||
-behaviour(gen_server).
|
||||
|
||||
-include("machi.hrl").
|
||||
|
||||
-define(MAX_MGRS, 10). %% number of managers to start by default.
|
||||
-define(HASH(X), erlang:phash2(X)). %% hash algorithm to use
|
||||
|
@ -185,17 +186,16 @@ handle_info({'DOWN', Mref, process, Pid, file_rollover}, State = #state{ fluname
|
|||
tid = Tid }) ->
|
||||
lager:info("file proxy ~p shutdown because of file rollover", [Pid]),
|
||||
R = get_md_record_by_mref(Tid, Mref),
|
||||
{Prefix, CoC_Namespace, CoC_Locator, _, _} =
|
||||
{Prefix, NS, NSLocator, _, _} =
|
||||
machi_util:parse_filename(R#md.filename),
|
||||
%% CoC_Namespace = list_to_binary(CoC_Namespace_str),
|
||||
%% CoC_Locator = list_to_integer(CoC_Locator_str),
|
||||
|
||||
%% We only increment the counter here. The filename will be generated on the
|
||||
%% next append request to that prefix and since the filename will have a new
|
||||
%% sequence number it probably will be associated with a different metadata
|
||||
%% manager. That's why we don't want to generate a new file name immediately
|
||||
%% and use it to start a new file proxy.
|
||||
ok = machi_flu_filename_mgr:increment_prefix_sequence(FluName, {coc, CoC_Namespace, CoC_Locator}, {prefix, Prefix}),
|
||||
NSInfo = #ns_info{name=NS, locator=NSLocator},
|
||||
ok = machi_flu_filename_mgr:increment_prefix_sequence(FluName, NSInfo, {prefix, Prefix}),
|
||||
|
||||
%% purge our ets table of this entry completely since it is likely the
|
||||
%% new filename (whenever it comes) will be in a different manager than
|
||||
|
|
|
@ -71,10 +71,10 @@ make_regname(Prefix) when is_list(Prefix) ->
|
|||
|
||||
-spec make_config_filename(string(), machi_dt:namespace(), machi_dt:locator(), string()) ->
|
||||
string().
|
||||
make_config_filename(DataDir, NS, Locator, Prefix) ->
|
||||
Locator_str = int_to_hexstr(Locator, 32),
|
||||
make_config_filename(DataDir, NS, NSLocator, Prefix) ->
|
||||
NSLocator_str = int_to_hexstr(NSLocator, 32),
|
||||
lists:flatten(io_lib:format("~s/config/~s^~s^~s",
|
||||
[DataDir, Prefix, NS, Locator_str])).
|
||||
[DataDir, Prefix, NS, NSLocator_str])).
|
||||
|
||||
%% @doc Calculate a config file path, by common convention.
|
||||
|
||||
|
@ -105,17 +105,17 @@ make_checksum_filename(DataDir, FileName) ->
|
|||
|
||||
-spec make_data_filename(string(), machi_dt:namespace(), machi_dt:locator(), string(), atom()|string()|binary(), integer()|string()) ->
|
||||
{binary(), string()}.
|
||||
make_data_filename(DataDir, NS, Locator, Prefix, SequencerName, FileNum)
|
||||
make_data_filename(DataDir, NS, NSLocator, Prefix, SequencerName, FileNum)
|
||||
when is_integer(FileNum) ->
|
||||
Locator_str = int_to_hexstr(Locator, 32),
|
||||
NSLocator_str = int_to_hexstr(NSLocator, 32),
|
||||
File = erlang:iolist_to_binary(io_lib:format("~s^~s^~s^~s^~w",
|
||||
[Prefix, NS, Locator_str, SequencerName, FileNum])),
|
||||
[Prefix, NS, NSLocator_str, SequencerName, FileNum])),
|
||||
make_data_filename2(DataDir, File);
|
||||
make_data_filename(DataDir, NS, Locator, Prefix, SequencerName, String)
|
||||
make_data_filename(DataDir, NS, NSLocator, Prefix, SequencerName, String)
|
||||
when is_list(String) ->
|
||||
Locator_str = int_to_hexstr(Locator, 32),
|
||||
NSLocator_str = int_to_hexstr(NSLocator, 32),
|
||||
File = erlang:iolist_to_binary(io_lib:format("~s^~s^~s^~s^~s",
|
||||
[Prefix, NS, Locator_str, SequencerName, string])),
|
||||
[Prefix, NS, NSLocator_str, SequencerName, string])),
|
||||
make_data_filename2(DataDir, File).
|
||||
|
||||
make_data_filename2(DataDir, File) ->
|
||||
|
@ -155,8 +155,8 @@ is_valid_filename(Filename) ->
|
|||
%% The components will be:
|
||||
%% <ul>
|
||||
%% <li>Prefix</li>
|
||||
%% <li>CoC Namespace</li>
|
||||
%% <li>CoC locator</li>
|
||||
%% <li>Cluster namespace</li>
|
||||
%% <li>Cluster locator</li>
|
||||
%% <li>UUID</li>
|
||||
%% <li>Sequence number</li>
|
||||
%% </ul>
|
||||
|
@ -165,27 +165,26 @@ is_valid_filename(Filename) ->
|
|||
-spec parse_filename( Filename :: string() ) -> {} | {string(), machi_dt:namespace(), machi_dt:locator(), string(), string() }.
|
||||
parse_filename(Filename) ->
|
||||
case string:tokens(Filename, "^") of
|
||||
[Prefix, CoC_NS, CoC_Loc, UUID, SeqNo] ->
|
||||
{Prefix, CoC_NS, list_to_integer(CoC_Loc), UUID, SeqNo};
|
||||
[Prefix, CoC_Loc, UUID, SeqNo] ->
|
||||
[Prefix, NS, NSLocator, UUID, SeqNo] ->
|
||||
{Prefix, NS, list_to_integer(NSLocator), UUID, SeqNo};
|
||||
[Prefix, NSLocator, UUID, SeqNo] ->
|
||||
%% string:tokens() doesn't consider "foo^^bar" as 3 tokens {sigh}
|
||||
case re:replace(Filename, "[^^]+", "x", [global,{return,binary}]) of
|
||||
<<"x^^x^x^x">> ->
|
||||
{Prefix, <<"">>, list_to_integer(CoC_Loc), UUID, SeqNo};
|
||||
{Prefix, <<"">>, list_to_integer(NSLocator), UUID, SeqNo};
|
||||
_ ->
|
||||
{}
|
||||
end;
|
||||
_ -> {}
|
||||
end.
|
||||
|
||||
|
||||
%% @doc Read the file size of a config file, which is used as the
|
||||
%% basis for a minimum sequence number.
|
||||
|
||||
-spec read_max_filenum(string(), machi_dt:namespace(), machi_dt:locator(), string()) ->
|
||||
non_neg_integer().
|
||||
read_max_filenum(DataDir, NS, Locator, Prefix) ->
|
||||
case file:read_file_info(make_config_filename(DataDir, NS, Locator, Prefix)) of
|
||||
read_max_filenum(DataDir, NS, NSLocator, Prefix) ->
|
||||
case file:read_file_info(make_config_filename(DataDir, NS, NSLocator, Prefix)) of
|
||||
{error, enoent} ->
|
||||
0;
|
||||
{ok, FI} ->
|
||||
|
@ -197,9 +196,9 @@ read_max_filenum(DataDir, NS, Locator, Prefix) ->
|
|||
|
||||
-spec increment_max_filenum(string(), machi_dt:namespace(), machi_dt:locator(), string()) ->
|
||||
ok | {error, term()}.
|
||||
increment_max_filenum(DataDir, NS, Locator, Prefix) ->
|
||||
increment_max_filenum(DataDir, NS, NSLocator, Prefix) ->
|
||||
try
|
||||
{ok, FH} = file:open(make_config_filename(DataDir, NS, Locator, Prefix), [append]),
|
||||
{ok, FH} = file:open(make_config_filename(DataDir, NS, NSLocator, Prefix), [append]),
|
||||
ok = file:write(FH, "x"),
|
||||
ok = file:sync(FH),
|
||||
ok = file:close(FH)
|
||||
|
|
|
@ -56,8 +56,6 @@ smoke_test2() ->
|
|||
%% a separate test module? Or separate test func?
|
||||
{error, _} = ?C:auth(Clnt, "foo", "bar"),
|
||||
|
||||
CoC_n = "", % CoC_namespace (not implemented)
|
||||
CoC_l = 0, % CoC_locator (not implemented)
|
||||
Prefix = <<"prefix">>,
|
||||
Chunk1 = <<"Hello, chunk!">>,
|
||||
NS = "",
|
||||
|
|
Loading…
Reference in a new issue