I've been thinking about Thrift and D-BUS ever since I made this post:
Java and XML, bad tastes that are worse together. And then I followed up with a reference to my paper:
why CORBA and other forms of RPC are a bad idea.
Those, of course, sparked a lot of discussion. Questioning Java and XML, the darlings of 'Enterprise' computing, would hardly
(
Read more... )
Type tags are lowercase if there is no field id, uppercase if there is. The field id is always a count and always comes immediately after the type tag. All fields in a tuple must either have or not have a field id (i.e. their type tags must all be uppercase or lowercase).
't' aka Tuple
A grouping of values.
'c' aka Count
Something countable, but not just an arbitrary integer with no meaning.
'u' aka UTF-8
A single, UTF-8 encoded character.
'm' an multi-precision integer
An arbitrary sized integer.
'b' binary
A blob of binary data
's' string
A sequence of UTF-8 encoded characters.
'i' integer 8
An 8-bit two's complement integer (may also be used for bitfields)
'j' integer 16
A 16-bit two's complement integer (may also be used for bitfields)
'k' integer 32
A 32-bit two's complement integer (may also be used for bitfields)
'l' integer 64
A 64-bit two's complement integer (may also be used for bitfields)
'f' floating
A 64 bit floating point number.
'g' giant floating
A 128 bit floating point number.
'h' half-size floating
A 32 bit floating point number.
'a' an array
Array's, lists and sets are largely indistinguishable in how they look on the wire, and so they are all represented by an array. Array's are not length delimited, there is a flag before each element saying whether or not it's the last one.
'n' a known length array
Like an array, but prefixed with a count and no flag before each element.
'd' a dictionary
A mapping from keys to values.
'r' random type
This is what's used in a type field for an array, tuple or dictionary when one of the types is not known. The expectation is that the element will be prefixed with a type tag.
Reply
A field id is considered part of a type id. If a type id is a capital letter, then it is immediately followed by a count containing the field id.
Here is a description of the encodings which include type ids in their encoding. Note that only the tuple allows a type id that includes a field id.
Note also that the 'random' type does not allow a field id for it's enclosed type because the field id (if any) should've been applied to where the type id for the random type occured. If the random type allowed a field id for its enclosed type then you could just say an array or dictionary contained a random type and then put meaningless field ids for all the elements.
Tuple (type tag 't')
t<count of # of fields>......
Array (type tag 'a')
a\000...\001
Known length array (type tag 'n')
n<count of elements>...
Dictionary (type tag 'd')
d\000...\001
Variant type (type tag 'v')
Reply
Leave a comment