4 * bool Boolean, one byte
6 * i16 Signed 16-bit integer
7 * i32 Signed 32-bit integer
8 * i64 Signed 64-bit integer
9 * double 64-bit floating point value
11 * binary Blob (byte array)
12 * map<t1,t2> Map from one type to another
13 * list<t1> Ordered list of one type
14 * set<t1> Set of unique elements of one type
20 * Thrift files can reference other Thrift files to include common struct
21 * and service definitions. These are found using the current path, or by
22 * searching relative to any paths specified with the -I compiler flag.
24 * Included objects are accessed using the name of the .thrift file as a
25 * prefix. i.e. shared.SharedObject
27 //include "shared.thrift"
30 * Thrift files can namespace, package, or prefix their output in various
38 * Thrift also lets you define constants for use across languages. Complex
39 * types and structs are specified using JSON notation.
42 const i32 INT32CONSTANT = 9853
43 const map<string,string> MAPCONSTANT = {'hello':'world', 'goodnight':'moon'}
46 typedef byte MessageType
48 const MessageType HEART_BEAT = 1
49 const MessageType REGISTER = 2
50 const MessageType REGISTER_RESPONSE = 3
51 const MessageType SUBSCRIBE = 4
52 const MessageType SUBSCRIBE_RESPONSE = 5
53 const MessageType PUBLISH = 6
54 const MessageType PUBLISH_RESPONSE = 7
55 const MessageType PUSH = 8
56 const MessageType PUSH_RESPONSE = 9
57 const MessageType QUERY = 10
58 const MessageType QUERY_RESPONSE = 11
60 typedef byte ResponseCode
62 const ResponseCode SUCCESS = 1
63 const ResponseCode FAILED = 2
66 const byte OVERWRITE = 1
70 * Structs are the basic complex data structures. They are comprised of fields
71 * which each have an integer identifier, a type, a symbolic name, and an
72 * optional default value.
74 * Fields can be declared "optional", which ensures they will not be included
75 * in the serialized output if they aren't set. Note that this requires some
76 * manual management in some languages.
83 4: optional string comment,
88 * Structs can also be exceptions, if they are nasty.
91 exception InvalidOperation {
98 * Domino sends periodic heartbeats from
99 * Domino Clients and Domino Server echos
101 struct HeartBeatMessage {
102 1: MessageType messageType = HEART_BEAT,
108 * Domino Clients must first register with
109 * Domino Server. Clients can ask for a specific
110 * Unique Domino ID (UDID)
113 struct RegisterMessage {
114 1: MessageType messageType = REGISTER,
115 2: i64 domino_udid_desired,
119 6: list<string> supported_templates
122 struct RegisterResponseMessage {
123 1: MessageType messageType = REGISTER_RESPONSE,
125 3: i64 domino_udid_assigned,
127 5: ResponseCode responseCode,
128 6: optional list<string> comments
131 struct SubscribeMessage {
132 1: MessageType messageType = SUBSCRIBE,
136 5: list<string> supported_template_types,
137 6: optional byte label_op,
138 7: optional list<string> labels
141 struct SubscribeResponseMessage {
142 1: MessageType messageType = SUBSCRIBE_RESPONSE,
145 4: ResponseCode responseCode,
146 5: optional list<string> comments
149 struct PublishMessage {
150 1: MessageType messageType = PUBLISH,
153 4: string template_type,
154 5: list<string> template
157 struct PublishResponseMessage {
158 1: MessageType messageType = PUBLISH_RESPONSE,
161 4: ResponseCode responseCode,
162 5: optional list<string> comments
166 1: MessageType messageType = PUSH,
169 4: string template_type,
170 5: list<string> template
173 struct PushResponseMessage {
174 1: MessageType messageType = PUSH_RESPONSE,
177 4: ResponseCode responseCode,
178 5: optional list<string> comments
182 1: MessageType messageType = QUERY,
185 4: list<string> queryString
188 struct QueryResponseMessage{
189 1: MessageType messageType = QUERY_RESPONSE,
192 4: ResponseCode responseCode,
193 5: optional list<string> queryResponse,
196 service Communication {
199 * A method definition looks like C code. It has a return type, arguments,
200 * and optionally a list of exceptions that it may throw. Note that argument
201 * lists and exception lists are specified using the exact same syntax as
202 * field lists in struct or exception definitions.
208 HeartBeatMessage d_heartbeat(1:HeartBeatMessage msg),
209 RegisterResponseMessage d_register(1:RegisterMessage msg),
210 SubscribeResponseMessage d_subscribe(1:SubscribeMessage msg),
211 PublishResponseMessage d_publish(1:PublishMessage msg),
212 PushResponseMessage d_push(1:PushMessage msg),
213 QueryResponseMessage d_query(1:QueryMessage msg)