]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/thrift/test/DebugProtoTest.thrift
buildsys: switch source download to quincy
[ceph.git] / ceph / src / jaegertracing / thrift / test / DebugProtoTest.thrift
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20 namespace c_glib TTest
21 namespace cpp thrift.test.debug
22 namespace java thrift.test
23 namespace rb thrift.test
24
25 struct Doubles {
26 1: double nan,
27 2: double inf,
28 3: double neginf,
29 4: double repeating,
30 5: double big,
31 6: double tiny,
32 7: double zero,
33 8: double negzero,
34 }
35
36 struct OneOfEach {
37 1: bool im_true,
38 2: bool im_false,
39 3: i8 a_bite = 0x7f,
40 4: i16 integer16 = 0x7fff,
41 5: i32 integer32,
42 6: i64 integer64 = 10000000000,
43 7: double double_precision,
44 8: string some_characters,
45 9: string zomg_unicode,
46 10: bool what_who,
47 11: binary base64,
48 12: list<i8> byte_list = [1, 2, 3],
49 13: list<i16> i16_list = [1,2,3],
50 14: list<i64> i64_list = [1,2,3]
51 }
52
53 struct Bonk {
54 1: i32 type,
55 2: string message,
56 }
57
58 struct Nesting {
59 1: Bonk my_bonk,
60 2: OneOfEach my_ooe,
61 }
62
63 struct HolyMoley {
64 1: list<OneOfEach> big,
65 2: set<list<string> (python.immutable = "")> contain,
66 3: map<string,list<Bonk>> bonks,
67 }
68
69 struct Backwards {
70 2: i32 first_tag2,
71 1: i32 second_tag1,
72 }
73
74 struct Empty {
75 } (
76 python.immutable = "",
77 )
78
79 struct Wrapper {
80 1: Empty foo
81 } (
82 python.immutable = "",
83 )
84
85 struct RandomStuff {
86 1: i32 a,
87 2: i32 b,
88 3: i32 c,
89 4: i32 d,
90 5: list<i32> myintlist,
91 6: map<i32,Wrapper> maps,
92 7: i64 bigint,
93 8: double triple,
94 }
95
96 struct Base64 {
97 1: i32 a,
98 2: binary b1,
99 3: binary b2,
100 4: binary b3,
101 5: binary b4,
102 6: binary b5,
103 7: binary b6,
104 }
105
106 struct CompactProtoTestStruct {
107 // primitive fields
108 1: i8 a_byte;
109 2: i16 a_i16;
110 3: i32 a_i32;
111 4: i64 a_i64;
112 5: double a_double;
113 6: string a_string;
114 7: binary a_binary;
115 8: bool true_field;
116 9: bool false_field;
117 10: Empty empty_struct_field;
118
119 // primitives in lists
120 11: list<i8> byte_list;
121 12: list<i16> i16_list;
122 13: list<i32> i32_list;
123 14: list<i64> i64_list;
124 15: list<double> double_list;
125 16: list<string> string_list;
126 17: list<binary> binary_list;
127 18: list<bool> boolean_list;
128 19: list<Empty> struct_list;
129
130 // primitives in sets
131 20: set<i8> byte_set;
132 21: set<i16> i16_set;
133 22: set<i32> i32_set;
134 23: set<i64> i64_set;
135 24: set<double> double_set;
136 25: set<string> string_set;
137 26: set<binary> binary_set;
138 27: set<bool> boolean_set;
139 28: set<Empty> struct_set;
140
141 // maps
142 // primitives as keys
143 29: map<i8, i8> byte_byte_map;
144 30: map<i16, i8> i16_byte_map;
145 31: map<i32, i8> i32_byte_map;
146 32: map<i64, i8> i64_byte_map;
147 33: map<double, i8> double_byte_map;
148 34: map<string, i8> string_byte_map;
149 35: map<binary, i8> binary_byte_map;
150 36: map<bool, i8> boolean_byte_map;
151 // primitives as values
152 37: map<i8, i16> byte_i16_map;
153 38: map<i8, i32> byte_i32_map;
154 39: map<i8, i64> byte_i64_map;
155 40: map<i8, double> byte_double_map;
156 41: map<i8, string> byte_string_map;
157 42: map<i8, binary> byte_binary_map;
158 43: map<i8, bool> byte_boolean_map;
159 // collections as keys
160 44: map<list<i8> (python.immutable = ""), i8> list_byte_map;
161 45: map<set<i8> (python.immutable = ""), i8> set_byte_map;
162 46: map<map<i8,i8> (python.immutable = ""), i8> map_byte_map;
163 // collections as values
164 47: map<i8, map<i8,i8>> byte_map_map;
165 48: map<i8, set<i8>> byte_set_map;
166 49: map<i8, list<i8>> byte_list_map;
167
168 // large field IDs
169 500 : i64 field500;
170 5000 : i64 field5000;
171 20000 : i64 field20000;
172 }
173
174 // To be used to test the serialization of an empty map
175 struct SingleMapTestStruct {
176 1: required map<i32, i32> i32_map;
177 }
178
179 const CompactProtoTestStruct COMPACT_TEST = {
180 'a_byte' : 127,
181 'a_i16' : 32000,
182 'a_i32' : 1000000000,
183 'a_i64' : 0xffffffffff,
184 'a_double' : 5.6789,
185 'a_string' : "my string",
186 //'a_binary,'
187 'true_field' : 1,
188 'false_field' : 0,
189 'empty_struct_field' : {},
190 'byte_list' : [-127, -1, 0, 1, 127],
191 'i16_list' : [-1, 0, 1, 0x7fff],
192 'i32_list' : [-1, 0, 0xff, 0xffff, 0xffffff, 0x7fffffff],
193 'i64_list' : [-1, 0, 0xff, 0xffff, 0xffffff, 0xffffffff, 0xffffffffff, 0xffffffffffff, 0xffffffffffffff, 0x7fffffffffffffff],
194 'double_list' : [0.1, 0.2, 0.3],
195 'string_list' : ["first", "second", "third"],
196 //'binary_list,'
197 'boolean_list' : [1, 1, 1, 0, 0, 0],
198 'struct_list' : [{}, {}],
199 'byte_set' : [-127, -1, 0, 1, 127],
200 'i16_set' : [-1, 0, 1, 0x7fff],
201 'i32_set' : [1, 2, 3],
202 'i64_set' : [-1, 0, 0xff, 0xffff, 0xffffff, 0xffffffff, 0xffffffffff, 0xffffffffffff, 0xffffffffffffff, 0x7fffffffffffffff],
203 'double_set' : [0.1, 0.2, 0.3],
204 'string_set' : ["first", "second", "third"],
205 //'binary_set,'
206 'boolean_set' : [1, 0],
207 'struct_set' : [{}],
208 'byte_byte_map' : {1 : 2},
209 'i16_byte_map' : {1 : 1, -1 : 1, 0x7fff : 1},
210 'i32_byte_map' : {1 : 1, -1 : 1, 0x7fffffff : 1},
211 'i64_byte_map' : {0 : 1, 1 : 1, -1 : 1, 0x7fffffffffffffff : 1},
212 'double_byte_map' : {-1.1 : 1, 1.1 : 1},
213 'string_byte_map' : {"first" : 1, "second" : 2, "third" : 3, "" : 0},
214 //'binary_byte_map,'
215 'boolean_byte_map' : {1 : 1, 0 : 0},
216 'byte_i16_map' : {1 : 1, 2 : -1, 3 : 0x7fff},
217 'byte_i32_map' : {1 : 1, 2 : -1, 3 : 0x7fffffff},
218 'byte_i64_map' : {1 : 1, 2 : -1, 3 : 0x7fffffffffffffff},
219 'byte_double_map' : {1 : 0.1, 2 : -0.1, 3 : 1000000.1},
220 'byte_string_map' : {1 : "", 2 : "blah", 3 : "loooooooooooooong string"},
221 //'byte_binary_map,'
222 'byte_boolean_map' : {1 : 1, 2 : 0},
223 'list_byte_map' : {[1, 2, 3] : 1, [0, 1] : 2, [] : 0},
224 'set_byte_map' : {[1, 2, 3] : 1, [0, 1] : 2, [] : 0},
225 'map_byte_map' : {{1 : 1} : 1, {2 : 2} : 2, {} : 0},
226 'byte_map_map' : {0 : {}, 1 : {1 : 1}, 2 : {1 : 1, 2 : 2}},
227 'byte_set_map' : {0 : [], 1 : [1], 2 : [1, 2]},
228 'byte_list_map' : {0 : [], 1 : [1], 2 : [1, 2]},
229
230 'field500' : 500,
231 'field5000' : 5000,
232 'field20000' : 20000,
233 }
234
235
236 const i32 MYCONST = 2
237
238
239 exception ExceptionWithAMap {
240 1: string blah;
241 2: map<string, string> map_field;
242 }
243
244 service ServiceForExceptionWithAMap {
245 void methodThatThrowsAnException() throws (1: ExceptionWithAMap xwamap);
246 }
247
248 service Srv {
249 i32 Janky(1: i32 arg);
250
251 // return type only methods
252
253 void voidMethod();
254 i32 primitiveMethod();
255 CompactProtoTestStruct structMethod();
256
257 void methodWithDefaultArgs(1: i32 something = MYCONST);
258
259 oneway void onewayMethod();
260
261 bool declaredExceptionMethod(1: bool shouldThrow) throws (1: ExceptionWithAMap xwamap);
262 }
263
264 service Inherited extends Srv {
265 i32 identity(1: i32 arg)
266 }
267
268 service EmptyService {}
269
270 // The only purpose of this thing is to increase the size of the generated code
271 // so that ZlibTest has more highly compressible data to play with.
272 struct BlowUp {
273 1: map<list<i32>(python.immutable = ""),set<map<i32,string> (python.immutable = "")>> b1;
274 2: map<list<i32>(python.immutable = ""),set<map<i32,string> (python.immutable = "")>> b2;
275 3: map<list<i32>(python.immutable = ""),set<map<i32,string> (python.immutable = "")>> b3;
276 4: map<list<i32>(python.immutable = ""),set<map<i32,string> (python.immutable = "")>> b4;
277 }
278
279
280 struct ReverseOrderStruct {
281 4: string first;
282 3: i16 second;
283 2: i32 third;
284 1: i64 fourth;
285 }
286
287 service ReverseOrderService {
288 void myMethod(4: string first, 3: i16 second, 2: i32 third, 1: i64 fourth);
289 }
290
291 enum SomeEnum {
292 ONE = 1
293 TWO = 2
294 }
295
296 /** This is a docstring on a constant! */
297 const SomeEnum MY_SOME_ENUM = SomeEnum.ONE
298
299 const SomeEnum MY_SOME_ENUM_1 = 1
300 /*const SomeEnum MY_SOME_ENUM_2 = 7*/
301
302 const map<SomeEnum,SomeEnum> MY_ENUM_MAP = {
303 SomeEnum.ONE : SomeEnum.TWO
304 }
305
306 struct StructWithSomeEnum {
307 1: SomeEnum blah;
308 }
309
310 const map<SomeEnum,StructWithSomeEnum> EXTRA_CRAZY_MAP = {
311 SomeEnum.ONE : {"blah" : SomeEnum.TWO}
312 }
313
314 union TestUnion {
315 /**
316 * A doc string
317 */
318 1: string string_field;
319 2: i32 i32_field;
320 3: OneOfEach struct_field;
321 4: list<RandomStuff> struct_list;
322 5: i32 other_i32_field;
323 6: SomeEnum enum_field;
324 7: set<i32> i32_set;
325 8: map<i32, i32> i32_map;
326 }
327
328 union TestUnionMinusStringField {
329 2: i32 i32_field;
330 3: OneOfEach struct_field;
331 4: list<RandomStuff> struct_list;
332 5: i32 other_i32_field;
333 6: SomeEnum enum_field;
334 7: set<i32> i32_set;
335 8: map<i32, i32> i32_map;
336 }
337
338 union ComparableUnion {
339 1: string string_field;
340 2: binary binary_field;
341 }
342
343 struct StructWithAUnion {
344 1: TestUnion test_union;
345 }
346
347 struct PrimitiveThenStruct {
348 1: i32 blah;
349 2: i32 blah2;
350 3: Backwards bw;
351 }
352
353 typedef map<i32,i32> SomeMap
354
355 struct StructWithASomemap {
356 1: required SomeMap somemap_field;
357 }
358
359 struct BigFieldIdStruct {
360 1: string field1;
361 45: string field2;
362 }
363
364 struct BreaksRubyCompactProtocol {
365 1: string field1;
366 2: BigFieldIdStruct field2;
367 3: i32 field3;
368 }
369
370 struct TupleProtocolTestStruct {
371 optional i32 field1;
372 optional i32 field2;
373 optional i32 field3;
374 optional i32 field4;
375 optional i32 field5;
376 optional i32 field6;
377 optional i32 field7;
378 optional i32 field8;
379 optional i32 field9;
380 optional i32 field10;
381 optional i32 field11;
382 optional i32 field12;
383 }
384
385 struct ListDoublePerf {
386 1: list<double> field;
387 }