]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/thrift/doc/specs/thrift-protocol-spec.md
buildsys: switch source download to quincy
[ceph.git] / ceph / src / jaegertracing / thrift / doc / specs / thrift-protocol-spec.md
CommitLineData
f67539c2
TL
1Thrift Protocol Structure
2====================================================================
3
4Last Modified: 2007-Jun-29
5
6<!--
7--------------------------------------------------------------------
8
9Licensed to the Apache Software Foundation (ASF) under one
10or more contributor license agreements. See the NOTICE file
11distributed with this work for additional information
12regarding copyright ownership. The ASF licenses this file
13to you under the Apache License, Version 2.0 (the
14"License"); you may not use this file except in compliance
15with the License. You may obtain a copy of the License at
16
17 http://www.apache.org/licenses/LICENSE-2.0
18
19Unless required by applicable law or agreed to in writing,
20software distributed under the License is distributed on an
21"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22KIND, either express or implied. See the License for the
23specific language governing permissions and limitations
24under the License.
25
26--------------------------------------------------------------------
27-->
28
29This document describes the structure of the Thrift protocol
30without specifying the encoding. Thus, the order of elements
31could in some cases be rearranged depending upon the TProtocol
32implementation, but this document specifies the minimum required
33structure. There are some "dumb" terminals like STRING and INT
34that take the place of an actual encoding specification.
35
36They key point to notice is that ALL messages are just one wrapped
37`<struct>`. Depending upon the message type, the `<struct>` can be
38interpreted as the argument list to a function, the return value
39of a function, or an exception.
40
41--------------------------------------------------------------------
42
43```
44 <message> ::= <message-begin> <struct> <message-end>
45
46 <message-begin> ::= <method-name> <message-type> <message-seqid>
47
48 <method-name> ::= STRING
49
50 <message-type> ::= T_CALL | T_REPLY | T_EXCEPTION | T_ONEWAY
51
52 <message-seqid> ::= I32
53
54 <struct> ::= <struct-begin> <field>* <field-stop> <struct-end>
55
56 <struct-begin> ::= <struct-name>
57
58 <struct-name> ::= STRING
59
60 <field-stop> ::= T_STOP
61
62 <field> ::= <field-begin> <field-data> <field-end>
63
64 <field-begin> ::= <field-name> <field-type> <field-id>
65
66 <field-name> ::= STRING
67
68 <field-type> ::= T_BOOL | T_BYTE | T_I8 | T_I16 | T_I32 | T_I64 | T_DOUBLE
69 | T_STRING | T_BINARY | T_STRUCT | T_MAP | T_SET | T_LIST
70
71 <field-id> ::= I16
72
73 <field-data> ::= I8 | I16 | I32 | I64 | DOUBLE | STRING | BINARY
74 <struct> | <map> | <list> | <set>
75
76 <map> ::= <map-begin> <field-datum>* <map-end>
77
78 <map-begin> ::= <map-key-type> <map-value-type> <map-size>
79
80 <map-key-type> ::= <field-type>
81
82<map-value-type> ::= <field-type>
83
84 <map-size> ::= I32
85
86 <list> ::= <list-begin> <field-data>* <list-end>
87
88 <list-begin> ::= <list-elem-type> <list-size>
89
90<list-elem-type> ::= <field-type>
91
92 <list-size> ::= I32
93
94 <set> ::= <set-begin> <field-data>* <set-end>
95
96 <set-begin> ::= <set-elem-type> <set-size>
97
98 <set-elem-type> ::= <field-type>
99
100 <set-size> ::= I32
101```