Skip to content
Permalink
Browse files
Update README.md
  • Loading branch information
sile committed Oct 18, 2017
1 parent cfbe8dc commit 5532c18d585cb93c891f76c45d100363d5ec0e03
Showing 1 changed file with 41 additions and 5 deletions.
@@ -1,9 +1,45 @@
thrift_protocol
=====
================

An OTP library
[![hex.pm version](https://img.shields.io/hexpm/v/thrift_protocol.svg)](https://hex.pm/packages/thrift_protocol)
[![Build Status](https://travis-ci.org/sile/thrift_protocol.svg?branch=master)](https://travis-ci.org/sile/thrift_protocol)
[![Code Coverage](https://codecov.io/gh/sile/thrift_protocol/branch/master/graph/badge.svg)](https://codecov.io/gh/sile/thrift_protocol/branch/master)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

Build
-----
An Erlang implementation of [Thrift](https://thrift.apache.org/) protocol.

$ rebar3 compile
[Documentation](https://hexdocs.pm/thrift_protocol/)

Examples
---------

```erlang
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.
```

References
-----------

- [Thrift Protocol Structure][protocol-structure]
- [Thrift Binary protocol encoding][binary-encoding]
- [Thrift Compact protocol encoding][compact-encoding]

[protocol-structure]: https://github.com/apache/thrift/blob/master/doc/specs/thrift-protocol-spec.md
[binary-encoding]: https://github.com/apache/thrift/blob/master/doc/specs/thrift-binary-protocol.md
[compact-encoding]: https://github.com/apache/thrift/blob/master/doc/specs/thrift-compact-protocol.md

0 comments on commit 5532c18

Please sign in to comment.