Thrift binary protocol
From Just Solve the File Format Problem
(Difference between revisions)
(Created page with "{{FormatInfo |formattype=electronic |subcat=Serialization |released=2007 }} Apache Thrift, a serialization/RPC system with much more emphasis on RPC than serialization, ca...") |
(Removed no-longer-relevant (after further research in the course of writing the page) remark) |
||
(One intermediate revision by one user not shown) | |||
Line 7: | Line 7: | ||
== Identification == | == Identification == | ||
− | In the new<ref name="commit">Commit 589859984f43af1ed0f9ee45ce8374a0d1640813</ref> ("strict") header type, binary protocol files start with a one-byte message type, a zero byte, and then the version indicator <code>0x01 0x00 0x00 0x08</code>.<ref>Thrift source → /lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java → definition of VERSION_MASK and VERSION_1, and of writeMessageBegin(). https://stackoverflow.com/questions/8402479/error-while-compiling-thrift-server indicates that the version/size integer is presumably stored [[endianness|little-endian]].</ref>. | + | In the new<ref name="commit">Commit 589859984f43af1ed0f9ee45ce8374a0d1640813</ref> ("strict") header type, binary protocol files start with a one-byte message type, a zero byte, and then the version indicator <code>0x01 0x00 0x00 0x08</code>.<ref>Thrift source → /lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java → definition of VERSION_MASK and VERSION_1, and of writeMessageBegin(). https://stackoverflow.com/questions/8402479/error-while-compiling-thrift-server indicates that the version/size integer is presumably stored [[endianness|little-endian]].</ref>. This is followed by an encoded string (a 32-bit length and series of bytes) and a 32-bit sequence ID.<ref>Thrift source → /lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java → readMessageBegin(); /lib/java/src/org/apache/thrift/protocol/TMessage.java</ref> |
In the old<ref name="commit" /> (non-"strict") header type, the message begins with the encoded string of the message name, followed by the type byte, followed by a 32-bit sequence ID.<ref>Thrift source → /lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java → readMessageBegin()</ref> | In the old<ref name="commit" /> (non-"strict") header type, the message begins with the encoded string of the message name, followed by the type byte, followed by a 32-bit sequence ID.<ref>Thrift source → /lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java → readMessageBegin()</ref> | ||
Line 19: | Line 19: | ||
<references /> | <references /> | ||
+ | [[Category:Apache]] | ||
[[Category:Facebook]] | [[Category:Facebook]] |
Latest revision as of 05:25, 20 May 2019
Apache Thrift, a serialization/RPC system with much more emphasis on RPC than serialization, calls its serialization formats "protocols"; the oldest Thrift-specific protocol is the "binary" protocol, while the newer one is the "compact" protocol.[1]
[edit] Identification
In the new[2] ("strict") header type, binary protocol files start with a one-byte message type, a zero byte, and then the version indicator 0x01 0x00 0x00 0x08
.[3]. This is followed by an encoded string (a 32-bit length and series of bytes) and a 32-bit sequence ID.[4]
In the old[2] (non-"strict") header type, the message begins with the encoded string of the message name, followed by the type byte, followed by a 32-bit sequence ID.[5]
[edit] Links
[edit] References
- ↑ https://thrift.apache.org/docs/concepts#protocol
- ↑ 2.0 2.1 Commit 589859984f43af1ed0f9ee45ce8374a0d1640813
- ↑ Thrift source → /lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java → definition of VERSION_MASK and VERSION_1, and of writeMessageBegin(). https://stackoverflow.com/questions/8402479/error-while-compiling-thrift-server indicates that the version/size integer is presumably stored little-endian.
- ↑ Thrift source → /lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java → readMessageBegin(); /lib/java/src/org/apache/thrift/protocol/TMessage.java
- ↑ Thrift source → /lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java → readMessageBegin()