Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A copy of HTTP client API for TS (#1371) #1382

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
876d503
make DESRIBE query return compliant table
Apr 12, 2016
a105ff9
Merge branch 'riak_ts-develop' of github.com:basho/riak_kv into riak_…
Apr 12, 2016
5dfb737
Create riak_ts-develop-1.3
Feb 11, 2016
ee0a624
move code to be shared between riak_kv_{wm,pb}_timeseries, to _ts_util
Feb 3, 2016
a4dc076
riak_kv_qry: filter out empty records
Feb 4, 2016
2f2a30e
http client for TS
Feb 3, 2016
ac9f6cf
detect and deal with {error,no_type} (table not acivated case)
Feb 16, 2016
f26b4b2
make TS query served from own WM resource
Feb 17, 2016
3799fd8
ignore non-relevant parameters in json for TS calls
Feb 17, 2016
e772bf7
repin bitcask, other deps back to riak_ts-develop
Feb 17, 2016
99f1234
filter empty records at collection site in riak_kv_qry_worker
Feb 24, 2016
b8fd553
wm_timeseries: also support keys in url for get & delete
Feb 26, 2016
8186169
wm_timeseries: disable key-fields-in-json-body mode for TS get and de…
Feb 26, 2016
8380e07
wm_timeseries: use POST for batch puts
Feb 26, 2016
2d07562
collect internal TS API functions into riak_kv_ts_api
Feb 27, 2016
e58965a
cumulative update including
Mar 1, 2016
5434dcd
dispatch all api_call branches per method, from one validate_request fun
Mar 1, 2016
b28a22b
avoid case clauses in favour of function clauses
Mar 1, 2016
b34c8c9
encode data for batch put as is, not at "data" key in a proplist
Mar 1, 2016
a7cabee
wm_timeseries: simplify batch put data extraction from json
Mar 2, 2016
fc107f8
WIP - Total rewrite of riak_kv_wm_timeseries
Mar 8, 2016
b6a65f2
amend create_table code path to take into account WITH-props
Apr 4, 2016
8f9e5b0
fix dialyzer warnings
Apr 4, 2016
5077a02
wm_timeseries_listkeys: urlencode URLs^W keys
Apr 7, 2016
990c313
wm_timeseries_listkeys: deal with sint64 and double, too
Apr 7, 2016
7e59bdb
have ts_util:queried_table/1 extract Table from a DDL
Apr 8, 2016
4de1bfa
wm_timeseries: cumulative commit to fix the following:
Apr 8, 2016
3a63e02
post-rebase fixups
Apr 10, 2016
d628e8f
whitespace and indents
Apr 11, 2016
5405465
move INSERT query code into riak_kv_qry
Apr 11, 2016
9877ef0
move some types from riak_kv_ts.hrl to riak_kv_pb_svc.erl, and export
Apr 11, 2016
9656039
move PB error code defines to riak_kv_ts_svc (unused elsewhere)
Apr 11, 2016
8a3084c
riak_kv_ts_svc: uniformly rename make_*_resp helper funs
Apr 11, 2016
1ca685f
don't argue with dialyzer, esp. when it smells matching on records
Apr 11, 2016
a7e3e0c
ts_api:query now returns uniform {ColNs, ColTs, Rows} for describe, too
Apr 11, 2016
5aef97d
return [], not 'undefined' for NULL in DESCRIBE query
Apr 12, 2016
d44c072
don't bother exporting ddl bucket type property for non-TS clients
Apr 11, 2016
b87d673
more accurately handle lexer errors
Apr 11, 2016
245f3f1
ensure #rpberrorresp.msg only carries binaries, not strings
Apr 11, 2016
3dcfb3e
properly assemble ts{query,get}resp wrt ColNames, ColTypes
Apr 12, 2016
2b803bb
make query returned table have rows as tuples
Apr 14, 2016
333c358
slightly optimise riak_kv_ts_util:validate_rows
Apr 13, 2016
219b1dc
don't deal with #tscoverageresp internal structs in riak_kv
Apr 13, 2016
ddf2be5
Merge branch 'riak_ts-develop' of github.com:basho/riak_kv into riak_…
Apr 14, 2016
76b50b0
Merge branch 'riak_ts-develop' into fixup-az-rebase_th_http_client_on…
Apr 15, 2016
df692b0
qry_compiler: report too_many_subqueries with a binary description
Apr 15, 2016
d319e16
correctly report INSERT query errors
Apr 15, 2016
8448c0c
query compiler errors should be treated as E_SUBMIT (1001)
Apr 15, 2016
ba974c2
ts_util: let validate_rows handle any()
Apr 15, 2016
1288556
do list_to_tuple after riak_kv_api:query, avoid re-converting for wm_ts
Apr 15, 2016
467d814
fix list_keys for short keys
Apr 15, 2016
549d98b
fix tuple-list-tuple conversion-related eunit tests once again
Apr 15, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions include/riak_kv_ts.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,4 @@
helper_mod :: atom()
}).

-type ts_requests() :: #tsputreq{} | #tsdelreq{} | #tsgetreq{} |
#tslistkeysreq{} | #tsqueryreq{}.
-type ts_responses() :: #tsputresp{} | #tsdelresp{} | #tsgetresp{} |
#tslistkeysresp{} | #tsqueryresp{} |
#rpberrorresp{}.
-type ts_get_response() :: {tsgetresp, {list(binary()), list(atom()), list(list(term()))}}.
-type ts_query_response() :: {tsqueryresp, {list(binary()), list(atom()), list(list(term()))}}.
-type ts_query_responses() :: #tsqueryresp{} | ts_query_response().
-type ts_query_types() :: ?DDL{} | ?SQL_SELECT{} | #riak_sql_describe_v1{} |
#riak_sql_insert_v1{}.
-endif.
26 changes: 0 additions & 26 deletions include/riak_kv_ts_svc.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,6 @@
-ifndef(RIAK_KV_TS_SVC_HRL).
-define(RIAK_KV_TS_SVC_HRL, included).

%% per RIAK-1437, error codes assigned to TS are in the 1000-1500 range
-define(E_SUBMIT, 1001).
-define(E_FETCH, 1002).
-define(E_IRREG, 1003).
-define(E_PUT, 1004).
-define(E_NOCREATE, 1005). %% unused
-define(E_NOT_TS_TYPE, 1006).
-define(E_MISSING_TYPE, 1007).
-define(E_MISSING_TS_MODULE, 1008).
-define(E_DELETE, 1009).
-define(E_GET, 1010).
-define(E_BAD_KEY_LENGTH, 1011).
-define(E_LISTKEYS, 1012).
-define(E_TIMEOUT, 1013).
-define(E_CREATE, 1014).
-define(E_CREATED_INACTIVE, 1015).
-define(E_CREATED_GHOST, 1016).
-define(E_ACTIVATE, 1017).
-define(E_BAD_QUERY, 1018).
-define(E_TABLE_INACTIVE, 1019).
-define(E_PARSE_ERROR, 1020).
-define(E_NOTFOUND, 1021).

-define(FETCH_RETRIES, 10). %% TODO make it configurable in tsqueryreq
-define(TABLE_ACTIVATE_WAIT, 30). %% ditto

-record(state, {
req,
req_ctx,
Expand Down
30 changes: 17 additions & 13 deletions src/riak_kv_pb_ts.erl
Original file line number Diff line number Diff line change
Expand Up @@ -42,31 +42,31 @@ init() ->
#state{}.

-spec decode(integer(), binary()) ->
{ok, ts_requests(), {PermSpec::string(), Table::binary()}} |
{ok, riak_kv_ts_svc:ts_requests(), {PermSpec::string(), Table::binary()}} |
{error, _}.
decode(Code, Bin) when Code >= 90, Code =< 103 ->
Msg = riak_pb_codec:decode(Code, Bin),
case Msg of
#tsqueryreq{query = Q, cover_context = Cover} ->
riak_kv_ts_svc:decode_query_common(Q, Cover);
#tsgetreq{table = Table}->
{ok, Msg, {"riak_kv.ts_get", Table}};
{ok, Msg, {riak_kv_ts_api:api_call_to_perm(get), Table}};
#tsputreq{table = Table} ->
{ok, Msg, {"riak_kv.ts_put", Table}};
{ok, Msg, {riak_kv_ts_api:api_call_to_perm(put), Table}};
#tsdelreq{table = Table} ->
{ok, Msg, {"riak_kv.ts_del", Table}};
{ok, Msg, {riak_kv_ts_api:api_call_to_perm(delete), Table}};
#tslistkeysreq{table = Table} ->
{ok, Msg, {"riak_kv.ts_listkeys", Table}};
{ok, Msg, {riak_kv_ts_api:api_call_to_perm(listkeys), Table}};
#tscoveragereq{table = Table} ->
{ok, Msg, {"riak_kv.ts_cover", Table}}
{ok, Msg, {riak_kv_ts_api:api_call_to_perm(coverage), Table}}
end.

-spec encode(tuple()) -> {ok, iolist()}.
encode(Message) ->
{ok, riak_pb_codec:encode(Message)}.

-spec process(atom() | ts_requests() | ts_query_types(), #state{}) ->
{reply, ts_responses(), #state{}}.
-spec process(atom() | riak_kv_ts_svc:ts_requests() | riak_kv_ts_svc:ts_query_types(), #state{}) ->
{reply, riak_kv_ts_svc:ts_responses(), #state{}}.
process(Request, State) ->
encode_response(riak_kv_ts_svc:process(Request, State)).

Expand All @@ -76,16 +76,20 @@ process_stream(Message, ReqId, State) ->
riak_kv_ts_svc:process_stream(Message, ReqId, State).

encode_response({reply, {tsqueryresp, {_, _, []}}, State}) ->
Encoded = #tsqueryresp{columns=[], rows=[]},
Encoded = #tsqueryresp{columns = {[], []}, rows = []},
{reply, Encoded, State};
encode_response({reply, {tsqueryresp, {CNames, CTypes, Rows}}, State}) ->
Encoded = #tsqueryresp{columns=riak_pb_ts_codec:encode_columns(CNames, CTypes),
rows=riak_pb_ts_codec:encode_rows(CTypes, Rows)},
Encoded = #tsqueryresp{columns = riak_pb_ts_codec:encode_columns(CNames, CTypes),
rows = riak_pb_ts_codec:encode_rows(CTypes, Rows)},
{reply, Encoded, State};
encode_response({reply, {tsgetresp, {CNames, CTypes, Rows}}, State}) ->
C = riak_pb_ts_codec:encode_columns(CNames, CTypes),
R = riak_pb_ts_codec:encode_rows(CTypes, Rows),
Encoded = #tsgetresp{columns=C, rows=R},
Encoded = #tsgetresp{columns = C, rows = R},
{reply, Encoded, State};

encode_response({reply, {tscoverageresp, Entries}, State}) ->
Encoded = #tscoverageresp{entries = riak_pb_ts_codec:encode_cover_list(Entries)},
{reply, Encoded, State};
encode_response(Response) ->
Response.
Response.
Loading