diff --git a/src/machi_flu1_client.erl b/src/machi_flu1_client.erl index be0dc54..8a1fc1e 100644 --- a/src/machi_flu1_client.erl +++ b/src/machi_flu1_client.erl @@ -174,7 +174,6 @@ wedge_status(Host, TcpPort) when is_integer(TcpPort) -> catch gen_tcp:close(Sock) end. - %% @doc Get the latest epoch number + checksum from the FLU's projection store. -spec get_latest_epoch(port(), projection_type()) -> diff --git a/src/machi_proxy_flu1_client.erl b/src/machi_proxy_flu1_client.erl index f69d573..3bbaa28 100644 --- a/src/machi_proxy_flu1_client.erl +++ b/src/machi_proxy_flu1_client.erl @@ -54,6 +54,7 @@ read_chunk/5, read_chunk/6, checksum_list/3, checksum_list/4, list_files/2, list_files/3, + wedge_status/1, wedge_status/2, %% %% Projection API get_latest_epoch/2, get_latest_epoch/3, @@ -131,6 +132,17 @@ list_files(PidSpec, EpochID, Timeout) -> gen_server:call(PidSpec, {req, {list_files, EpochID}}, Timeout). +%% @doc Fetch the wedge status from the remote FLU. + +wedge_status(PidSpec) -> + wedge_status(PidSpec, infinity). + +%% @doc Fetch the wedge status from the remote FLU. + +wedge_status(PidSpec, Timeout) -> + gen_server:call(PidSpec, {req, {wedge_status}}, + Timeout). + %% @doc Get the latest epoch number + checksum from the FLU's projection store. get_latest_epoch(PidSpec, ProjType) -> @@ -261,6 +273,8 @@ make_req_fun({checksum_list, EpochID, File}, #state{sock=Sock}) -> fun() -> ?FLU_C:checksum_list(Sock, EpochID, File) end; make_req_fun({list_files, EpochID}, #state{sock=Sock}) -> fun() -> ?FLU_C:list_files(Sock, EpochID) end; +make_req_fun({wedge_status}, #state{sock=Sock}) -> + fun() -> ?FLU_C:wedge_status(Sock) end; make_req_fun({get_latest_epoch, ProjType}, #state{sock=Sock}) -> fun() -> ?FLU_C:get_latest_epoch(Sock, ProjType) end; make_req_fun({read_latest_projection, ProjType}, #state{sock=Sock}) -> diff --git a/test/machi_proxy_flu1_client_test.erl b/test/machi_proxy_flu1_client_test.erl index 5de23e8..cc3a8f3 100644 --- a/test/machi_proxy_flu1_client_test.erl +++ b/test/machi_proxy_flu1_client_test.erl @@ -66,6 +66,7 @@ api_smoke_test() -> BadFile = <<"no-such-file">>, {error, no_such_file} = ?MUT:checksum_list(Prox1, FakeEpoch, BadFile), {ok, [_|_]} = ?MUT:list_files(Prox1, FakeEpoch), + {ok, {true, {0,<<0:(20*8)/big>>}}} = ?MUT:wedge_status(Prox1), {ok, FakeEpoch} = ?MUT:get_latest_epoch(Prox1, public), {error, not_written} = ?MUT:read_latest_projection(Prox1, public), {error, not_written} = ?MUT:read_projection(Prox1, public, 44),