Module riak_pb_ts_codec

Utility functions for decoding and encoding Protocol Buffers messages related to Riak TS.

Description

Utility functions for decoding and encoding Protocol Buffers messages related to Riak TS.

Data Types

ldbvalue()

ldbvalue() = binary() | number() | boolean() | list()

ts_range()

ts_range() = {FieldName::binary(), {{StartVal::integer(), StartIncl::boolean()}, {EndVal::integer(), EndIncl::boolean()}}}

tscolumnname()

tscolumnname() = binary()

Possible column type values supported and returned from the timeseries DDL.

tscolumntype()

tscolumntype() = varchar | sint64 | timestamp | boolean | double | blob

Possible column type values that protocol buffers supports for enumeration purposes.

tscolumntypePB()

tscolumntypePB() = 'VARCHAR' | 'SINT64' | 'TIMESTAMP' | 'BOOLEAN' | 'DOUBLE' | 'BLOB'

tsrow()

tsrow() = #tsrow{cells = [#tscell{varchar_value = binary() | undefined, sint64_value = integer() | undefined, timestamp_value = integer() | undefined, boolean_value = boolean() | 0 | 1 | undefined, double_value = float() | integer() | infinity | '-infinity' | nan | undefined}]}

Function Index

decode_cells/1Decode a list of timeseries #tscell{} to a list of ldbvalue().
decode_cover_list/1
decode_rows/1Decode a list of timeseries #tsrow{} to a list of tuples.
encode_cells/1
encode_cells_non_strict/1Only for encoding cells for PUTs on the erlang client, and Key cells for get / delete requests.
encode_columnnames/1Convert a list of column names to partial #tscolumndescription records.
encode_columns/2
encode_cover_list/1
encode_field_type/1Convert time series field type atoms returned from the DDL modules into Protobuf compatible upper case atoms.
encode_rows/2Encode a set of time series rows from an internal format to the #tsrow record format.
encode_rows_non_strict/1Only for encoding rows for PUTs on the erlang client.

Function Details

decode_cells/1

decode_cells(Cells::[#tscell{varchar_value = binary() | undefined, sint64_value = integer() | undefined, timestamp_value = integer() | undefined, boolean_value = boolean() | 0 | 1 | undefined, double_value = float() | integer() | infinity | '-infinity' | nan | undefined}]) -> [ldbvalue()]

Decode a list of timeseries #tscell{} to a list of ldbvalue().

decode_cover_list/1

decode_cover_list(Entries::[#tscoverageentry{ip = binary(), port = non_neg_integer(), cover_context = binary(), range = #tsrange{field_name = binary(), lower_bound = integer(), lower_bound_inclusive = boolean() | 0 | 1, upper_bound = integer(), upper_bound_inclusive = boolean() | 0 | 1, desc = binary()} | undefined}]) -> [{{IP::string(), Port::non_neg_integer()}, CoverContext::binary(), ts_range(), Text::binary()}]

decode_rows/1

decode_rows(Rows::[#tsrow{cells = [#tscell{varchar_value = binary() | undefined, sint64_value = integer() | undefined, timestamp_value = integer() | undefined, boolean_value = boolean() | 0 | 1 | undefined, double_value = float() | integer() | infinity | '-infinity' | nan | undefined}]}]) -> [{ldbvalue()}]

Decode a list of timeseries #tsrow{} to a list of tuples. Each row is converted through decode_cells/1, and the list of ldbvalue() is converted to a tuple of ldbvalue().

encode_cells/1

encode_cells(Cells::[{tscolumntype(), ldbvalue()}]) -> [#tscell{varchar_value = binary() | undefined, sint64_value = integer() | undefined, timestamp_value = integer() | undefined, boolean_value = boolean() | 0 | 1 | undefined, double_value = float() | integer() | infinity | '-infinity' | nan | undefined}]

encode_cells_non_strict/1

encode_cells_non_strict(Cells::[ldbvalue()] | {ldbvalue()}) -> [#tscell{varchar_value = binary() | undefined, sint64_value = integer() | undefined, timestamp_value = integer() | undefined, boolean_value = boolean() | 0 | 1 | undefined, double_value = float() | integer() | infinity | '-infinity' | nan | undefined}]

Only for encoding cells for PUTs on the erlang client, and Key cells for get / delete requests. Will not properly encode timestamp #tscell{} records, but this is OK for these use cases since the values get cast in the order of: lvldbvalue() -> #tscell{} -> lvldbvalue(). THEREFORE no info is lost for these cases.

encode_columnnames/1

encode_columnnames(ColumnNames::[tscolumnname()]) -> [#tscolumndescription{name = binary(), type = 'VARCHAR' | 'SINT64' | 'DOUBLE' | 'TIMESTAMP' | 'BOOLEAN' | 'BLOB' | integer()}]

Convert a list of column names to partial #tscolumndescription records.

encode_columns/2

encode_columns(ColumnNames::[binary()], ColumnTypes::[riak_pb_ts_codec:tscolumntype()]) -> [#tscolumndescription{name = binary(), type = 'VARCHAR' | 'SINT64' | 'DOUBLE' | 'TIMESTAMP' | 'BOOLEAN' | 'BLOB' | integer()}]

encode_cover_list/1

encode_cover_list(Entries::[{{IP::string(), Port::non_neg_integer()}, Context::binary(), ts_range(), SQLText::binary()}]) -> [#tscoverageentry{ip = binary(), port = non_neg_integer(), cover_context = binary(), range = #tsrange{field_name = binary(), lower_bound = integer(), lower_bound_inclusive = boolean() | 0 | 1, upper_bound = integer(), upper_bound_inclusive = boolean() | 0 | 1, desc = binary()} | undefined}]

encode_field_type/1

encode_field_type(X1::tscolumntype()) -> atom()

Convert time series field type atoms returned from the DDL modules into Protobuf compatible upper case atoms.

encode_rows/2

encode_rows(ColumnTypes::[tscolumntype()], Rows::[{ldbvalue()}] | [[ldbvalue()]]) -> [#tsrow{cells = [#tscell{varchar_value = binary() | undefined, sint64_value = integer() | undefined, timestamp_value = integer() | undefined, boolean_value = boolean() | 0 | 1 | undefined, double_value = float() | integer() | infinity | '-infinity' | nan | undefined}]}]

Encode a set of time series rows from an internal format to the #tsrow record format. Takes a list of column types, and a list of rows. Each row is represented as a list of ldbvalue(). An error is returned if any of the Rows individual row length do not match the length of the ColumnTypes list.

encode_rows_non_strict/1

encode_rows_non_strict(Rows) -> any()

Only for encoding rows for PUTs on the erlang client. Will not properly encode timestamp #tscell{} records, but this is OK for this use case since the values get cast in the order of: lvldbvalue() -> #tscell{} -> lvldbvalue(). THEREFORE no info is lost for these cases.


Generated by EDoc