https://github.com/sile/thrift_protocol
An Erlang implementation of Thrift protocol
https://github.com/sile/thrift_protocol
erlang thrift-protocol
Last synced: 8 months ago
JSON representation
An Erlang implementation of Thrift protocol
- Host: GitHub
- URL: https://github.com/sile/thrift_protocol
- Owner: sile
- License: mit
- Created: 2017-10-17T18:26:19.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-01-18T04:42:27.000Z (over 6 years ago)
- Last Synced: 2024-10-11T13:36:46.122Z (over 1 year ago)
- Topics: erlang, thrift-protocol
- Language: Erlang
- Size: 21.5 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
thrift_protocol
================
[](https://hex.pm/packages/thrift_protocol)
[](https://travis-ci.org/sile/thrift_protocol)
[](https://codecov.io/gh/sile/thrift_protocol/branch/master)
[](LICENSE)
An Erlang implementation of [Thrift](https://thrift.apache.org/) protocol.
[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