thrift 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +15 -0
  2. data/ext/binary_protocol_accelerated.c +19 -3
  3. data/ext/compact_protocol.c +21 -7
  4. data/ext/constants.h +1 -5
  5. data/ext/extconf.rb +1 -1
  6. data/ext/protocol.c +0 -185
  7. data/ext/protocol.h +0 -20
  8. data/ext/struct.c +0 -3
  9. data/ext/thrift_native.c +1 -11
  10. data/lib/thrift.rb +1 -0
  11. data/lib/thrift/exceptions.rb +3 -0
  12. data/lib/thrift/protocol/base_protocol.rb +87 -10
  13. data/lib/thrift/protocol/binary_protocol.rb +13 -5
  14. data/lib/thrift/protocol/compact_protocol.rb +14 -7
  15. data/lib/thrift/protocol/json_protocol.rb +19 -15
  16. data/lib/thrift/server/mongrel_http_server.rb +2 -0
  17. data/lib/thrift/server/thin_http_server.rb +91 -0
  18. data/lib/thrift/struct.rb +1 -1
  19. data/lib/thrift/struct_union.rb +2 -2
  20. data/lib/thrift/transport/http_client_transport.rb +4 -1
  21. data/spec/base_protocol_spec.rb +65 -7
  22. data/spec/binary_protocol_spec_shared.rb +30 -0
  23. data/spec/compact_protocol_spec.rb +1 -3
  24. data/spec/http_client_spec.rb +49 -0
  25. data/spec/json_protocol_spec.rb +2 -2
  26. data/spec/thin_http_server_spec.rb +140 -0
  27. data/spec/union_spec.rb +13 -1
  28. metadata +113 -93
  29. data/benchmark/gen-rb/benchmark_constants.rb +0 -11
  30. data/benchmark/gen-rb/benchmark_service.rb +0 -80
  31. data/benchmark/gen-rb/benchmark_types.rb +0 -10
  32. data/spec/gen-rb/nonblocking_service.rb +0 -272
  33. data/spec/gen-rb/thrift_spec_constants.rb +0 -11
  34. data/spec/gen-rb/thrift_spec_types.rb +0 -538
  35. data/spec/mongrel_http_server_spec.rb +0 -114
  36. data/test/debug_proto/gen-rb/debug_proto_test_constants.rb +0 -274
  37. data/test/debug_proto/gen-rb/debug_proto_test_types.rb +0 -761
  38. data/test/debug_proto/gen-rb/empty_service.rb +0 -24
  39. data/test/debug_proto/gen-rb/inherited.rb +0 -79
  40. data/test/debug_proto/gen-rb/reverse_order_service.rb +0 -82
  41. data/test/debug_proto/gen-rb/service_for_exception_with_a_map.rb +0 -81
  42. data/test/debug_proto/gen-rb/srv.rb +0 -330
@@ -1,24 +0,0 @@
1
- #
2
- # Autogenerated by Thrift Compiler (0.9.0)
3
- #
4
- # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
- #
6
-
7
- require 'thrift'
8
- require 'debug_proto_test_types'
9
-
10
- module EmptyService
11
- class Client
12
- include ::Thrift::Client
13
-
14
- end
15
-
16
- class Processor
17
- include ::Thrift::Processor
18
-
19
- end
20
-
21
- # HELPER FUNCTIONS AND STRUCTURES
22
-
23
- end
24
-
@@ -1,79 +0,0 @@
1
- #
2
- # Autogenerated by Thrift Compiler (0.9.0)
3
- #
4
- # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
- #
6
-
7
- require 'thrift'
8
- require 'srv'
9
- require 'debug_proto_test_types'
10
-
11
- module Inherited
12
- class Client < ::Srv::Client
13
- include ::Thrift::Client
14
-
15
- def identity(arg)
16
- send_identity(arg)
17
- return recv_identity()
18
- end
19
-
20
- def send_identity(arg)
21
- send_message('identity', Identity_args, :arg => arg)
22
- end
23
-
24
- def recv_identity()
25
- result = receive_message(Identity_result)
26
- return result.success unless result.success.nil?
27
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'identity failed: unknown result')
28
- end
29
-
30
- end
31
-
32
- class Processor < ::Srv::Processor
33
- include ::Thrift::Processor
34
-
35
- def process_identity(seqid, iprot, oprot)
36
- args = read_args(iprot, Identity_args)
37
- result = Identity_result.new()
38
- result.success = @handler.identity(args.arg)
39
- write_result(result, oprot, 'identity', seqid)
40
- end
41
-
42
- end
43
-
44
- # HELPER FUNCTIONS AND STRUCTURES
45
-
46
- class Identity_args
47
- include ::Thrift::Struct, ::Thrift::Struct_Union
48
- ARG = 1
49
-
50
- FIELDS = {
51
- ARG => {:type => ::Thrift::Types::I32, :name => 'arg'}
52
- }
53
-
54
- def struct_fields; FIELDS; end
55
-
56
- def validate
57
- end
58
-
59
- ::Thrift::Struct.generate_accessors self
60
- end
61
-
62
- class Identity_result
63
- include ::Thrift::Struct, ::Thrift::Struct_Union
64
- SUCCESS = 0
65
-
66
- FIELDS = {
67
- SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}
68
- }
69
-
70
- def struct_fields; FIELDS; end
71
-
72
- def validate
73
- end
74
-
75
- ::Thrift::Struct.generate_accessors self
76
- end
77
-
78
- end
79
-
@@ -1,82 +0,0 @@
1
- #
2
- # Autogenerated by Thrift Compiler (0.9.0)
3
- #
4
- # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
- #
6
-
7
- require 'thrift'
8
- require 'debug_proto_test_types'
9
-
10
- module ReverseOrderService
11
- class Client
12
- include ::Thrift::Client
13
-
14
- def myMethod(first, second, third, fourth)
15
- send_myMethod(first, second, third, fourth)
16
- recv_myMethod()
17
- end
18
-
19
- def send_myMethod(first, second, third, fourth)
20
- send_message('myMethod', MyMethod_args, :first => first, :second => second, :third => third, :fourth => fourth)
21
- end
22
-
23
- def recv_myMethod()
24
- result = receive_message(MyMethod_result)
25
- return
26
- end
27
-
28
- end
29
-
30
- class Processor
31
- include ::Thrift::Processor
32
-
33
- def process_myMethod(seqid, iprot, oprot)
34
- args = read_args(iprot, MyMethod_args)
35
- result = MyMethod_result.new()
36
- @handler.myMethod(args.first, args.second, args.third, args.fourth)
37
- write_result(result, oprot, 'myMethod', seqid)
38
- end
39
-
40
- end
41
-
42
- # HELPER FUNCTIONS AND STRUCTURES
43
-
44
- class MyMethod_args
45
- include ::Thrift::Struct, ::Thrift::Struct_Union
46
- FIRST = 4
47
- SECOND = 3
48
- THIRD = 2
49
- FOURTH = 1
50
-
51
- FIELDS = {
52
- FIRST => {:type => ::Thrift::Types::STRING, :name => 'first'},
53
- SECOND => {:type => ::Thrift::Types::I16, :name => 'second'},
54
- THIRD => {:type => ::Thrift::Types::I32, :name => 'third'},
55
- FOURTH => {:type => ::Thrift::Types::I64, :name => 'fourth'}
56
- }
57
-
58
- def struct_fields; FIELDS; end
59
-
60
- def validate
61
- end
62
-
63
- ::Thrift::Struct.generate_accessors self
64
- end
65
-
66
- class MyMethod_result
67
- include ::Thrift::Struct, ::Thrift::Struct_Union
68
-
69
- FIELDS = {
70
-
71
- }
72
-
73
- def struct_fields; FIELDS; end
74
-
75
- def validate
76
- end
77
-
78
- ::Thrift::Struct.generate_accessors self
79
- end
80
-
81
- end
82
-
@@ -1,81 +0,0 @@
1
- #
2
- # Autogenerated by Thrift Compiler (0.9.0)
3
- #
4
- # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
- #
6
-
7
- require 'thrift'
8
- require 'debug_proto_test_types'
9
-
10
- module ServiceForExceptionWithAMap
11
- class Client
12
- include ::Thrift::Client
13
-
14
- def methodThatThrowsAnException()
15
- send_methodThatThrowsAnException()
16
- recv_methodThatThrowsAnException()
17
- end
18
-
19
- def send_methodThatThrowsAnException()
20
- send_message('methodThatThrowsAnException', MethodThatThrowsAnException_args)
21
- end
22
-
23
- def recv_methodThatThrowsAnException()
24
- result = receive_message(MethodThatThrowsAnException_result)
25
- raise result.xwamap unless result.xwamap.nil?
26
- return
27
- end
28
-
29
- end
30
-
31
- class Processor
32
- include ::Thrift::Processor
33
-
34
- def process_methodThatThrowsAnException(seqid, iprot, oprot)
35
- args = read_args(iprot, MethodThatThrowsAnException_args)
36
- result = MethodThatThrowsAnException_result.new()
37
- begin
38
- @handler.methodThatThrowsAnException()
39
- rescue ::ExceptionWithAMap => xwamap
40
- result.xwamap = xwamap
41
- end
42
- write_result(result, oprot, 'methodThatThrowsAnException', seqid)
43
- end
44
-
45
- end
46
-
47
- # HELPER FUNCTIONS AND STRUCTURES
48
-
49
- class MethodThatThrowsAnException_args
50
- include ::Thrift::Struct, ::Thrift::Struct_Union
51
-
52
- FIELDS = {
53
-
54
- }
55
-
56
- def struct_fields; FIELDS; end
57
-
58
- def validate
59
- end
60
-
61
- ::Thrift::Struct.generate_accessors self
62
- end
63
-
64
- class MethodThatThrowsAnException_result
65
- include ::Thrift::Struct, ::Thrift::Struct_Union
66
- XWAMAP = 1
67
-
68
- FIELDS = {
69
- XWAMAP => {:type => ::Thrift::Types::STRUCT, :name => 'xwamap', :class => ::ExceptionWithAMap}
70
- }
71
-
72
- def struct_fields; FIELDS; end
73
-
74
- def validate
75
- end
76
-
77
- ::Thrift::Struct.generate_accessors self
78
- end
79
-
80
- end
81
-
@@ -1,330 +0,0 @@
1
- #
2
- # Autogenerated by Thrift Compiler (0.9.0)
3
- #
4
- # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
- #
6
-
7
- require 'thrift'
8
- require 'debug_proto_test_types'
9
-
10
- module Srv
11
- class Client
12
- include ::Thrift::Client
13
-
14
- def Janky(arg)
15
- send_Janky(arg)
16
- return recv_Janky()
17
- end
18
-
19
- def send_Janky(arg)
20
- send_message('Janky', Janky_args, :arg => arg)
21
- end
22
-
23
- def recv_Janky()
24
- result = receive_message(Janky_result)
25
- return result.success unless result.success.nil?
26
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'Janky failed: unknown result')
27
- end
28
-
29
- def voidMethod()
30
- send_voidMethod()
31
- recv_voidMethod()
32
- end
33
-
34
- def send_voidMethod()
35
- send_message('voidMethod', VoidMethod_args)
36
- end
37
-
38
- def recv_voidMethod()
39
- result = receive_message(VoidMethod_result)
40
- return
41
- end
42
-
43
- def primitiveMethod()
44
- send_primitiveMethod()
45
- return recv_primitiveMethod()
46
- end
47
-
48
- def send_primitiveMethod()
49
- send_message('primitiveMethod', PrimitiveMethod_args)
50
- end
51
-
52
- def recv_primitiveMethod()
53
- result = receive_message(PrimitiveMethod_result)
54
- return result.success unless result.success.nil?
55
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'primitiveMethod failed: unknown result')
56
- end
57
-
58
- def structMethod()
59
- send_structMethod()
60
- return recv_structMethod()
61
- end
62
-
63
- def send_structMethod()
64
- send_message('structMethod', StructMethod_args)
65
- end
66
-
67
- def recv_structMethod()
68
- result = receive_message(StructMethod_result)
69
- return result.success unless result.success.nil?
70
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'structMethod failed: unknown result')
71
- end
72
-
73
- def methodWithDefaultArgs(something)
74
- send_methodWithDefaultArgs(something)
75
- recv_methodWithDefaultArgs()
76
- end
77
-
78
- def send_methodWithDefaultArgs(something)
79
- send_message('methodWithDefaultArgs', MethodWithDefaultArgs_args, :something => something)
80
- end
81
-
82
- def recv_methodWithDefaultArgs()
83
- result = receive_message(MethodWithDefaultArgs_result)
84
- return
85
- end
86
-
87
- def onewayMethod()
88
- send_onewayMethod()
89
- end
90
-
91
- def send_onewayMethod()
92
- send_message('onewayMethod', OnewayMethod_args)
93
- end
94
- end
95
-
96
- class Processor
97
- include ::Thrift::Processor
98
-
99
- def process_Janky(seqid, iprot, oprot)
100
- args = read_args(iprot, Janky_args)
101
- result = Janky_result.new()
102
- result.success = @handler.Janky(args.arg)
103
- write_result(result, oprot, 'Janky', seqid)
104
- end
105
-
106
- def process_voidMethod(seqid, iprot, oprot)
107
- args = read_args(iprot, VoidMethod_args)
108
- result = VoidMethod_result.new()
109
- @handler.voidMethod()
110
- write_result(result, oprot, 'voidMethod', seqid)
111
- end
112
-
113
- def process_primitiveMethod(seqid, iprot, oprot)
114
- args = read_args(iprot, PrimitiveMethod_args)
115
- result = PrimitiveMethod_result.new()
116
- result.success = @handler.primitiveMethod()
117
- write_result(result, oprot, 'primitiveMethod', seqid)
118
- end
119
-
120
- def process_structMethod(seqid, iprot, oprot)
121
- args = read_args(iprot, StructMethod_args)
122
- result = StructMethod_result.new()
123
- result.success = @handler.structMethod()
124
- write_result(result, oprot, 'structMethod', seqid)
125
- end
126
-
127
- def process_methodWithDefaultArgs(seqid, iprot, oprot)
128
- args = read_args(iprot, MethodWithDefaultArgs_args)
129
- result = MethodWithDefaultArgs_result.new()
130
- @handler.methodWithDefaultArgs(args.something)
131
- write_result(result, oprot, 'methodWithDefaultArgs', seqid)
132
- end
133
-
134
- def process_onewayMethod(seqid, iprot, oprot)
135
- args = read_args(iprot, OnewayMethod_args)
136
- @handler.onewayMethod()
137
- return
138
- end
139
-
140
- end
141
-
142
- # HELPER FUNCTIONS AND STRUCTURES
143
-
144
- class Janky_args
145
- include ::Thrift::Struct, ::Thrift::Struct_Union
146
- ARG = 1
147
-
148
- FIELDS = {
149
- ARG => {:type => ::Thrift::Types::I32, :name => 'arg'}
150
- }
151
-
152
- def struct_fields; FIELDS; end
153
-
154
- def validate
155
- end
156
-
157
- ::Thrift::Struct.generate_accessors self
158
- end
159
-
160
- class Janky_result
161
- include ::Thrift::Struct, ::Thrift::Struct_Union
162
- SUCCESS = 0
163
-
164
- FIELDS = {
165
- SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}
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 VoidMethod_args
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 VoidMethod_result
192
- include ::Thrift::Struct, ::Thrift::Struct_Union
193
-
194
- FIELDS = {
195
-
196
- }
197
-
198
- def struct_fields; FIELDS; end
199
-
200
- def validate
201
- end
202
-
203
- ::Thrift::Struct.generate_accessors self
204
- end
205
-
206
- class PrimitiveMethod_args
207
- include ::Thrift::Struct, ::Thrift::Struct_Union
208
-
209
- FIELDS = {
210
-
211
- }
212
-
213
- def struct_fields; FIELDS; end
214
-
215
- def validate
216
- end
217
-
218
- ::Thrift::Struct.generate_accessors self
219
- end
220
-
221
- class PrimitiveMethod_result
222
- include ::Thrift::Struct, ::Thrift::Struct_Union
223
- SUCCESS = 0
224
-
225
- FIELDS = {
226
- SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}
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 StructMethod_args
238
- include ::Thrift::Struct, ::Thrift::Struct_Union
239
-
240
- FIELDS = {
241
-
242
- }
243
-
244
- def struct_fields; FIELDS; end
245
-
246
- def validate
247
- end
248
-
249
- ::Thrift::Struct.generate_accessors self
250
- end
251
-
252
- class StructMethod_result
253
- include ::Thrift::Struct, ::Thrift::Struct_Union
254
- SUCCESS = 0
255
-
256
- FIELDS = {
257
- SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::CompactProtoTestStruct}
258
- }
259
-
260
- def struct_fields; FIELDS; end
261
-
262
- def validate
263
- end
264
-
265
- ::Thrift::Struct.generate_accessors self
266
- end
267
-
268
- class MethodWithDefaultArgs_args
269
- include ::Thrift::Struct, ::Thrift::Struct_Union
270
- SOMETHING = 1
271
-
272
- FIELDS = {
273
- SOMETHING => {:type => ::Thrift::Types::I32, :name => 'something', :default => 2}
274
- }
275
-
276
- def struct_fields; FIELDS; end
277
-
278
- def validate
279
- end
280
-
281
- ::Thrift::Struct.generate_accessors self
282
- end
283
-
284
- class MethodWithDefaultArgs_result
285
- include ::Thrift::Struct, ::Thrift::Struct_Union
286
-
287
- FIELDS = {
288
-
289
- }
290
-
291
- def struct_fields; FIELDS; end
292
-
293
- def validate
294
- end
295
-
296
- ::Thrift::Struct.generate_accessors self
297
- end
298
-
299
- class OnewayMethod_args
300
- include ::Thrift::Struct, ::Thrift::Struct_Union
301
-
302
- FIELDS = {
303
-
304
- }
305
-
306
- def struct_fields; FIELDS; end
307
-
308
- def validate
309
- end
310
-
311
- ::Thrift::Struct.generate_accessors self
312
- end
313
-
314
- class OnewayMethod_result
315
- include ::Thrift::Struct, ::Thrift::Struct_Union
316
-
317
- FIELDS = {
318
-
319
- }
320
-
321
- def struct_fields; FIELDS; end
322
-
323
- def validate
324
- end
325
-
326
- ::Thrift::Struct.generate_accessors self
327
- end
328
-
329
- end
330
-