thrift 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. data/benchmark/gen-rb/benchmark_constants.rb +3 -2
  2. data/benchmark/gen-rb/benchmark_service.rb +52 -52
  3. data/benchmark/gen-rb/benchmark_types.rb +3 -2
  4. data/ext/binary_protocol_accelerated.c +5 -2
  5. data/ext/bytes.c +36 -0
  6. data/ext/bytes.h +31 -0
  7. data/ext/compact_protocol.c +7 -4
  8. data/ext/constants.h +4 -0
  9. data/ext/extconf.rb +3 -1
  10. data/ext/memory_buffer.c +11 -8
  11. data/ext/thrift_native.c +9 -0
  12. data/lib/thrift.rb +2 -0
  13. data/lib/thrift/bytes.rb +131 -0
  14. data/lib/thrift/protocol/base_protocol.rb +10 -0
  15. data/lib/thrift/protocol/binary_protocol.rb +5 -5
  16. data/lib/thrift/protocol/compact_protocol.rb +4 -3
  17. data/lib/thrift/protocol/json_protocol.rb +765 -0
  18. data/lib/thrift/transport/base_transport.rb +22 -20
  19. data/lib/thrift/transport/buffered_transport.rb +16 -10
  20. data/lib/thrift/transport/framed_transport.rb +11 -10
  21. data/lib/thrift/transport/http_client_transport.rb +7 -5
  22. data/lib/thrift/transport/io_stream_transport.rb +1 -1
  23. data/lib/thrift/transport/memory_buffer_transport.rb +6 -6
  24. data/lib/thrift/transport/socket.rb +4 -2
  25. data/spec/ThriftSpec.thrift +52 -1
  26. data/spec/base_protocol_spec.rb +44 -45
  27. data/spec/base_transport_spec.rb +49 -50
  28. data/spec/binary_protocol_accelerated_spec.rb +9 -13
  29. data/spec/binary_protocol_spec.rb +15 -10
  30. data/spec/binary_protocol_spec_shared.rb +62 -12
  31. data/spec/bytes_spec.rb +160 -0
  32. data/spec/client_spec.rb +13 -14
  33. data/spec/compact_protocol_spec.rb +3 -2
  34. data/spec/exception_spec.rb +39 -40
  35. data/spec/gen-rb/nonblocking_service.rb +193 -193
  36. data/spec/gen-rb/thrift_spec_constants.rb +3 -2
  37. data/spec/gen-rb/thrift_spec_types.rb +455 -262
  38. data/spec/http_client_spec.rb +16 -9
  39. data/spec/json_protocol_spec.rb +513 -0
  40. data/spec/mongrel_http_server_spec.rb +19 -22
  41. data/spec/nonblocking_server_spec.rb +18 -20
  42. data/spec/processor_spec.rb +13 -16
  43. data/spec/serializer_spec.rb +17 -19
  44. data/spec/server_socket_spec.rb +6 -7
  45. data/spec/server_spec.rb +46 -58
  46. data/spec/socket_spec.rb +11 -11
  47. data/spec/socket_spec_shared.rb +1 -1
  48. data/spec/spec_helper.rb +13 -10
  49. data/spec/struct_nested_containers_spec.rb +191 -0
  50. data/spec/struct_spec.rb +84 -86
  51. data/spec/types_spec.rb +65 -66
  52. data/spec/union_spec.rb +44 -46
  53. data/spec/unix_socket_spec.rb +8 -9
  54. data/test/debug_proto/gen-rb/debug_proto_test_constants.rb +8 -7
  55. data/test/debug_proto/gen-rb/debug_proto_test_types.rb +24 -23
  56. data/test/debug_proto/gen-rb/empty_service.rb +1 -1
  57. data/test/debug_proto/gen-rb/inherited.rb +3 -3
  58. data/test/debug_proto/gen-rb/reverse_order_service.rb +1 -1
  59. data/test/debug_proto/gen-rb/service_for_exception_with_a_map.rb +3 -3
  60. data/test/debug_proto/gen-rb/srv.rb +2 -2
  61. metadata +43 -49
@@ -1,10 +1,11 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (0.8.0)
2
+ # Autogenerated by Thrift Compiler (0.9.0)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
6
6
 
7
+ require 'thrift'
7
8
  require 'thrift_spec_types'
8
9
 
9
- module SpecNamespace
10
+ module SpecNamespace
10
11
  end
@@ -1,345 +1,538 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (0.8.0)
2
+ # Autogenerated by Thrift Compiler (0.9.0)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
6
6
 
7
+ require 'thrift'
7
8
 
8
9
  module SpecNamespace
9
- module SomeEnum
10
- ONE = 0
11
- TWO = 1
12
- VALUE_MAP = {0 => "ONE", 1 => "TWO"}
13
- VALID_VALUES = Set.new([ONE, TWO]).freeze
10
+ module SomeEnum
11
+ ONE = 0
12
+ TWO = 1
13
+ VALUE_MAP = {0 => "ONE", 1 => "TWO"}
14
+ VALID_VALUES = Set.new([ONE, TWO]).freeze
15
+ end
16
+
17
+ class Hello
18
+ include ::Thrift::Struct, ::Thrift::Struct_Union
19
+ GREETING = 1
20
+
21
+ FIELDS = {
22
+ GREETING => {:type => ::Thrift::Types::STRING, :name => 'greeting', :default => %q"hello world"}
23
+ }
24
+
25
+ def struct_fields; FIELDS; end
26
+
27
+ def validate
14
28
  end
15
29
 
16
- class Hello
17
- include ::Thrift::Struct, ::Thrift::Struct_Union
18
- GREETING = 1
30
+ ::Thrift::Struct.generate_accessors self
31
+ end
32
+
33
+ class StructWithSomeEnum
34
+ include ::Thrift::Struct, ::Thrift::Struct_Union
35
+ SOME_ENUM = 1
19
36
 
20
- FIELDS = {
21
- GREETING => {:type => ::Thrift::Types::STRING, :name => 'greeting', :default => %q"hello world"}
22
- }
37
+ FIELDS = {
38
+ SOME_ENUM => {:type => ::Thrift::Types::I32, :name => 'some_enum', :enum_class => ::SpecNamespace::SomeEnum}
39
+ }
23
40
 
24
- def struct_fields; FIELDS; end
41
+ def struct_fields; FIELDS; end
25
42
 
26
- def validate
43
+ def validate
44
+ unless @some_enum.nil? || ::SpecNamespace::SomeEnum::VALID_VALUES.include?(@some_enum)
45
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field some_enum!')
27
46
  end
28
-
29
- ::Thrift::Struct.generate_accessors self
30
47
  end
31
48
 
32
- class StructWithSomeEnum
33
- include ::Thrift::Struct, ::Thrift::Struct_Union
34
- SOME_ENUM = 1
49
+ ::Thrift::Struct.generate_accessors self
50
+ end
51
+
52
+ class TestUnion < ::Thrift::Union
53
+ include ::Thrift::Struct_Union
54
+ class << self
55
+ def string_field(val)
56
+ TestUnion.new(:string_field, val)
57
+ end
58
+
59
+ def i32_field(val)
60
+ TestUnion.new(:i32_field, val)
61
+ end
62
+
63
+ def other_i32_field(val)
64
+ TestUnion.new(:other_i32_field, val)
65
+ end
35
66
 
36
- FIELDS = {
37
- SOME_ENUM => {:type => ::Thrift::Types::I32, :name => 'some_enum', :enum_class => SpecNamespace::SomeEnum}
38
- }
67
+ def enum_field(val)
68
+ TestUnion.new(:enum_field, val)
69
+ end
39
70
 
40
- def struct_fields; FIELDS; end
71
+ def binary_field(val)
72
+ TestUnion.new(:binary_field, val)
73
+ end
74
+ end
41
75
 
42
- def validate
43
- unless @some_enum.nil? || SpecNamespace::SomeEnum::VALID_VALUES.include?(@some_enum)
44
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field some_enum!')
45
- end
76
+ STRING_FIELD = 1
77
+ I32_FIELD = 2
78
+ OTHER_I32_FIELD = 3
79
+ ENUM_FIELD = 4
80
+ BINARY_FIELD = 5
81
+
82
+ FIELDS = {
83
+ # A doc string
84
+ STRING_FIELD => {:type => ::Thrift::Types::STRING, :name => 'string_field'},
85
+ I32_FIELD => {:type => ::Thrift::Types::I32, :name => 'i32_field'},
86
+ OTHER_I32_FIELD => {:type => ::Thrift::Types::I32, :name => 'other_i32_field'},
87
+ ENUM_FIELD => {:type => ::Thrift::Types::I32, :name => 'enum_field', :enum_class => ::SpecNamespace::SomeEnum},
88
+ BINARY_FIELD => {:type => ::Thrift::Types::STRING, :name => 'binary_field', :binary => true}
89
+ }
90
+
91
+ def struct_fields; FIELDS; end
92
+
93
+ def validate
94
+ raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
95
+ if get_set_field == :enum_field
96
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field enum_field!') unless ::SpecNamespace::SomeEnum::VALID_VALUES.include?(get_value)
46
97
  end
98
+ end
99
+
100
+ ::Thrift::Union.generate_accessors self
101
+ end
102
+
103
+ class Foo
104
+ include ::Thrift::Struct, ::Thrift::Struct_Union
105
+ SIMPLE = 1
106
+ WORDS = 2
107
+ HELLO = 3
108
+ INTS = 4
109
+ COMPLEX = 5
110
+ SHORTS = 6
111
+ OPT_STRING = 7
112
+ MY_BOOL = 8
113
+
114
+ FIELDS = {
115
+ SIMPLE => {:type => ::Thrift::Types::I32, :name => 'simple', :default => 53},
116
+ WORDS => {:type => ::Thrift::Types::STRING, :name => 'words', :default => %q"words"},
117
+ HELLO => {:type => ::Thrift::Types::STRUCT, :name => 'hello', :default => ::SpecNamespace::Hello.new({
118
+ %q"greeting" => %q"hello, world!",
119
+ }), :class => ::SpecNamespace::Hello},
120
+ INTS => {:type => ::Thrift::Types::LIST, :name => 'ints', :default => [
121
+ 1,
122
+ 2,
123
+ 2,
124
+ 3,
125
+ ], :element => {:type => ::Thrift::Types::I32}},
126
+ COMPLEX => {:type => ::Thrift::Types::MAP, :name => 'complex', :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::DOUBLE}}},
127
+ SHORTS => {:type => ::Thrift::Types::SET, :name => 'shorts', :default => Set.new([
128
+ 5,
129
+ 17,
130
+ 239,
131
+ ]), :element => {:type => ::Thrift::Types::I16}},
132
+ OPT_STRING => {:type => ::Thrift::Types::STRING, :name => 'opt_string', :optional => true},
133
+ MY_BOOL => {:type => ::Thrift::Types::BOOL, :name => 'my_bool'}
134
+ }
135
+
136
+ def struct_fields; FIELDS; end
137
+
138
+ def validate
139
+ end
140
+
141
+ ::Thrift::Struct.generate_accessors self
142
+ end
143
+
144
+ class Foo2
145
+ include ::Thrift::Struct, ::Thrift::Struct_Union
146
+ MY_BINARY = 1
147
+
148
+ FIELDS = {
149
+ MY_BINARY => {:type => ::Thrift::Types::STRING, :name => 'my_binary', :binary => true}
150
+ }
151
+
152
+ def struct_fields; FIELDS; end
153
+
154
+ def validate
155
+ end
47
156
 
48
- ::Thrift::Struct.generate_accessors self
157
+ ::Thrift::Struct.generate_accessors self
158
+ end
159
+
160
+ class BoolStruct
161
+ include ::Thrift::Struct, ::Thrift::Struct_Union
162
+ YESNO = 1
163
+
164
+ FIELDS = {
165
+ YESNO => {:type => ::Thrift::Types::BOOL, :name => 'yesno', :default => true}
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 SimpleList
177
+ include ::Thrift::Struct, ::Thrift::Struct_Union
178
+ BOOLS = 1
179
+ BYTES = 2
180
+ I16S = 3
181
+ I32S = 4
182
+ I64S = 5
183
+ DOUBLES = 6
184
+ STRINGS = 7
185
+ MAPS = 8
186
+ LISTS = 9
187
+ SETS = 10
188
+ HELLOS = 11
189
+
190
+ FIELDS = {
191
+ BOOLS => {:type => ::Thrift::Types::LIST, :name => 'bools', :element => {:type => ::Thrift::Types::BOOL}},
192
+ BYTES => {:type => ::Thrift::Types::LIST, :name => 'bytes', :element => {:type => ::Thrift::Types::BYTE}},
193
+ I16S => {:type => ::Thrift::Types::LIST, :name => 'i16s', :element => {:type => ::Thrift::Types::I16}},
194
+ I32S => {:type => ::Thrift::Types::LIST, :name => 'i32s', :element => {:type => ::Thrift::Types::I32}},
195
+ I64S => {:type => ::Thrift::Types::LIST, :name => 'i64s', :element => {:type => ::Thrift::Types::I64}},
196
+ DOUBLES => {:type => ::Thrift::Types::LIST, :name => 'doubles', :element => {:type => ::Thrift::Types::DOUBLE}},
197
+ STRINGS => {:type => ::Thrift::Types::LIST, :name => 'strings', :element => {:type => ::Thrift::Types::STRING}},
198
+ MAPS => {:type => ::Thrift::Types::LIST, :name => 'maps', :element => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::I16}, :value => {:type => ::Thrift::Types::I16}}},
199
+ LISTS => {:type => ::Thrift::Types::LIST, :name => 'lists', :element => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::I16}}},
200
+ SETS => {:type => ::Thrift::Types::LIST, :name => 'sets', :element => {:type => ::Thrift::Types::SET, :element => {:type => ::Thrift::Types::I16}}},
201
+ HELLOS => {:type => ::Thrift::Types::LIST, :name => 'hellos', :element => {:type => ::Thrift::Types::STRUCT, :class => ::SpecNamespace::Hello}}
202
+ }
203
+
204
+ def struct_fields; FIELDS; end
205
+
206
+ def validate
207
+ end
208
+
209
+ ::Thrift::Struct.generate_accessors self
210
+ end
211
+
212
+ class Xception < ::Thrift::Exception
213
+ include ::Thrift::Struct, ::Thrift::Struct_Union
214
+ MESSAGE = 1
215
+ CODE = 2
216
+
217
+ FIELDS = {
218
+ MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'},
219
+ CODE => {:type => ::Thrift::Types::I32, :name => 'code', :default => 1}
220
+ }
221
+
222
+ def struct_fields; FIELDS; end
223
+
224
+ def validate
49
225
  end
50
226
 
51
- class TestUnion < ::Thrift::Union
52
- include ::Thrift::Struct_Union
53
- class << self
54
- def string_field(val)
55
- TestUnion.new(:string_field, val)
56
- end
227
+ ::Thrift::Struct.generate_accessors self
228
+ end
229
+
230
+ class My_union < ::Thrift::Union
231
+ include ::Thrift::Struct_Union
232
+ class << self
233
+ def im_true(val)
234
+ My_union.new(:im_true, val)
235
+ end
57
236
 
58
- def i32_field(val)
59
- TestUnion.new(:i32_field, val)
60
- end
237
+ def a_bite(val)
238
+ My_union.new(:a_bite, val)
239
+ end
61
240
 
62
- def other_i32_field(val)
63
- TestUnion.new(:other_i32_field, val)
64
- end
241
+ def integer16(val)
242
+ My_union.new(:integer16, val)
243
+ end
65
244
 
66
- def enum_field(val)
67
- TestUnion.new(:enum_field, val)
68
- end
245
+ def integer32(val)
246
+ My_union.new(:integer32, val)
247
+ end
69
248
 
70
- def binary_field(val)
71
- TestUnion.new(:binary_field, val)
72
- end
249
+ def integer64(val)
250
+ My_union.new(:integer64, val)
73
251
  end
74
252
 
75
- STRING_FIELD = 1
76
- I32_FIELD = 2
77
- OTHER_I32_FIELD = 3
78
- ENUM_FIELD = 4
79
- BINARY_FIELD = 5
80
-
81
- FIELDS = {
82
- # A doc string
83
- STRING_FIELD => {:type => ::Thrift::Types::STRING, :name => 'string_field'},
84
- I32_FIELD => {:type => ::Thrift::Types::I32, :name => 'i32_field'},
85
- OTHER_I32_FIELD => {:type => ::Thrift::Types::I32, :name => 'other_i32_field'},
86
- ENUM_FIELD => {:type => ::Thrift::Types::I32, :name => 'enum_field', :enum_class => SpecNamespace::SomeEnum},
87
- BINARY_FIELD => {:type => ::Thrift::Types::STRING, :name => 'binary_field', :binary => true}
88
- }
89
-
90
- def struct_fields; FIELDS; end
91
-
92
- def validate
93
- raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
94
- if get_set_field == :enum_field
95
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field enum_field!') unless SpecNamespace::SomeEnum::VALID_VALUES.include?(get_value)
96
- end
253
+ def double_precision(val)
254
+ My_union.new(:double_precision, val)
97
255
  end
98
256
 
99
- ::Thrift::Union.generate_accessors self
257
+ def some_characters(val)
258
+ My_union.new(:some_characters, val)
259
+ end
260
+
261
+ def other_i32(val)
262
+ My_union.new(:other_i32, val)
263
+ end
264
+
265
+ def some_enum(val)
266
+ My_union.new(:some_enum, val)
267
+ end
268
+
269
+ def my_map(val)
270
+ My_union.new(:my_map, val)
271
+ end
100
272
  end
101
273
 
102
- class Foo
103
- include ::Thrift::Struct, ::Thrift::Struct_Union
104
- SIMPLE = 1
105
- WORDS = 2
106
- HELLO = 3
107
- INTS = 4
108
- COMPLEX = 5
109
- SHORTS = 6
110
- OPT_STRING = 7
111
- MY_BOOL = 8
112
-
113
- FIELDS = {
114
- SIMPLE => {:type => ::Thrift::Types::I32, :name => 'simple', :default => 53},
115
- WORDS => {:type => ::Thrift::Types::STRING, :name => 'words', :default => %q"words"},
116
- HELLO => {:type => ::Thrift::Types::STRUCT, :name => 'hello', :default => SpecNamespace::Hello.new({
117
- %q"greeting" => %q"hello, world!",
118
- }), :class => SpecNamespace::Hello},
119
- INTS => {:type => ::Thrift::Types::LIST, :name => 'ints', :default => [
120
- 1,
121
- 2,
122
- 2,
123
- 3,
124
- ], :element => {:type => ::Thrift::Types::I32}},
125
- COMPLEX => {:type => ::Thrift::Types::MAP, :name => 'complex', :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::DOUBLE}}},
126
- SHORTS => {:type => ::Thrift::Types::SET, :name => 'shorts', :default => Set.new([
127
- 5,
128
- 17,
129
- 239,
130
- ]), :element => {:type => ::Thrift::Types::I16}},
131
- OPT_STRING => {:type => ::Thrift::Types::STRING, :name => 'opt_string', :optional => true},
132
- MY_BOOL => {:type => ::Thrift::Types::BOOL, :name => 'my_bool'}
133
- }
134
-
135
- def struct_fields; FIELDS; end
136
-
137
- def validate
274
+ IM_TRUE = 1
275
+ A_BITE = 2
276
+ INTEGER16 = 3
277
+ INTEGER32 = 4
278
+ INTEGER64 = 5
279
+ DOUBLE_PRECISION = 6
280
+ SOME_CHARACTERS = 7
281
+ OTHER_I32 = 8
282
+ SOME_ENUM = 9
283
+ MY_MAP = 10
284
+
285
+ FIELDS = {
286
+ IM_TRUE => {:type => ::Thrift::Types::BOOL, :name => 'im_true'},
287
+ A_BITE => {:type => ::Thrift::Types::BYTE, :name => 'a_bite'},
288
+ INTEGER16 => {:type => ::Thrift::Types::I16, :name => 'integer16'},
289
+ INTEGER32 => {:type => ::Thrift::Types::I32, :name => 'integer32'},
290
+ INTEGER64 => {:type => ::Thrift::Types::I64, :name => 'integer64'},
291
+ DOUBLE_PRECISION => {:type => ::Thrift::Types::DOUBLE, :name => 'double_precision'},
292
+ SOME_CHARACTERS => {:type => ::Thrift::Types::STRING, :name => 'some_characters'},
293
+ OTHER_I32 => {:type => ::Thrift::Types::I32, :name => 'other_i32'},
294
+ SOME_ENUM => {:type => ::Thrift::Types::I32, :name => 'some_enum', :enum_class => ::SpecNamespace::SomeEnum},
295
+ MY_MAP => {:type => ::Thrift::Types::MAP, :name => 'my_map', :key => {:type => ::Thrift::Types::I32, :enum_class => ::SpecNamespace::SomeEnum}, :value => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::I32, :enum_class => ::SpecNamespace::SomeEnum}}}
296
+ }
297
+
298
+ def struct_fields; FIELDS; end
299
+
300
+ def validate
301
+ raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
302
+ if get_set_field == :some_enum
303
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field some_enum!') unless ::SpecNamespace::SomeEnum::VALID_VALUES.include?(get_value)
138
304
  end
305
+ end
139
306
 
140
- ::Thrift::Struct.generate_accessors self
307
+ ::Thrift::Union.generate_accessors self
308
+ end
309
+
310
+ class Struct_with_union
311
+ include ::Thrift::Struct, ::Thrift::Struct_Union
312
+ FUN_UNION = 1
313
+ INTEGER32 = 2
314
+ SOME_CHARACTERS = 3
315
+
316
+ FIELDS = {
317
+ FUN_UNION => {:type => ::Thrift::Types::STRUCT, :name => 'fun_union', :class => ::SpecNamespace::My_union},
318
+ INTEGER32 => {:type => ::Thrift::Types::I32, :name => 'integer32'},
319
+ SOME_CHARACTERS => {:type => ::Thrift::Types::STRING, :name => 'some_characters'}
320
+ }
321
+
322
+ def struct_fields; FIELDS; end
323
+
324
+ def validate
141
325
  end
142
326
 
143
- class Foo2
144
- include ::Thrift::Struct, ::Thrift::Struct_Union
145
- MY_BINARY = 1
327
+ ::Thrift::Struct.generate_accessors self
328
+ end
146
329
 
147
- FIELDS = {
148
- MY_BINARY => {:type => ::Thrift::Types::STRING, :name => 'my_binary', :binary => true}
149
- }
330
+ class StructWithEnumMap
331
+ include ::Thrift::Struct, ::Thrift::Struct_Union
332
+ MY_MAP = 1
150
333
 
151
- def struct_fields; FIELDS; end
334
+ FIELDS = {
335
+ MY_MAP => {:type => ::Thrift::Types::MAP, :name => 'my_map', :key => {:type => ::Thrift::Types::I32, :enum_class => ::SpecNamespace::SomeEnum}, :value => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::I32, :enum_class => ::SpecNamespace::SomeEnum}}}
336
+ }
152
337
 
153
- def validate
154
- end
338
+ def struct_fields; FIELDS; end
155
339
 
156
- ::Thrift::Struct.generate_accessors self
340
+ def validate
157
341
  end
158
342
 
159
- class BoolStruct
160
- include ::Thrift::Struct, ::Thrift::Struct_Union
161
- YESNO = 1
343
+ ::Thrift::Struct.generate_accessors self
344
+ end
162
345
 
163
- FIELDS = {
164
- YESNO => {:type => ::Thrift::Types::BOOL, :name => 'yesno', :default => true}
165
- }
346
+ class NestedListInList
347
+ include ::Thrift::Struct, ::Thrift::Struct_Union
348
+ VALUE = 1
166
349
 
167
- def struct_fields; FIELDS; end
350
+ FIELDS = {
351
+ VALUE => {:type => ::Thrift::Types::LIST, :name => 'value', :element => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::BYTE}}}
352
+ }
168
353
 
169
- def validate
170
- end
354
+ def struct_fields; FIELDS; end
171
355
 
172
- ::Thrift::Struct.generate_accessors self
356
+ def validate
173
357
  end
174
358
 
175
- class SimpleList
176
- include ::Thrift::Struct, ::Thrift::Struct_Union
177
- BOOLS = 1
178
- BYTES = 2
179
- I16S = 3
180
- I32S = 4
181
- I64S = 5
182
- DOUBLES = 6
183
- STRINGS = 7
184
- MAPS = 8
185
- LISTS = 9
186
- SETS = 10
187
- HELLOS = 11
188
-
189
- FIELDS = {
190
- BOOLS => {:type => ::Thrift::Types::LIST, :name => 'bools', :element => {:type => ::Thrift::Types::BOOL}},
191
- BYTES => {:type => ::Thrift::Types::LIST, :name => 'bytes', :element => {:type => ::Thrift::Types::BYTE}},
192
- I16S => {:type => ::Thrift::Types::LIST, :name => 'i16s', :element => {:type => ::Thrift::Types::I16}},
193
- I32S => {:type => ::Thrift::Types::LIST, :name => 'i32s', :element => {:type => ::Thrift::Types::I32}},
194
- I64S => {:type => ::Thrift::Types::LIST, :name => 'i64s', :element => {:type => ::Thrift::Types::I64}},
195
- DOUBLES => {:type => ::Thrift::Types::LIST, :name => 'doubles', :element => {:type => ::Thrift::Types::DOUBLE}},
196
- STRINGS => {:type => ::Thrift::Types::LIST, :name => 'strings', :element => {:type => ::Thrift::Types::STRING}},
197
- MAPS => {:type => ::Thrift::Types::LIST, :name => 'maps', :element => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::I16}, :value => {:type => ::Thrift::Types::I16}}},
198
- LISTS => {:type => ::Thrift::Types::LIST, :name => 'lists', :element => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::I16}}},
199
- SETS => {:type => ::Thrift::Types::LIST, :name => 'sets', :element => {:type => ::Thrift::Types::SET, :element => {:type => ::Thrift::Types::I16}}},
200
- HELLOS => {:type => ::Thrift::Types::LIST, :name => 'hellos', :element => {:type => ::Thrift::Types::STRUCT, :class => SpecNamespace::Hello}}
201
- }
202
-
203
- def struct_fields; FIELDS; end
204
-
205
- def validate
206
- end
359
+ ::Thrift::Struct.generate_accessors self
360
+ end
361
+
362
+ class NestedListInSet
363
+ include ::Thrift::Struct, ::Thrift::Struct_Union
364
+ VALUE = 1
207
365
 
208
- ::Thrift::Struct.generate_accessors self
366
+ FIELDS = {
367
+ VALUE => {:type => ::Thrift::Types::SET, :name => 'value', :element => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::BYTE}}}
368
+ }
369
+
370
+ def struct_fields; FIELDS; end
371
+
372
+ def validate
209
373
  end
210
374
 
211
- class Xception < ::Thrift::Exception
212
- include ::Thrift::Struct, ::Thrift::Struct_Union
213
- MESSAGE = 1
214
- CODE = 2
375
+ ::Thrift::Struct.generate_accessors self
376
+ end
215
377
 
216
- FIELDS = {
217
- MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'},
218
- CODE => {:type => ::Thrift::Types::I32, :name => 'code', :default => 1}
219
- }
378
+ class NestedListInMapKey
379
+ include ::Thrift::Struct, ::Thrift::Struct_Union
380
+ VALUE = 1
220
381
 
221
- def struct_fields; FIELDS; end
382
+ FIELDS = {
383
+ VALUE => {:type => ::Thrift::Types::MAP, :name => 'value', :key => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::BYTE}}, :value => {:type => ::Thrift::Types::BYTE}}
384
+ }
222
385
 
223
- def validate
224
- end
386
+ def struct_fields; FIELDS; end
225
387
 
226
- ::Thrift::Struct.generate_accessors self
388
+ def validate
227
389
  end
228
390
 
229
- class My_union < ::Thrift::Union
230
- include ::Thrift::Struct_Union
231
- class << self
232
- def im_true(val)
233
- My_union.new(:im_true, val)
234
- end
391
+ ::Thrift::Struct.generate_accessors self
392
+ end
235
393
 
236
- def a_bite(val)
237
- My_union.new(:a_bite, val)
238
- end
394
+ class NestedListInMapValue
395
+ include ::Thrift::Struct, ::Thrift::Struct_Union
396
+ VALUE = 1
239
397
 
240
- def integer16(val)
241
- My_union.new(:integer16, val)
242
- end
398
+ FIELDS = {
399
+ VALUE => {:type => ::Thrift::Types::MAP, :name => 'value', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::BYTE}}}
400
+ }
243
401
 
244
- def integer32(val)
245
- My_union.new(:integer32, val)
246
- end
402
+ def struct_fields; FIELDS; end
247
403
 
248
- def integer64(val)
249
- My_union.new(:integer64, val)
250
- end
404
+ def validate
405
+ end
251
406
 
252
- def double_precision(val)
253
- My_union.new(:double_precision, val)
254
- end
407
+ ::Thrift::Struct.generate_accessors self
408
+ end
255
409
 
256
- def some_characters(val)
257
- My_union.new(:some_characters, val)
258
- end
410
+ class NestedSetInList
411
+ include ::Thrift::Struct, ::Thrift::Struct_Union
412
+ VALUE = 1
259
413
 
260
- def other_i32(val)
261
- My_union.new(:other_i32, val)
262
- end
414
+ FIELDS = {
415
+ VALUE => {:type => ::Thrift::Types::LIST, :name => 'value', :element => {:type => ::Thrift::Types::SET, :element => {:type => ::Thrift::Types::BYTE}}}
416
+ }
263
417
 
264
- def some_enum(val)
265
- My_union.new(:some_enum, val)
266
- end
418
+ def struct_fields; FIELDS; end
267
419
 
268
- def my_map(val)
269
- My_union.new(:my_map, val)
270
- end
271
- end
420
+ def validate
421
+ end
272
422
 
273
- IM_TRUE = 1
274
- A_BITE = 2
275
- INTEGER16 = 3
276
- INTEGER32 = 4
277
- INTEGER64 = 5
278
- DOUBLE_PRECISION = 6
279
- SOME_CHARACTERS = 7
280
- OTHER_I32 = 8
281
- SOME_ENUM = 9
282
- MY_MAP = 10
283
-
284
- FIELDS = {
285
- IM_TRUE => {:type => ::Thrift::Types::BOOL, :name => 'im_true'},
286
- A_BITE => {:type => ::Thrift::Types::BYTE, :name => 'a_bite'},
287
- INTEGER16 => {:type => ::Thrift::Types::I16, :name => 'integer16'},
288
- INTEGER32 => {:type => ::Thrift::Types::I32, :name => 'integer32'},
289
- INTEGER64 => {:type => ::Thrift::Types::I64, :name => 'integer64'},
290
- DOUBLE_PRECISION => {:type => ::Thrift::Types::DOUBLE, :name => 'double_precision'},
291
- SOME_CHARACTERS => {:type => ::Thrift::Types::STRING, :name => 'some_characters'},
292
- OTHER_I32 => {:type => ::Thrift::Types::I32, :name => 'other_i32'},
293
- SOME_ENUM => {:type => ::Thrift::Types::I32, :name => 'some_enum', :enum_class => SpecNamespace::SomeEnum},
294
- MY_MAP => {:type => ::Thrift::Types::MAP, :name => 'my_map', :key => {:type => ::Thrift::Types::I32, :enum_class => SpecNamespace::SomeEnum}, :value => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::I32, :enum_class => SpecNamespace::SomeEnum}}}
295
- }
296
-
297
- def struct_fields; FIELDS; end
298
-
299
- def validate
300
- raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
301
- if get_set_field == :some_enum
302
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field some_enum!') unless SpecNamespace::SomeEnum::VALID_VALUES.include?(get_value)
303
- end
304
- end
423
+ ::Thrift::Struct.generate_accessors self
424
+ end
305
425
 
306
- ::Thrift::Union.generate_accessors self
426
+ class NestedSetInSet
427
+ include ::Thrift::Struct, ::Thrift::Struct_Union
428
+ VALUE = 1
429
+
430
+ FIELDS = {
431
+ VALUE => {:type => ::Thrift::Types::SET, :name => 'value', :element => {:type => ::Thrift::Types::SET, :element => {:type => ::Thrift::Types::BYTE}}}
432
+ }
433
+
434
+ def struct_fields; FIELDS; end
435
+
436
+ def validate
307
437
  end
308
438
 
309
- class Struct_with_union
310
- include ::Thrift::Struct, ::Thrift::Struct_Union
311
- FUN_UNION = 1
312
- INTEGER32 = 2
313
- SOME_CHARACTERS = 3
439
+ ::Thrift::Struct.generate_accessors self
440
+ end
314
441
 
315
- FIELDS = {
316
- FUN_UNION => {:type => ::Thrift::Types::STRUCT, :name => 'fun_union', :class => SpecNamespace::My_union},
317
- INTEGER32 => {:type => ::Thrift::Types::I32, :name => 'integer32'},
318
- SOME_CHARACTERS => {:type => ::Thrift::Types::STRING, :name => 'some_characters'}
319
- }
442
+ class NestedSetInMapKey
443
+ include ::Thrift::Struct, ::Thrift::Struct_Union
444
+ VALUE = 1
320
445
 
321
- def struct_fields; FIELDS; end
446
+ FIELDS = {
447
+ VALUE => {:type => ::Thrift::Types::MAP, :name => 'value', :key => {:type => ::Thrift::Types::SET, :element => {:type => ::Thrift::Types::BYTE}}, :value => {:type => ::Thrift::Types::BYTE}}
448
+ }
322
449
 
323
- def validate
324
- end
450
+ def struct_fields; FIELDS; end
325
451
 
326
- ::Thrift::Struct.generate_accessors self
452
+ def validate
327
453
  end
328
454
 
329
- class StructWithEnumMap
330
- include ::Thrift::Struct, ::Thrift::Struct_Union
331
- MY_MAP = 1
455
+ ::Thrift::Struct.generate_accessors self
456
+ end
332
457
 
333
- FIELDS = {
334
- MY_MAP => {:type => ::Thrift::Types::MAP, :name => 'my_map', :key => {:type => ::Thrift::Types::I32, :enum_class => SpecNamespace::SomeEnum}, :value => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::I32, :enum_class => SpecNamespace::SomeEnum}}}
335
- }
458
+ class NestedSetInMapValue
459
+ include ::Thrift::Struct, ::Thrift::Struct_Union
460
+ VALUE = 1
336
461
 
337
- def struct_fields; FIELDS; end
462
+ FIELDS = {
463
+ VALUE => {:type => ::Thrift::Types::MAP, :name => 'value', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::SET, :element => {:type => ::Thrift::Types::BYTE}}}
464
+ }
338
465
 
339
- def validate
340
- end
466
+ def struct_fields; FIELDS; end
341
467
 
342
- ::Thrift::Struct.generate_accessors self
468
+ def validate
343
469
  end
344
470
 
471
+ ::Thrift::Struct.generate_accessors self
345
472
  end
473
+
474
+ class NestedMapInList
475
+ include ::Thrift::Struct, ::Thrift::Struct_Union
476
+ VALUE = 1
477
+
478
+ FIELDS = {
479
+ VALUE => {:type => ::Thrift::Types::LIST, :name => 'value', :element => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::BYTE}}}
480
+ }
481
+
482
+ def struct_fields; FIELDS; end
483
+
484
+ def validate
485
+ end
486
+
487
+ ::Thrift::Struct.generate_accessors self
488
+ end
489
+
490
+ class NestedMapInSet
491
+ include ::Thrift::Struct, ::Thrift::Struct_Union
492
+ VALUE = 1
493
+
494
+ FIELDS = {
495
+ VALUE => {:type => ::Thrift::Types::SET, :name => 'value', :element => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::BYTE}}}
496
+ }
497
+
498
+ def struct_fields; FIELDS; end
499
+
500
+ def validate
501
+ end
502
+
503
+ ::Thrift::Struct.generate_accessors self
504
+ end
505
+
506
+ class NestedMapInMapKey
507
+ include ::Thrift::Struct, ::Thrift::Struct_Union
508
+ VALUE = 2
509
+
510
+ FIELDS = {
511
+ VALUE => {:type => ::Thrift::Types::MAP, :name => 'value', :key => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::BYTE}}, :value => {:type => ::Thrift::Types::BYTE}}
512
+ }
513
+
514
+ def struct_fields; FIELDS; end
515
+
516
+ def validate
517
+ end
518
+
519
+ ::Thrift::Struct.generate_accessors self
520
+ end
521
+
522
+ class NestedMapInMapValue
523
+ include ::Thrift::Struct, ::Thrift::Struct_Union
524
+ VALUE = 2
525
+
526
+ FIELDS = {
527
+ VALUE => {:type => ::Thrift::Types::MAP, :name => 'value', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::BYTE}}}
528
+ }
529
+
530
+ def struct_fields; FIELDS; end
531
+
532
+ def validate
533
+ end
534
+
535
+ ::Thrift::Struct.generate_accessors self
536
+ end
537
+
538
+ end