Add surface of trim chunks to scrub #8

Merged
kuenishi merged 3 commits from ku/trim-high-proto into master 2015-10-14 03:45:07 +00:00
3 changed files with 9 additions and 3 deletions
Showing only changes of commit e113f6ffdd - Show all commits

View file

@ -289,6 +289,8 @@ handle_call2({write_chunk, File, Offset, Chunk, TO}, _From, S) ->
do_write_head(File, Offset, Chunk, 0, os:timestamp(), TO, S); do_write_head(File, Offset, Chunk, 0, os:timestamp(), TO, S);
handle_call2({read_chunk, File, Offset, Size, TO}, _From, S) -> handle_call2({read_chunk, File, Offset, Size, TO}, _From, S) ->
do_read_chunk(File, Offset, Size, 0, os:timestamp(), TO, S); do_read_chunk(File, Offset, Size, 0, os:timestamp(), TO, S);
handle_call2({trim_chunk, File, Offset, Size, TO}, _From, S) ->
do_trim_chunk(File, Offset, Size, 0, os:timestamp(), TO, S);
handle_call2({checksum_list, File, TO}, _From, S) -> handle_call2({checksum_list, File, TO}, _From, S) ->
do_checksum_list(File, 0, os:timestamp(), TO, S); do_checksum_list(File, 0, os:timestamp(), TO, S);
handle_call2({list_files, TO}, _From, S) -> handle_call2({list_files, TO}, _From, S) ->
@ -547,6 +549,10 @@ do_read_chunk2(File, Offset, Size, Depth, STime, TO,
exit({todo_should_never_happen,?MODULE,?LINE,File,Offset,Size}) exit({todo_should_never_happen,?MODULE,?LINE,File,Offset,Size})
end. end.
do_trim_chunk(_File, _Offset, _Size, _Depth, _STime, _TO, S) ->
%% This is just a stub to reach CR client from high level client
{reply, {error, bad_joss}, S}.
%% Read repair: depends on the consistency mode that we're in: %% Read repair: depends on the consistency mode that we're in:
%% %%
%% CP mode: If the head is written, then use it to repair UPI++Repairing. %% CP mode: If the head is written, then use it to repair UPI++Repairing.

View file

@ -441,9 +441,8 @@ do_pb_hl_request2({high_read_chunk, File, Offset, Size},
{Res, S}; {Res, S};
do_pb_hl_request2({high_trim_chunk, File, Offset, Size}, do_pb_hl_request2({high_trim_chunk, File, Offset, Size},
#state{high_clnt=Clnt}=S) -> #state{high_clnt=Clnt}=S) ->
%% Res = machi_cr_client:trim_chunk(Clnt, File, Offset, Size), Res = machi_cr_client:trim_chunk(Clnt, File, Offset, Size),
%% {Res, S}; {Res, S};
{{error, bad_joss}, S};
do_pb_hl_request2({high_checksum_list, File}, #state{high_clnt=Clnt}=S) -> do_pb_hl_request2({high_checksum_list, File}, #state{high_clnt=Clnt}=S) ->
Res = machi_cr_client:checksum_list(Clnt, File), Res = machi_cr_client:checksum_list(Clnt, File),
{Res, S}; {Res, S};

View file

@ -90,6 +90,7 @@ smoke_test2() ->
[begin [begin
%% ok = ?C:trim_chunk(Clnt, Fl, Off, Sz) %% ok = ?C:trim_chunk(Clnt, Fl, Off, Sz)
%% This gets an error as trim API is still a stub
?assertMatch({bummer, ?assertMatch({bummer,
{throw, {throw,
{error, bad_joss_taipan_fixme}, {error, bad_joss_taipan_fixme},