JIRA: DOMINO-27 Extend publish RPC call
[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: string 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: string 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: string domino_udid,
125  3: string 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: string 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: string 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: string domino_udid,
152  3: i64 seq_no,
153  4: string template_type,
154  5: list<string> template,
155  6: optional string template_UUID
156 }
157
158 struct DomainInfo {
159  1: string ipaddr,
160  2: i16 tcpport
161 }
162
163 struct PublishResponseMessage {
164  1: MessageType messageType = PUBLISH_RESPONSE,
165  2: string domino_udid,
166  3: i64 seq_no,
167  4: ResponseCode responseCode,
168  5: string template_UUID,
169  6: optional list<DomainInfo> domainInfo,
170  7: optional list<string> comments
171 }
172
173 struct PushMessage {
174  1: MessageType messageType = PUSH,
175  2: string domino_udid,
176  3: i64 seq_no,
177  4: string template_type,
178  5: list<string> template,
179  6: string template_UUID
180 }
181
182 struct PushResponseMessage {
183  1: MessageType messageType = PUSH_RESPONSE,
184  2: string domino_udid,
185  3: i64 seq_no,
186  4: ResponseCode responseCode,
187  5: optional list<string> comments
188 }
189
190 struct QueryMessage{
191  1: MessageType messageType = QUERY,
192  2: string domino_udid,
193  3: i64 seq_no,
194  4: list<string> queryString,
195  5: optional string template_UUID 
196 }
197
198 struct QueryResponseMessage{
199  1: MessageType messageType = QUERY_RESPONSE,
200  2: string domino_udid,
201  3: i64 seq_no,
202  4: ResponseCode responseCode,
203  5: optional list<string> queryResponse
204 }
205
206 service Communication {
207
208   /**
209    * A method definition looks like C code. It has a return type, arguments,
210    * and optionally a list of exceptions that it may throw. Note that argument
211    * lists and exception lists are specified using the exact same syntax as
212    * field lists in struct or exception definitions.
213    */
214
215    //void ping(),
216    
217
218    HeartBeatMessage d_heartbeat(1:HeartBeatMessage msg),
219    RegisterResponseMessage d_register(1:RegisterMessage msg),
220    SubscribeResponseMessage d_subscribe(1:SubscribeMessage msg),
221    PublishResponseMessage d_publish(1:PublishMessage msg),     
222    PushResponseMessage d_push(1:PushMessage msg),
223    QueryResponseMessage d_query(1:QueryMessage msg)
224 }