An Erlang implementation of Thrift protocol.
Body =
#thrift_protocol_struct{
fields = #{1 => true, 2 => {i8, -1}}
},
Message =
#thrift_protocol_message{
method_name = <<"foo">>,
message_type = call,
sequence_id = 0,
body = Body
},
Encoded = list_to_binary(thrift_protocol:encode_message(Message, compact)),
<<130,33,0,3,102,111,111,17,19,255,0>> = Encoded,
{Decoded, <<>>} = thrift_protocol:decode_message(Encoded, compact),
Message = Decoded.
data() = boolean() | i8() | i16() | i32() | i64() | float() | binary() | struct() | thrift_map() | set() | thrift_list()
Data.
data_type() = boolean | i8 | i16 | i32 | i64 | float | binary | struct | map | set | list
Data type.
field_id() = integer()
The identifier of a struct field (16-bit signed integer).
format() = binary | compact
Protocol encoding format.
i16() = {i16, integer()}
16-bit signed integer.
i32() = {i32, integer()}
32-bit signed integer.
i64() = {i64, integer()}
64-bit signed integer.
i8() = {i8, integer()}
8-bit signed integer.
message() = #thrift_protocol_message{method_name = binary(), message_type = thrift_protocol:message_type(), sequence_id = integer(), body = thrift_protocol:struct()}
Message.
message_type() = call | reply | exception | oneway
Message type.
set() = #thrift_protocol_set{element_type = thrift_protocol:data_type(), elements = [thrift_protocol:data()]}
Set.
struct() = #thrift_protocol_struct{fields = #{}}
Struct.
thrift_list() = #thrift_protocol_list{element_type = thrift_protocol:data_type(), elements = [thrift_protocol:data()]}
List.
thrift_map() = #thrift_protocol_map{key_type = thrift_protocol:data_type() | undefined, value_type = thrift_protocol:data_type() | undefined, elements = #{}}
Map.
| data_type/1 | Returns the type of Data. |
| decode_message/2 | Decodes a message from the given binary. |
| decode_struct/2 | Decodes a struct from the given binary. |
| encode_message/2 | Encodes Message. |
| encode_struct/2 | Encodes Struct. |
data_type(Data::data()) -> data_type()
Returns the type of Data.
Decodes a message from the given binary.
Decodes a struct from the given binary.
Encodes Message.
Encodes Struct.
Generated by EDoc, Jan 18 2020, 13:40:49.