thrift 0.11.0.0 → 0.14.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +5 -5
  2. data/lib/thrift/protocol/base_protocol.rb +11 -3
  3. data/lib/thrift/protocol/binary_protocol.rb +8 -1
  4. data/lib/thrift/protocol/binary_protocol_accelerated.rb +8 -0
  5. data/lib/thrift/protocol/compact_protocol.rb +8 -0
  6. data/lib/thrift/protocol/json_protocol.rb +8 -0
  7. data/lib/thrift/protocol/multiplexed_protocol.rb +5 -1
  8. data/lib/thrift/server/base_server.rb +8 -2
  9. data/lib/thrift/server/simple_server.rb +5 -1
  10. data/lib/thrift/server/thread_pool_server.rb +5 -1
  11. data/lib/thrift/server/threaded_server.rb +5 -1
  12. data/lib/thrift/transport/base_server_transport.rb +1 -1
  13. data/lib/thrift/transport/base_transport.rb +8 -0
  14. data/lib/thrift/transport/buffered_transport.rb +9 -1
  15. data/lib/thrift/transport/framed_transport.rb +9 -1
  16. data/lib/thrift/transport/http_client_transport.rb +6 -0
  17. data/lib/thrift/transport/io_stream_transport.rb +4 -1
  18. data/lib/thrift/transport/memory_buffer_transport.rb +4 -0
  19. data/lib/thrift/transport/server_socket.rb +6 -1
  20. data/lib/thrift/transport/socket.rb +4 -2
  21. data/lib/thrift/transport/ssl_server_socket.rb +4 -0
  22. data/lib/thrift/transport/ssl_socket.rb +4 -0
  23. data/lib/thrift/transport/unix_server_socket.rb +5 -1
  24. data/lib/thrift/transport/unix_socket.rb +5 -1
  25. data/spec/base_protocol_spec.rb +79 -71
  26. data/spec/base_transport_spec.rb +155 -117
  27. data/spec/binary_protocol_accelerated_spec.rb +6 -2
  28. data/spec/binary_protocol_spec.rb +16 -8
  29. data/spec/binary_protocol_spec_shared.rb +73 -70
  30. data/spec/bytes_spec.rb +38 -38
  31. data/spec/client_spec.rb +41 -42
  32. data/spec/compact_protocol_spec.rb +23 -8
  33. data/spec/exception_spec.rb +54 -54
  34. data/spec/flat_spec.rb +5 -5
  35. data/spec/http_client_spec.rb +64 -38
  36. data/spec/json_protocol_spec.rb +146 -138
  37. data/spec/namespaced_spec.rb +5 -5
  38. data/spec/nonblocking_server_spec.rb +16 -16
  39. data/spec/processor_spec.rb +26 -26
  40. data/spec/serializer_spec.rb +20 -20
  41. data/spec/server_socket_spec.rb +27 -22
  42. data/spec/server_spec.rb +91 -52
  43. data/spec/socket_spec.rb +23 -16
  44. data/spec/socket_spec_shared.rb +31 -31
  45. data/spec/ssl_server_socket_spec.rb +34 -0
  46. data/spec/ssl_socket_spec.rb +26 -22
  47. data/spec/struct_nested_containers_spec.rb +24 -24
  48. data/spec/struct_spec.rb +120 -120
  49. data/spec/thin_http_server_spec.rb +18 -18
  50. data/spec/types_spec.rb +56 -53
  51. data/spec/union_spec.rb +42 -43
  52. data/spec/unix_socket_spec.rb +43 -34
  53. metadata +138 -158
  54. data/benchmark/gen-rb/benchmark_constants.rb +0 -11
  55. data/benchmark/gen-rb/benchmark_service.rb +0 -80
  56. data/benchmark/gen-rb/benchmark_types.rb +0 -10
  57. data/spec/gen-rb/base/base_service.rb +0 -80
  58. data/spec/gen-rb/base/base_service_constants.rb +0 -11
  59. data/spec/gen-rb/base/base_service_types.rb +0 -26
  60. data/spec/gen-rb/extended/extended_service.rb +0 -78
  61. data/spec/gen-rb/extended/extended_service_constants.rb +0 -11
  62. data/spec/gen-rb/extended/extended_service_types.rb +0 -12
  63. data/spec/gen-rb/flat/namespaced_nonblocking_service.rb +0 -272
  64. data/spec/gen-rb/flat/referenced_constants.rb +0 -11
  65. data/spec/gen-rb/flat/referenced_types.rb +0 -17
  66. data/spec/gen-rb/flat/thrift_namespaced_spec_constants.rb +0 -11
  67. data/spec/gen-rb/flat/thrift_namespaced_spec_types.rb +0 -28
  68. data/spec/gen-rb/namespaced_spec_namespace/namespaced_nonblocking_service.rb +0 -272
  69. data/spec/gen-rb/namespaced_spec_namespace/thrift_namespaced_spec_constants.rb +0 -11
  70. data/spec/gen-rb/namespaced_spec_namespace/thrift_namespaced_spec_types.rb +0 -28
  71. data/spec/gen-rb/nonblocking_service.rb +0 -272
  72. data/spec/gen-rb/other_namespace/referenced_constants.rb +0 -11
  73. data/spec/gen-rb/other_namespace/referenced_types.rb +0 -17
  74. data/spec/gen-rb/thrift_spec_constants.rb +0 -11
  75. data/spec/gen-rb/thrift_spec_types.rb +0 -538
  76. data/test/debug_proto/gen-rb/debug_proto_test_constants.rb +0 -278
  77. data/test/debug_proto/gen-rb/debug_proto_test_types.rb +0 -781
  78. data/test/debug_proto/gen-rb/empty_service.rb +0 -28
  79. data/test/debug_proto/gen-rb/inherited.rb +0 -83
  80. data/test/debug_proto/gen-rb/reverse_order_service.rb +0 -86
  81. data/test/debug_proto/gen-rb/service_for_exception_with_a_map.rb +0 -85
  82. data/test/debug_proto/gen-rb/srv.rb +0 -395
@@ -1,781 +0,0 @@
1
- #
2
- # Autogenerated by Thrift Compiler (0.11.0)
3
- #
4
- # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
- #
6
-
7
- require 'thrift'
8
-
9
- module Thrift
10
- module Test
11
- module SomeEnum
12
- ONE = 1
13
- TWO = 2
14
- VALUE_MAP = {1 => "ONE", 2 => "TWO"}
15
- VALID_VALUES = Set.new([ONE, TWO]).freeze
16
- end
17
-
18
- class Doubles
19
- include ::Thrift::Struct, ::Thrift::Struct_Union
20
- NAN = 1
21
- INF = 2
22
- NEGINF = 3
23
- REPEATING = 4
24
- BIG = 5
25
- TINY = 6
26
- ZERO = 7
27
- NEGZERO = 8
28
-
29
- FIELDS = {
30
- NAN => {:type => ::Thrift::Types::DOUBLE, :name => 'nan'},
31
- INF => {:type => ::Thrift::Types::DOUBLE, :name => 'inf'},
32
- NEGINF => {:type => ::Thrift::Types::DOUBLE, :name => 'neginf'},
33
- REPEATING => {:type => ::Thrift::Types::DOUBLE, :name => 'repeating'},
34
- BIG => {:type => ::Thrift::Types::DOUBLE, :name => 'big'},
35
- TINY => {:type => ::Thrift::Types::DOUBLE, :name => 'tiny'},
36
- ZERO => {:type => ::Thrift::Types::DOUBLE, :name => 'zero'},
37
- NEGZERO => {:type => ::Thrift::Types::DOUBLE, :name => 'negzero'}
38
- }
39
-
40
- def struct_fields; FIELDS; end
41
-
42
- def validate
43
- end
44
-
45
- ::Thrift::Struct.generate_accessors self
46
- end
47
-
48
- class OneOfEach
49
- include ::Thrift::Struct, ::Thrift::Struct_Union
50
- IM_TRUE = 1
51
- IM_FALSE = 2
52
- A_BITE = 3
53
- INTEGER16 = 4
54
- INTEGER32 = 5
55
- INTEGER64 = 6
56
- DOUBLE_PRECISION = 7
57
- SOME_CHARACTERS = 8
58
- ZOMG_UNICODE = 9
59
- WHAT_WHO = 10
60
- BASE64 = 11
61
- BYTE_LIST = 12
62
- I16_LIST = 13
63
- I64_LIST = 14
64
-
65
- FIELDS = {
66
- IM_TRUE => {:type => ::Thrift::Types::BOOL, :name => 'im_true'},
67
- IM_FALSE => {:type => ::Thrift::Types::BOOL, :name => 'im_false'},
68
- A_BITE => {:type => ::Thrift::Types::BYTE, :name => 'a_bite', :default => 127},
69
- INTEGER16 => {:type => ::Thrift::Types::I16, :name => 'integer16', :default => 32767},
70
- INTEGER32 => {:type => ::Thrift::Types::I32, :name => 'integer32'},
71
- INTEGER64 => {:type => ::Thrift::Types::I64, :name => 'integer64', :default => 10000000000},
72
- DOUBLE_PRECISION => {:type => ::Thrift::Types::DOUBLE, :name => 'double_precision'},
73
- SOME_CHARACTERS => {:type => ::Thrift::Types::STRING, :name => 'some_characters'},
74
- ZOMG_UNICODE => {:type => ::Thrift::Types::STRING, :name => 'zomg_unicode'},
75
- WHAT_WHO => {:type => ::Thrift::Types::BOOL, :name => 'what_who'},
76
- BASE64 => {:type => ::Thrift::Types::STRING, :name => 'base64', :binary => true},
77
- BYTE_LIST => {:type => ::Thrift::Types::LIST, :name => 'byte_list', :default => [
78
- 1,
79
- 2,
80
- 3,
81
- ], :element => {:type => ::Thrift::Types::BYTE}},
82
- I16_LIST => {:type => ::Thrift::Types::LIST, :name => 'i16_list', :default => [
83
- 1,
84
- 2,
85
- 3,
86
- ], :element => {:type => ::Thrift::Types::I16}},
87
- I64_LIST => {:type => ::Thrift::Types::LIST, :name => 'i64_list', :default => [
88
- 1,
89
- 2,
90
- 3,
91
- ], :element => {:type => ::Thrift::Types::I64}}
92
- }
93
-
94
- def struct_fields; FIELDS; end
95
-
96
- def validate
97
- end
98
-
99
- ::Thrift::Struct.generate_accessors self
100
- end
101
-
102
- class Bonk
103
- include ::Thrift::Struct, ::Thrift::Struct_Union
104
- TYPE = 1
105
- MESSAGE = 2
106
-
107
- FIELDS = {
108
- TYPE => {:type => ::Thrift::Types::I32, :name => 'type'},
109
- MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
110
- }
111
-
112
- def struct_fields; FIELDS; end
113
-
114
- def validate
115
- end
116
-
117
- ::Thrift::Struct.generate_accessors self
118
- end
119
-
120
- class Nesting
121
- include ::Thrift::Struct, ::Thrift::Struct_Union
122
- MY_BONK = 1
123
- MY_OOE = 2
124
-
125
- FIELDS = {
126
- MY_BONK => {:type => ::Thrift::Types::STRUCT, :name => 'my_bonk', :class => ::Thrift::Test::Bonk},
127
- MY_OOE => {:type => ::Thrift::Types::STRUCT, :name => 'my_ooe', :class => ::Thrift::Test::OneOfEach}
128
- }
129
-
130
- def struct_fields; FIELDS; end
131
-
132
- def validate
133
- end
134
-
135
- ::Thrift::Struct.generate_accessors self
136
- end
137
-
138
- class HolyMoley
139
- include ::Thrift::Struct, ::Thrift::Struct_Union
140
- BIG = 1
141
- CONTAIN = 2
142
- BONKS = 3
143
-
144
- FIELDS = {
145
- BIG => {:type => ::Thrift::Types::LIST, :name => 'big', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Thrift::Test::OneOfEach}},
146
- CONTAIN => {:type => ::Thrift::Types::SET, :name => 'contain', :element => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::STRING}}},
147
- BONKS => {:type => ::Thrift::Types::MAP, :name => 'bonks', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::STRUCT, :class => ::Thrift::Test::Bonk}}}
148
- }
149
-
150
- def struct_fields; FIELDS; end
151
-
152
- def validate
153
- end
154
-
155
- ::Thrift::Struct.generate_accessors self
156
- end
157
-
158
- class Backwards
159
- include ::Thrift::Struct, ::Thrift::Struct_Union
160
- FIRST_TAG2 = 2
161
- SECOND_TAG1 = 1
162
-
163
- FIELDS = {
164
- FIRST_TAG2 => {:type => ::Thrift::Types::I32, :name => 'first_tag2'},
165
- SECOND_TAG1 => {:type => ::Thrift::Types::I32, :name => 'second_tag1'}
166
- }
167
-
168
- def struct_fields; FIELDS; end
169
-
170
- def validate
171
- end
172
-
173
- ::Thrift::Struct.generate_accessors self
174
- end
175
-
176
- class Empty
177
- include ::Thrift::Struct, ::Thrift::Struct_Union
178
-
179
- FIELDS = {
180
-
181
- }
182
-
183
- def struct_fields; FIELDS; end
184
-
185
- def validate
186
- end
187
-
188
- ::Thrift::Struct.generate_accessors self
189
- end
190
-
191
- class Wrapper
192
- include ::Thrift::Struct, ::Thrift::Struct_Union
193
- FOO = 1
194
-
195
- FIELDS = {
196
- FOO => {:type => ::Thrift::Types::STRUCT, :name => 'foo', :class => ::Thrift::Test::Empty}
197
- }
198
-
199
- def struct_fields; FIELDS; end
200
-
201
- def validate
202
- end
203
-
204
- ::Thrift::Struct.generate_accessors self
205
- end
206
-
207
- class RandomStuff
208
- include ::Thrift::Struct, ::Thrift::Struct_Union
209
- A = 1
210
- B = 2
211
- C = 3
212
- D = 4
213
- MYINTLIST = 5
214
- MAPS = 6
215
- BIGINT = 7
216
- TRIPLE = 8
217
-
218
- FIELDS = {
219
- A => {:type => ::Thrift::Types::I32, :name => 'a'},
220
- B => {:type => ::Thrift::Types::I32, :name => 'b'},
221
- C => {:type => ::Thrift::Types::I32, :name => 'c'},
222
- D => {:type => ::Thrift::Types::I32, :name => 'd'},
223
- MYINTLIST => {:type => ::Thrift::Types::LIST, :name => 'myintlist', :element => {:type => ::Thrift::Types::I32}},
224
- MAPS => {:type => ::Thrift::Types::MAP, :name => 'maps', :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::STRUCT, :class => ::Thrift::Test::Wrapper}},
225
- BIGINT => {:type => ::Thrift::Types::I64, :name => 'bigint'},
226
- TRIPLE => {:type => ::Thrift::Types::DOUBLE, :name => 'triple'}
227
- }
228
-
229
- def struct_fields; FIELDS; end
230
-
231
- def validate
232
- end
233
-
234
- ::Thrift::Struct.generate_accessors self
235
- end
236
-
237
- class Base64
238
- include ::Thrift::Struct, ::Thrift::Struct_Union
239
- A = 1
240
- B1 = 2
241
- B2 = 3
242
- B3 = 4
243
- B4 = 5
244
- B5 = 6
245
- B6 = 7
246
-
247
- FIELDS = {
248
- A => {:type => ::Thrift::Types::I32, :name => 'a'},
249
- B1 => {:type => ::Thrift::Types::STRING, :name => 'b1', :binary => true},
250
- B2 => {:type => ::Thrift::Types::STRING, :name => 'b2', :binary => true},
251
- B3 => {:type => ::Thrift::Types::STRING, :name => 'b3', :binary => true},
252
- B4 => {:type => ::Thrift::Types::STRING, :name => 'b4', :binary => true},
253
- B5 => {:type => ::Thrift::Types::STRING, :name => 'b5', :binary => true},
254
- B6 => {:type => ::Thrift::Types::STRING, :name => 'b6', :binary => true}
255
- }
256
-
257
- def struct_fields; FIELDS; end
258
-
259
- def validate
260
- end
261
-
262
- ::Thrift::Struct.generate_accessors self
263
- end
264
-
265
- class CompactProtoTestStruct
266
- include ::Thrift::Struct, ::Thrift::Struct_Union
267
- A_BYTE = 1
268
- A_I16 = 2
269
- A_I32 = 3
270
- A_I64 = 4
271
- A_DOUBLE = 5
272
- A_STRING = 6
273
- A_BINARY = 7
274
- TRUE_FIELD = 8
275
- FALSE_FIELD = 9
276
- EMPTY_STRUCT_FIELD = 10
277
- BYTE_LIST = 11
278
- I16_LIST = 12
279
- I32_LIST = 13
280
- I64_LIST = 14
281
- DOUBLE_LIST = 15
282
- STRING_LIST = 16
283
- BINARY_LIST = 17
284
- BOOLEAN_LIST = 18
285
- STRUCT_LIST = 19
286
- BYTE_SET = 20
287
- I16_SET = 21
288
- I32_SET = 22
289
- I64_SET = 23
290
- DOUBLE_SET = 24
291
- STRING_SET = 25
292
- BINARY_SET = 26
293
- BOOLEAN_SET = 27
294
- STRUCT_SET = 28
295
- BYTE_BYTE_MAP = 29
296
- I16_BYTE_MAP = 30
297
- I32_BYTE_MAP = 31
298
- I64_BYTE_MAP = 32
299
- DOUBLE_BYTE_MAP = 33
300
- STRING_BYTE_MAP = 34
301
- BINARY_BYTE_MAP = 35
302
- BOOLEAN_BYTE_MAP = 36
303
- BYTE_I16_MAP = 37
304
- BYTE_I32_MAP = 38
305
- BYTE_I64_MAP = 39
306
- BYTE_DOUBLE_MAP = 40
307
- BYTE_STRING_MAP = 41
308
- BYTE_BINARY_MAP = 42
309
- BYTE_BOOLEAN_MAP = 43
310
- LIST_BYTE_MAP = 44
311
- SET_BYTE_MAP = 45
312
- MAP_BYTE_MAP = 46
313
- BYTE_MAP_MAP = 47
314
- BYTE_SET_MAP = 48
315
- BYTE_LIST_MAP = 49
316
-
317
- FIELDS = {
318
- A_BYTE => {:type => ::Thrift::Types::BYTE, :name => 'a_byte'},
319
- A_I16 => {:type => ::Thrift::Types::I16, :name => 'a_i16'},
320
- A_I32 => {:type => ::Thrift::Types::I32, :name => 'a_i32'},
321
- A_I64 => {:type => ::Thrift::Types::I64, :name => 'a_i64'},
322
- A_DOUBLE => {:type => ::Thrift::Types::DOUBLE, :name => 'a_double'},
323
- A_STRING => {:type => ::Thrift::Types::STRING, :name => 'a_string'},
324
- A_BINARY => {:type => ::Thrift::Types::STRING, :name => 'a_binary', :binary => true},
325
- TRUE_FIELD => {:type => ::Thrift::Types::BOOL, :name => 'true_field'},
326
- FALSE_FIELD => {:type => ::Thrift::Types::BOOL, :name => 'false_field'},
327
- EMPTY_STRUCT_FIELD => {:type => ::Thrift::Types::STRUCT, :name => 'empty_struct_field', :class => ::Thrift::Test::Empty},
328
- BYTE_LIST => {:type => ::Thrift::Types::LIST, :name => 'byte_list', :element => {:type => ::Thrift::Types::BYTE}},
329
- I16_LIST => {:type => ::Thrift::Types::LIST, :name => 'i16_list', :element => {:type => ::Thrift::Types::I16}},
330
- I32_LIST => {:type => ::Thrift::Types::LIST, :name => 'i32_list', :element => {:type => ::Thrift::Types::I32}},
331
- I64_LIST => {:type => ::Thrift::Types::LIST, :name => 'i64_list', :element => {:type => ::Thrift::Types::I64}},
332
- DOUBLE_LIST => {:type => ::Thrift::Types::LIST, :name => 'double_list', :element => {:type => ::Thrift::Types::DOUBLE}},
333
- STRING_LIST => {:type => ::Thrift::Types::LIST, :name => 'string_list', :element => {:type => ::Thrift::Types::STRING}},
334
- BINARY_LIST => {:type => ::Thrift::Types::LIST, :name => 'binary_list', :element => {:type => ::Thrift::Types::STRING, :binary => true}},
335
- BOOLEAN_LIST => {:type => ::Thrift::Types::LIST, :name => 'boolean_list', :element => {:type => ::Thrift::Types::BOOL}},
336
- STRUCT_LIST => {:type => ::Thrift::Types::LIST, :name => 'struct_list', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Thrift::Test::Empty}},
337
- BYTE_SET => {:type => ::Thrift::Types::SET, :name => 'byte_set', :element => {:type => ::Thrift::Types::BYTE}},
338
- I16_SET => {:type => ::Thrift::Types::SET, :name => 'i16_set', :element => {:type => ::Thrift::Types::I16}},
339
- I32_SET => {:type => ::Thrift::Types::SET, :name => 'i32_set', :element => {:type => ::Thrift::Types::I32}},
340
- I64_SET => {:type => ::Thrift::Types::SET, :name => 'i64_set', :element => {:type => ::Thrift::Types::I64}},
341
- DOUBLE_SET => {:type => ::Thrift::Types::SET, :name => 'double_set', :element => {:type => ::Thrift::Types::DOUBLE}},
342
- STRING_SET => {:type => ::Thrift::Types::SET, :name => 'string_set', :element => {:type => ::Thrift::Types::STRING}},
343
- BINARY_SET => {:type => ::Thrift::Types::SET, :name => 'binary_set', :element => {:type => ::Thrift::Types::STRING, :binary => true}},
344
- BOOLEAN_SET => {:type => ::Thrift::Types::SET, :name => 'boolean_set', :element => {:type => ::Thrift::Types::BOOL}},
345
- STRUCT_SET => {:type => ::Thrift::Types::SET, :name => 'struct_set', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Thrift::Test::Empty}},
346
- BYTE_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_byte_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::BYTE}},
347
- I16_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'i16_byte_map', :key => {:type => ::Thrift::Types::I16}, :value => {:type => ::Thrift::Types::BYTE}},
348
- I32_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'i32_byte_map', :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::BYTE}},
349
- I64_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'i64_byte_map', :key => {:type => ::Thrift::Types::I64}, :value => {:type => ::Thrift::Types::BYTE}},
350
- DOUBLE_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'double_byte_map', :key => {:type => ::Thrift::Types::DOUBLE}, :value => {:type => ::Thrift::Types::BYTE}},
351
- STRING_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'string_byte_map', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::BYTE}},
352
- BINARY_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'binary_byte_map', :key => {:type => ::Thrift::Types::STRING, :binary => true}, :value => {:type => ::Thrift::Types::BYTE}},
353
- BOOLEAN_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'boolean_byte_map', :key => {:type => ::Thrift::Types::BOOL}, :value => {:type => ::Thrift::Types::BYTE}},
354
- BYTE_I16_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_i16_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::I16}},
355
- BYTE_I32_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_i32_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::I32}},
356
- BYTE_I64_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_i64_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::I64}},
357
- BYTE_DOUBLE_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_double_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::DOUBLE}},
358
- BYTE_STRING_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_string_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::STRING}},
359
- BYTE_BINARY_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_binary_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::STRING, :binary => true}},
360
- BYTE_BOOLEAN_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_boolean_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::BOOL}},
361
- LIST_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'list_byte_map', :key => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::BYTE}}, :value => {:type => ::Thrift::Types::BYTE}},
362
- SET_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'set_byte_map', :key => {:type => ::Thrift::Types::SET, :element => {:type => ::Thrift::Types::BYTE}}, :value => {:type => ::Thrift::Types::BYTE}},
363
- MAP_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'map_byte_map', :key => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::BYTE}}, :value => {:type => ::Thrift::Types::BYTE}},
364
- BYTE_MAP_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_map_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::BYTE}}},
365
- BYTE_SET_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_set_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::SET, :element => {:type => ::Thrift::Types::BYTE}}},
366
- BYTE_LIST_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_list_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::BYTE}}}
367
- }
368
-
369
- def struct_fields; FIELDS; end
370
-
371
- def validate
372
- end
373
-
374
- ::Thrift::Struct.generate_accessors self
375
- end
376
-
377
- class SingleMapTestStruct
378
- include ::Thrift::Struct, ::Thrift::Struct_Union
379
- I32_MAP = 1
380
-
381
- FIELDS = {
382
- I32_MAP => {:type => ::Thrift::Types::MAP, :name => 'i32_map', :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::I32}}
383
- }
384
-
385
- def struct_fields; FIELDS; end
386
-
387
- def validate
388
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field i32_map is unset!') unless @i32_map
389
- end
390
-
391
- ::Thrift::Struct.generate_accessors self
392
- end
393
-
394
- class ExceptionWithAMap < ::Thrift::Exception
395
- include ::Thrift::Struct, ::Thrift::Struct_Union
396
- BLAH = 1
397
- MAP_FIELD = 2
398
-
399
- FIELDS = {
400
- BLAH => {:type => ::Thrift::Types::STRING, :name => 'blah'},
401
- MAP_FIELD => {:type => ::Thrift::Types::MAP, :name => 'map_field', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}}
402
- }
403
-
404
- def struct_fields; FIELDS; end
405
-
406
- def validate
407
- end
408
-
409
- ::Thrift::Struct.generate_accessors self
410
- end
411
-
412
- class BlowUp
413
- include ::Thrift::Struct, ::Thrift::Struct_Union
414
- B1 = 1
415
- B2 = 2
416
- B3 = 3
417
- B4 = 4
418
-
419
- FIELDS = {
420
- B1 => {:type => ::Thrift::Types::MAP, :name => 'b1', :key => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::I32}}, :value => {:type => ::Thrift::Types::SET, :element => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::STRING}}}},
421
- B2 => {:type => ::Thrift::Types::MAP, :name => 'b2', :key => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::I32}}, :value => {:type => ::Thrift::Types::SET, :element => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::STRING}}}},
422
- B3 => {:type => ::Thrift::Types::MAP, :name => 'b3', :key => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::I32}}, :value => {:type => ::Thrift::Types::SET, :element => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::STRING}}}},
423
- B4 => {:type => ::Thrift::Types::MAP, :name => 'b4', :key => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::I32}}, :value => {:type => ::Thrift::Types::SET, :element => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::STRING}}}}
424
- }
425
-
426
- def struct_fields; FIELDS; end
427
-
428
- def validate
429
- end
430
-
431
- ::Thrift::Struct.generate_accessors self
432
- end
433
-
434
- class ReverseOrderStruct
435
- include ::Thrift::Struct, ::Thrift::Struct_Union
436
- FIRST = 4
437
- SECOND = 3
438
- THIRD = 2
439
- FOURTH = 1
440
-
441
- FIELDS = {
442
- FIRST => {:type => ::Thrift::Types::STRING, :name => 'first'},
443
- SECOND => {:type => ::Thrift::Types::I16, :name => 'second'},
444
- THIRD => {:type => ::Thrift::Types::I32, :name => 'third'},
445
- FOURTH => {:type => ::Thrift::Types::I64, :name => 'fourth'}
446
- }
447
-
448
- def struct_fields; FIELDS; end
449
-
450
- def validate
451
- end
452
-
453
- ::Thrift::Struct.generate_accessors self
454
- end
455
-
456
- class StructWithSomeEnum
457
- include ::Thrift::Struct, ::Thrift::Struct_Union
458
- BLAH = 1
459
-
460
- FIELDS = {
461
- BLAH => {:type => ::Thrift::Types::I32, :name => 'blah', :enum_class => ::Thrift::Test::SomeEnum}
462
- }
463
-
464
- def struct_fields; FIELDS; end
465
-
466
- def validate
467
- unless @blah.nil? || ::Thrift::Test::SomeEnum::VALID_VALUES.include?(@blah)
468
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field blah!')
469
- end
470
- end
471
-
472
- ::Thrift::Struct.generate_accessors self
473
- end
474
-
475
- class TestUnion < ::Thrift::Union
476
- include ::Thrift::Struct_Union
477
- class << self
478
- def string_field(val)
479
- TestUnion.new(:string_field, val)
480
- end
481
-
482
- def i32_field(val)
483
- TestUnion.new(:i32_field, val)
484
- end
485
-
486
- def struct_field(val)
487
- TestUnion.new(:struct_field, val)
488
- end
489
-
490
- def struct_list(val)
491
- TestUnion.new(:struct_list, val)
492
- end
493
-
494
- def other_i32_field(val)
495
- TestUnion.new(:other_i32_field, val)
496
- end
497
-
498
- def enum_field(val)
499
- TestUnion.new(:enum_field, val)
500
- end
501
-
502
- def i32_set(val)
503
- TestUnion.new(:i32_set, val)
504
- end
505
-
506
- def i32_map(val)
507
- TestUnion.new(:i32_map, val)
508
- end
509
- end
510
-
511
- STRING_FIELD = 1
512
- I32_FIELD = 2
513
- STRUCT_FIELD = 3
514
- STRUCT_LIST = 4
515
- OTHER_I32_FIELD = 5
516
- ENUM_FIELD = 6
517
- I32_SET = 7
518
- I32_MAP = 8
519
-
520
- FIELDS = {
521
- # A doc string
522
- STRING_FIELD => {:type => ::Thrift::Types::STRING, :name => 'string_field', :optional => true},
523
- I32_FIELD => {:type => ::Thrift::Types::I32, :name => 'i32_field', :optional => true},
524
- STRUCT_FIELD => {:type => ::Thrift::Types::STRUCT, :name => 'struct_field', :class => ::Thrift::Test::OneOfEach, :optional => true},
525
- STRUCT_LIST => {:type => ::Thrift::Types::LIST, :name => 'struct_list', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Thrift::Test::RandomStuff}, :optional => true},
526
- OTHER_I32_FIELD => {:type => ::Thrift::Types::I32, :name => 'other_i32_field', :optional => true},
527
- ENUM_FIELD => {:type => ::Thrift::Types::I32, :name => 'enum_field', :optional => true, :enum_class => ::Thrift::Test::SomeEnum},
528
- I32_SET => {:type => ::Thrift::Types::SET, :name => 'i32_set', :element => {:type => ::Thrift::Types::I32}, :optional => true},
529
- I32_MAP => {:type => ::Thrift::Types::MAP, :name => 'i32_map', :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::I32}, :optional => true}
530
- }
531
-
532
- def struct_fields; FIELDS; end
533
-
534
- def validate
535
- raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
536
- if get_set_field == :enum_field
537
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field enum_field!') unless ::Thrift::Test::SomeEnum::VALID_VALUES.include?(get_value)
538
- end
539
- end
540
-
541
- ::Thrift::Union.generate_accessors self
542
- end
543
-
544
- class TestUnionMinusStringField < ::Thrift::Union
545
- include ::Thrift::Struct_Union
546
- class << self
547
- def i32_field(val)
548
- TestUnionMinusStringField.new(:i32_field, val)
549
- end
550
-
551
- def struct_field(val)
552
- TestUnionMinusStringField.new(:struct_field, val)
553
- end
554
-
555
- def struct_list(val)
556
- TestUnionMinusStringField.new(:struct_list, val)
557
- end
558
-
559
- def other_i32_field(val)
560
- TestUnionMinusStringField.new(:other_i32_field, val)
561
- end
562
-
563
- def enum_field(val)
564
- TestUnionMinusStringField.new(:enum_field, val)
565
- end
566
-
567
- def i32_set(val)
568
- TestUnionMinusStringField.new(:i32_set, val)
569
- end
570
-
571
- def i32_map(val)
572
- TestUnionMinusStringField.new(:i32_map, val)
573
- end
574
- end
575
-
576
- I32_FIELD = 2
577
- STRUCT_FIELD = 3
578
- STRUCT_LIST = 4
579
- OTHER_I32_FIELD = 5
580
- ENUM_FIELD = 6
581
- I32_SET = 7
582
- I32_MAP = 8
583
-
584
- FIELDS = {
585
- I32_FIELD => {:type => ::Thrift::Types::I32, :name => 'i32_field', :optional => true},
586
- STRUCT_FIELD => {:type => ::Thrift::Types::STRUCT, :name => 'struct_field', :class => ::Thrift::Test::OneOfEach, :optional => true},
587
- STRUCT_LIST => {:type => ::Thrift::Types::LIST, :name => 'struct_list', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Thrift::Test::RandomStuff}, :optional => true},
588
- OTHER_I32_FIELD => {:type => ::Thrift::Types::I32, :name => 'other_i32_field', :optional => true},
589
- ENUM_FIELD => {:type => ::Thrift::Types::I32, :name => 'enum_field', :optional => true, :enum_class => ::Thrift::Test::SomeEnum},
590
- I32_SET => {:type => ::Thrift::Types::SET, :name => 'i32_set', :element => {:type => ::Thrift::Types::I32}, :optional => true},
591
- I32_MAP => {:type => ::Thrift::Types::MAP, :name => 'i32_map', :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::I32}, :optional => true}
592
- }
593
-
594
- def struct_fields; FIELDS; end
595
-
596
- def validate
597
- raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
598
- if get_set_field == :enum_field
599
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field enum_field!') unless ::Thrift::Test::SomeEnum::VALID_VALUES.include?(get_value)
600
- end
601
- end
602
-
603
- ::Thrift::Union.generate_accessors self
604
- end
605
-
606
- class ComparableUnion < ::Thrift::Union
607
- include ::Thrift::Struct_Union
608
- class << self
609
- def string_field(val)
610
- ComparableUnion.new(:string_field, val)
611
- end
612
-
613
- def binary_field(val)
614
- ComparableUnion.new(:binary_field, val)
615
- end
616
- end
617
-
618
- STRING_FIELD = 1
619
- BINARY_FIELD = 2
620
-
621
- FIELDS = {
622
- STRING_FIELD => {:type => ::Thrift::Types::STRING, :name => 'string_field', :optional => true},
623
- BINARY_FIELD => {:type => ::Thrift::Types::STRING, :name => 'binary_field', :binary => true, :optional => true}
624
- }
625
-
626
- def struct_fields; FIELDS; end
627
-
628
- def validate
629
- raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
630
- end
631
-
632
- ::Thrift::Union.generate_accessors self
633
- end
634
-
635
- class StructWithAUnion
636
- include ::Thrift::Struct, ::Thrift::Struct_Union
637
- TEST_UNION = 1
638
-
639
- FIELDS = {
640
- TEST_UNION => {:type => ::Thrift::Types::STRUCT, :name => 'test_union', :class => ::Thrift::Test::TestUnion}
641
- }
642
-
643
- def struct_fields; FIELDS; end
644
-
645
- def validate
646
- end
647
-
648
- ::Thrift::Struct.generate_accessors self
649
- end
650
-
651
- class PrimitiveThenStruct
652
- include ::Thrift::Struct, ::Thrift::Struct_Union
653
- BLAH = 1
654
- BLAH2 = 2
655
- BW = 3
656
-
657
- FIELDS = {
658
- BLAH => {:type => ::Thrift::Types::I32, :name => 'blah'},
659
- BLAH2 => {:type => ::Thrift::Types::I32, :name => 'blah2'},
660
- BW => {:type => ::Thrift::Types::STRUCT, :name => 'bw', :class => ::Thrift::Test::Backwards}
661
- }
662
-
663
- def struct_fields; FIELDS; end
664
-
665
- def validate
666
- end
667
-
668
- ::Thrift::Struct.generate_accessors self
669
- end
670
-
671
- class StructWithASomemap
672
- include ::Thrift::Struct, ::Thrift::Struct_Union
673
- SOMEMAP_FIELD = 1
674
-
675
- FIELDS = {
676
- SOMEMAP_FIELD => {:type => ::Thrift::Types::MAP, :name => 'somemap_field', :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::I32}}
677
- }
678
-
679
- def struct_fields; FIELDS; end
680
-
681
- def validate
682
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field somemap_field is unset!') unless @somemap_field
683
- end
684
-
685
- ::Thrift::Struct.generate_accessors self
686
- end
687
-
688
- class BigFieldIdStruct
689
- include ::Thrift::Struct, ::Thrift::Struct_Union
690
- FIELD1 = 1
691
- FIELD2 = 45
692
-
693
- FIELDS = {
694
- FIELD1 => {:type => ::Thrift::Types::STRING, :name => 'field1'},
695
- FIELD2 => {:type => ::Thrift::Types::STRING, :name => 'field2'}
696
- }
697
-
698
- def struct_fields; FIELDS; end
699
-
700
- def validate
701
- end
702
-
703
- ::Thrift::Struct.generate_accessors self
704
- end
705
-
706
- class BreaksRubyCompactProtocol
707
- include ::Thrift::Struct, ::Thrift::Struct_Union
708
- FIELD1 = 1
709
- FIELD2 = 2
710
- FIELD3 = 3
711
-
712
- FIELDS = {
713
- FIELD1 => {:type => ::Thrift::Types::STRING, :name => 'field1'},
714
- FIELD2 => {:type => ::Thrift::Types::STRUCT, :name => 'field2', :class => ::Thrift::Test::BigFieldIdStruct},
715
- FIELD3 => {:type => ::Thrift::Types::I32, :name => 'field3'}
716
- }
717
-
718
- def struct_fields; FIELDS; end
719
-
720
- def validate
721
- end
722
-
723
- ::Thrift::Struct.generate_accessors self
724
- end
725
-
726
- class TupleProtocolTestStruct
727
- include ::Thrift::Struct, ::Thrift::Struct_Union
728
- FIELD1 = -1
729
- FIELD2 = -2
730
- FIELD3 = -3
731
- FIELD4 = -4
732
- FIELD5 = -5
733
- FIELD6 = -6
734
- FIELD7 = -7
735
- FIELD8 = -8
736
- FIELD9 = -9
737
- FIELD10 = -10
738
- FIELD11 = -11
739
- FIELD12 = -12
740
-
741
- FIELDS = {
742
- FIELD1 => {:type => ::Thrift::Types::I32, :name => 'field1', :optional => true},
743
- FIELD2 => {:type => ::Thrift::Types::I32, :name => 'field2', :optional => true},
744
- FIELD3 => {:type => ::Thrift::Types::I32, :name => 'field3', :optional => true},
745
- FIELD4 => {:type => ::Thrift::Types::I32, :name => 'field4', :optional => true},
746
- FIELD5 => {:type => ::Thrift::Types::I32, :name => 'field5', :optional => true},
747
- FIELD6 => {:type => ::Thrift::Types::I32, :name => 'field6', :optional => true},
748
- FIELD7 => {:type => ::Thrift::Types::I32, :name => 'field7', :optional => true},
749
- FIELD8 => {:type => ::Thrift::Types::I32, :name => 'field8', :optional => true},
750
- FIELD9 => {:type => ::Thrift::Types::I32, :name => 'field9', :optional => true},
751
- FIELD10 => {:type => ::Thrift::Types::I32, :name => 'field10', :optional => true},
752
- FIELD11 => {:type => ::Thrift::Types::I32, :name => 'field11', :optional => true},
753
- FIELD12 => {:type => ::Thrift::Types::I32, :name => 'field12', :optional => true}
754
- }
755
-
756
- def struct_fields; FIELDS; end
757
-
758
- def validate
759
- end
760
-
761
- ::Thrift::Struct.generate_accessors self
762
- end
763
-
764
- class ListDoublePerf
765
- include ::Thrift::Struct, ::Thrift::Struct_Union
766
- FIELD = 1
767
-
768
- FIELDS = {
769
- FIELD => {:type => ::Thrift::Types::LIST, :name => 'field', :element => {:type => ::Thrift::Types::DOUBLE}}
770
- }
771
-
772
- def struct_fields; FIELDS; end
773
-
774
- def validate
775
- end
776
-
777
- ::Thrift::Struct.generate_accessors self
778
- end
779
-
780
- end
781
- end