Removed trailing white spaces in api-documentation.rst
[domino.git] / domino.thrift
1 /**
2  * Thrift types:
3  *
4  *  bool        Boolean, one byte
5  *  byte        Signed 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
10  *  string      String
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
15  *
16  */
17
18
19 /**
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.
23  *
24  * Included objects are accessed using the name of the .thrift file as a
25  * prefix. i.e. shared.SharedObject
26  */
27 //include "shared.thrift"
28
29 /**
30  * Thrift files can namespace, package, or prefix their output in various
31  * target languages.
32  */
33 namespace cpp domino
34 namespace py domino
35 namespace java domino
36
37 /**
38  * Thrift also lets you define constants for use across languages. Complex
39  * types and structs are specified using JSON notation.
40  */
41 /*
42 const i32 INT32CONSTANT = 9853
43 const map<string,string> MAPCONSTANT = {'hello':'world', 'goodnight':'moon'}
44 */
45
46 typedef byte MessageType
47
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
59
60 typedef byte ResponseCode
61
62 const ResponseCode SUCCESS = 1
63 const ResponseCode FAILED = 2
64
65 const byte APPEND = 0
66 const byte OVERWRITE = 1
67 const byte DELETE = 2
68
69 /**
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.
73  *
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.
77  */
78 /*
79 struct Work {
80   1: i32 num1 = 0,
81   2: i32 num2,
82   3: Operation op,
83   4: optional string comment,
84 }
85 */
86
87 /**
88  * Structs can also be exceptions, if they are nasty.
89  */
90 /*
91 exception InvalidOperation {
92   1: i32 whatOp,
93   2: string why
94 }
95 */
96
97 /**
98 * Domino sends periodic heartbeats from 
99 * Domino Clients and Domino Server echos
100 */
101 struct HeartBeatMessage {
102  1: MessageType messageType = HEART_BEAT,
103  2: i64 domino_udid,
104  3: i64 seq_no  
105 }
106
107 /**
108 * Domino Clients must first register with 
109 * Domino Server. Clients can ask for a specific
110 * Unique Domino ID (UDID)
111 */
112
113 struct RegisterMessage {
114  1: MessageType messageType = REGISTER,
115  2: i64 domino_udid_desired,
116  3: i64 seq_no,
117  4: string ipaddr,
118  5: i16 tcpport,
119  6: list<string> supported_templates 
120 }
121
122 struct RegisterResponseMessage {
123  1: MessageType messageType = REGISTER_RESPONSE,
124  2: i64 domino_udid,
125  3: i64 domino_udid_assigned,
126  4: i64 seq_no,
127  5: ResponseCode responseCode,
128  6: optional list<string> comments
129 }
130
131 struct SubscribeMessage {
132  1: MessageType messageType = SUBSCRIBE,
133  2: i64 domino_udid,
134  3: i64 seq_no,
135  4: byte template_op, 
136  5: list<string> supported_template_types,
137  6: optional byte label_op,
138  7: optional list<string> labels
139 }
140
141 struct SubscribeResponseMessage {
142  1: MessageType messageType = SUBSCRIBE_RESPONSE,
143  2: i64 domino_udid,
144  3: i64 seq_no,
145  4: ResponseCode responseCode,
146  5: optional list<string> comments
147 }
148
149 struct PublishMessage {
150  1: MessageType messageType = PUBLISH,
151  2: i64 domino_udid,
152  3: i64 seq_no,
153  4: string template_type,
154  5: list<string> template
155 }
156
157 struct PublishResponseMessage {
158  1: MessageType messageType = PUBLISH_RESPONSE,
159  2: i64 domino_udid,
160  3: i64 seq_no,
161  4: ResponseCode responseCode,
162  5: optional list<string> comments
163 }
164
165 struct PushMessage {
166  1: MessageType messageType = PUSH,
167  2: i64 domino_udid,
168  3: i64 seq_no,
169  4: string template_type,
170  5: list<string> template
171 }
172
173 struct PushResponseMessage {
174  1: MessageType messageType = PUSH_RESPONSE,
175  2: i64 domino_udid,
176  3: i64 seq_no,
177  4: ResponseCode responseCode,
178  5: optional list<string> comments
179 }
180
181 struct QueryMessage{
182  1: MessageType messageType = QUERY,
183  2: i64 domino_udid,
184  3: i64 seq_no,
185  4: list<string> queryString
186 }
187
188 struct QueryResponseMessage{
189  1: MessageType messageType = QUERY_RESPONSE,
190  2: i64 domino_udid,
191  3: i64 seq_no,
192  4: ResponseCode responseCode,
193  5: optional list<string> queryResponse,
194 }
195
196 service Communication {
197
198   /**
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.
203    */
204
205    //void ping(),
206    
207
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)
214 }