[
https://issues.apache.org/jira/browse/THRIFT-2457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13980838#comment-13980838
]
Jens Geyer edited comment on THRIFT-2457 at 4/25/14 9:35 AM:
-------------------------------------------------------------
Just to follow up on the type code thoughts:
A better type code would separate the two aspects *content* and *size*,
something like this:
{code}
bits: 0 101 0101
meaning: reserved ----+ | +------ content type
size
{code}
- {{size}} is a 3-bit number indicating the number of bytes to skip: 0, 1, 2,
4, 8, 16, BLOB (= 7 values, one bit combination left)
- BLOB is for values with variable size, such as {{string}} and {{binary}}.
The actual size is indicated in a protocol-dependent, well-defined way here.
- {{content}} is a 4-bit number indicating the content type of the field, e.g.
{{float}}, {{i32}}, {{bool}}, {{byte}}, etc. The content type bits must be
interpreted in conunction with the size bits, otherwise we would be limited to
16 values and had a lot of invalid comibations, which is obviously bad.
- the reserved bit leaves room for future extensions of the type code
Example:
Given {{float}} is a 4-byte value and we already have {{i32}}, the content type
would probably be {{0x01}}, while the size code would be {{3 shl 4 = 0x30}}, so
we get a type code of {{0x31}} form float.
This allows for adding new types without breaking the skip mechanism for older
clients/servers.
was (Author: jensg):
Just to follow up on the type code thoughts:
A better type code would separate the two aspects *content* and *size*,
something like this:
{code}
bits: 0 101 0101
meaning: reserved ----+ | +------ content type
size
{code}
- {{size}} is a 3-bit number indicating the number of bytes to skip: 0, 1, 2,
4, 8, 16, BLOB (= 7 values, one bit combination left)
- BLOB is for values with variable size, such as {{string}} and {{binary}}.
The actual size is indicated in a protocol-dependent, well-defined way here.
- {{content}} is a 4-bit number indicating the content type of the field, e.g.
{{float}}, {{i32}}, {{bool}}, {{byte}}, etc.
- the reserved bit leaves room for future extensions of the type code
This allows for adding new types without breaking the skip mechanism for older
clients/servers.
> fbthrift float
> --------------
>
> Key: THRIFT-2457
> URL: https://issues.apache.org/jira/browse/THRIFT-2457
> Project: Thrift
> Issue Type: Sub-task
> Components: Build Process, C++ - Compiler, C++ - Library, Test Suite
> Reporter: Roger Meier
> Priority: Minor
> Fix For: 1.0
>
>
> I'm interested into the fbthrift FLOAT data type.
> Which languages are supported?
--
This message was sent by Atlassian JIRA
(v6.2#6252)