Skip to content

Commit

Permalink
add hairy specs for en-/decode_cover_list/1
Browse files Browse the repository at this point in the history
  • Loading branch information
hmmr committed Apr 17, 2016
1 parent c6daf8e commit 3a6b009
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/riak_pb_ts_codec.erl
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,23 @@ decode_cells([#tscell{varchar_value = undefined,
%% Copied and modified from riak_kv_pb_coverage:convert_list. Would
%% be nice to collapse them back together, probably with a closure,
%% but time and effort.
-type ts_range() :: {FieldName::binary(),
{{StartVal::integer(), StartIncl::boolean()},
{EndVal::integer(), EndIncl::boolean()}}}.

-spec encode_cover_list({{IP::string(), Port::non_neg_integer()},
Context::binary(),
ts_range(),
SQLText::string()}) -> [#tscoverageentry{}].
encode_cover_list(Entries) ->
[#tscoverageentry{ip = IP, port = Port,
cover_context = Context,
range = encode_ts_range({Range, SQLText})}
|| {{IP, Port}, Context, Range, SQLText} <- Entries].

-spec decode_cover_list([#tscoverageentry{}]) ->
[{{IP::string(), Port::non_neg_integer()},
CoverContext::binary(), ts_range(), Text::string()}].
decode_cover_list(Entries) ->
[begin
{RangeStruct, Text} = decode_ts_range(Range),
Expand Down

0 comments on commit 3a6b009

Please sign in to comment.