Skip to content

Commit

Permalink
updating TS interface to reflect new riakc
Browse files Browse the repository at this point in the history
  • Loading branch information
drewkerrigan committed Jul 25, 2016
1 parent 5d517a3 commit 2b44d5d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{reset_after_eunit, true}.

{deps, [
{riakc, ".*", {git, "git://github.com/basho/riak-erlang-client", {tag, "2.3.2-timeseries"}}},
{riakc, ".*", {git, "git://github.com/basho/riak-erlang-client", {tag, "2.4.1"}}},
{node_package, ".*", {git, "git://github.com/basho/node_package", {branch, "no-epmd"}}},
{webmachine, "1.10.*", {git, "git://github.com/basho/webmachine", {tag, "1.10.8"}}},
{ibrowse, "4.0.2", {git, "git://github.com/cmullaparthi/ibrowse.git", {tag, "v4.0.2"}}},
Expand Down
16 changes: 10 additions & 6 deletions src/re_node.erl
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ get_ts(Node, Table, Key) ->
-spec put_ts(re_node(), ts_table(), [term()]) ->
{error, term()} | ok.
put_ts(Node, Table, Rows) ->
lager:info("Putting Rows: ~p into table ~p", [Rows, Table]),
C = client(Node),
Rows1 = [ [ case V of
Rows1 = [ list_to_tuple([ case V of
null -> undefined;
_ -> V
end || V <- Vs ] || Vs <- Rows ],
end || V <- Vs ]) || Vs <- Rows ],
lager:info("Putting Rows: ~p into table ~p", [Rows1, Table]),
case riakc_ts:put(C, Table, Rows1) of
ok ->
ok;
Expand All @@ -169,13 +169,17 @@ put_ts(Node, Table, Rows) ->
{error, term()} | ts_result().
query_ts(Node, Query) ->
C = client(Node),
QueryStr = binary_to_list(Query),
lager:info("Query: ~p", [QueryStr]),
R = riakc_ts:query(C, QueryStr),
lager:info("Results: ~p", [R]),
{Fields, Rows} =
case riakc_ts:query(C, Query) of
{[],[]} ->
case R of
{ok, {[],[]}} ->
{[],[]};
{error, Reason} ->
{error, Reason};
{Fields1, TupleRows} ->
{ok, {Fields1, TupleRows}} ->
TupleToRowFun =
fun(Tuple) ->
[element(I,Tuple)
Expand Down

0 comments on commit 2b44d5d

Please sign in to comment.