From 86a53e249df244e3210529257d9fdb3f143db2cf Mon Sep 17 00:00:00 2001 From: Andrei Zavada Date: Fri, 15 Apr 2016 09:03:41 +0300 Subject: [PATCH 1/2] tabs spotted --- src/riakc_ts.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/riakc_ts.erl b/src/riakc_ts.erl index 422486fe..d1332ca9 100644 --- a/src/riakc_ts.erl +++ b/src/riakc_ts.erl @@ -75,9 +75,9 @@ query(Pid, Query, Interpolations, Cover) -> %% list of values, in the second element, or an @{error, Reason@} %% tuple. query(Pid, Query, Interpolations, undefined, Options) -> - query_common(Pid, Query, Interpolations, undefined, Options); + query_common(Pid, Query, Interpolations, undefined, Options); query(Pid, Query, Interpolations, Cover, Options) when is_binary(Cover) -> - query_common(Pid, Query, Interpolations, Cover, Options). + query_common(Pid, Query, Interpolations, Cover, Options). query_common(Pid, Query, Interpolations, Cover, Options) when is_pid(Pid), is_list(Query) -> From bff6899001da0d444ddf97ed2f19a98464a304e5 Mon Sep 17 00:00:00 2001 From: Andrei Zavada Date: Fri, 15 Apr 2016 09:04:22 +0300 Subject: [PATCH 2/2] decode get_coverage return value --- src/riakc_ts.erl | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/riakc_ts.erl b/src/riakc_ts.erl index d1332ca9..9ba3c4e2 100644 --- a/src/riakc_ts.erl +++ b/src/riakc_ts.erl @@ -90,14 +90,19 @@ query_common(Pid, Query, Interpolations, Cover, Options) %% @doc Generate a parallel coverage plan for the specified query --spec get_coverage(Pid::pid(), - Table::binary(), - QueryText::binary()) -> {ok, Entries::[term()]} | {error, term()} | {'EXIT', any()}. -get_coverage(Pid, Table, QueryText) -> - server_call(Pid, - #tscoveragereq{query = #tsinterpolation{base = iolist_to_binary(QueryText)}, - replace_cover = undefined, - table = iolist_to_binary(Table)}). +-spec get_coverage(pid(), table_name(), QueryText::iolist()) -> + {ok, Entries::[term()]} | {error, term()}. +get_coverage(Pid, Table, Query) -> + Message = + #tscoveragereq{query = #tsinterpolation{base = iolist_to_binary(Query)}, + replace_cover = undefined, + table = iolist_to_binary(Table)}, + case server_call(Pid, Message) of + {ok, Entries} -> + {ok, riak_pb_ts_codec:decode_cover_list(Entries)}; + {error, Reason} -> + {error, Reason} + end. -spec put(pid(),