thrift 0.10.0.0 → 0.11.0.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 (34) hide show
  1. checksums.yaml +4 -4
  2. data/benchmark/gen-rb/benchmark_constants.rb +11 -0
  3. data/benchmark/gen-rb/benchmark_service.rb +80 -0
  4. data/benchmark/gen-rb/benchmark_types.rb +10 -0
  5. data/lib/thrift/processor.rb +10 -1
  6. data/lib/thrift/protocol/json_protocol.rb +1 -1
  7. data/spec/gen-rb/base/base_service.rb +80 -0
  8. data/spec/gen-rb/base/base_service_constants.rb +11 -0
  9. data/spec/gen-rb/base/base_service_types.rb +26 -0
  10. data/spec/gen-rb/extended/extended_service.rb +78 -0
  11. data/spec/gen-rb/extended/extended_service_constants.rb +11 -0
  12. data/spec/gen-rb/extended/extended_service_types.rb +12 -0
  13. data/spec/gen-rb/flat/namespaced_nonblocking_service.rb +272 -0
  14. data/spec/gen-rb/flat/referenced_constants.rb +11 -0
  15. data/spec/gen-rb/flat/referenced_types.rb +17 -0
  16. data/spec/gen-rb/flat/thrift_namespaced_spec_constants.rb +11 -0
  17. data/spec/gen-rb/flat/thrift_namespaced_spec_types.rb +28 -0
  18. data/spec/gen-rb/namespaced_spec_namespace/namespaced_nonblocking_service.rb +272 -0
  19. data/spec/gen-rb/namespaced_spec_namespace/thrift_namespaced_spec_constants.rb +11 -0
  20. data/spec/gen-rb/namespaced_spec_namespace/thrift_namespaced_spec_types.rb +28 -0
  21. data/spec/gen-rb/nonblocking_service.rb +272 -0
  22. data/spec/gen-rb/other_namespace/referenced_constants.rb +11 -0
  23. data/spec/gen-rb/other_namespace/referenced_types.rb +17 -0
  24. data/spec/gen-rb/thrift_spec_constants.rb +11 -0
  25. data/spec/gen-rb/thrift_spec_types.rb +538 -0
  26. data/spec/server_spec.rb +1 -0
  27. data/test/debug_proto/gen-rb/debug_proto_test_constants.rb +278 -0
  28. data/test/debug_proto/gen-rb/debug_proto_test_types.rb +781 -0
  29. data/test/debug_proto/gen-rb/empty_service.rb +28 -0
  30. data/test/debug_proto/gen-rb/inherited.rb +83 -0
  31. data/test/debug_proto/gen-rb/reverse_order_service.rb +86 -0
  32. data/test/debug_proto/gen-rb/service_for_exception_with_a_map.rb +85 -0
  33. data/test/debug_proto/gen-rb/srv.rb +395 -0
  34. metadata +132 -75
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b1c844c7fec342a9de5ce50c17844517c794faf
4
- data.tar.gz: df2069a8d5a3cdfd32e2ab12baecb02754fa28da
3
+ metadata.gz: a9a70c3d1662d7eacf0ec7062e1134d679ebc085
4
+ data.tar.gz: b65b2bbb34d616676940087447e47d487cdb815c
5
5
  SHA512:
6
- metadata.gz: 271e862c9efa8146e3586a47ed561be442c4ebdda6b528f365c307bd951a5e767adfd65da1636555d6ab7274a9d1e72f752be3277362431225b2d15b4234d633
7
- data.tar.gz: fa52270c79fa32b327bd56efd9075cd3e4dfa9476478c419bb71bdcc1129e94ffdebc5ae9069ddf43afa92e3afc044072737e72b987dda57c0652bd800da92fb
6
+ metadata.gz: 4cc1765c1335c36c4473563bab2ef2eacf27540414251e3b94e7b0a0e9ac9a0f637e75f5c64f69b0028c2c402b08d8916d0fb29897f0da37f837d42b07fcac66
7
+ data.tar.gz: 54fdb5210b5f850b4fd1fb6741dbac719d3ad340bcc94b2db8965b807ae701fad140961303f2bb52cd9f10bba2bd9c80d83b1682c9b70e3b15c271faf6e13049
@@ -0,0 +1,11 @@
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
+ require 'benchmark_types'
9
+
10
+ module ThriftBenchmark
11
+ end
@@ -0,0 +1,80 @@
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
+ require 'benchmark_types'
9
+
10
+ module ThriftBenchmark
11
+ module BenchmarkService
12
+ class Client
13
+ include ::Thrift::Client
14
+
15
+ def fibonacci(n)
16
+ send_fibonacci(n)
17
+ return recv_fibonacci()
18
+ end
19
+
20
+ def send_fibonacci(n)
21
+ send_message('fibonacci', Fibonacci_args, :n => n)
22
+ end
23
+
24
+ def recv_fibonacci()
25
+ result = receive_message(Fibonacci_result)
26
+ return result.success unless result.success.nil?
27
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'fibonacci failed: unknown result')
28
+ end
29
+
30
+ end
31
+
32
+ class Processor
33
+ include ::Thrift::Processor
34
+
35
+ def process_fibonacci(seqid, iprot, oprot)
36
+ args = read_args(iprot, Fibonacci_args)
37
+ result = Fibonacci_result.new()
38
+ result.success = @handler.fibonacci(args.n)
39
+ write_result(result, oprot, 'fibonacci', seqid)
40
+ end
41
+
42
+ end
43
+
44
+ # HELPER FUNCTIONS AND STRUCTURES
45
+
46
+ class Fibonacci_args
47
+ include ::Thrift::Struct, ::Thrift::Struct_Union
48
+ N = 1
49
+
50
+ FIELDS = {
51
+ N => {:type => ::Thrift::Types::BYTE, :name => 'n'}
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 Fibonacci_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
+
80
+ end
@@ -0,0 +1,10 @@
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 ThriftBenchmark
10
+ end
@@ -17,10 +17,18 @@
17
17
  # under the License.
18
18
  #
19
19
 
20
+ require 'logger'
21
+
20
22
  module Thrift
21
23
  module Processor
22
- def initialize(handler)
24
+ def initialize(handler, logger=nil)
23
25
  @handler = handler
26
+ if logger.nil?
27
+ @logger = Logger.new(STDERR)
28
+ @logger.level = Logger::WARN
29
+ else
30
+ @logger = logger
31
+ end
24
32
  end
25
33
 
26
34
  def process(iprot, oprot)
@@ -30,6 +38,7 @@ module Thrift
30
38
  send("process_#{name}", seqid, iprot, oprot)
31
39
  rescue => e
32
40
  x = ApplicationException.new(ApplicationException::INTERNAL_ERROR, 'Internal error')
41
+ @logger.debug "Internal error : #{e.message}\n#{e.backtrace.join("\n")}"
33
42
  write_error(x, oprot, name, seqid)
34
43
  end
35
44
  true
@@ -333,7 +333,7 @@ module Thrift
333
333
  # "NaN" or "Infinity" or "-Infinity".
334
334
  def write_json_double(num)
335
335
  @context.write(trans)
336
- # Normalize output of boost::lexical_cast for NaNs and Infinities
336
+ # Normalize output of thrift::to_string for NaNs and Infinities
337
337
  special = false;
338
338
  if (num.nan?)
339
339
  special = true;
@@ -0,0 +1,80 @@
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
+ require 'base/base_service_types'
9
+
10
+ module Base
11
+ module BaseService
12
+ class Client
13
+ include ::Thrift::Client
14
+
15
+ def greeting(english)
16
+ send_greeting(english)
17
+ return recv_greeting()
18
+ end
19
+
20
+ def send_greeting(english)
21
+ send_message('greeting', Greeting_args, :english => english)
22
+ end
23
+
24
+ def recv_greeting()
25
+ result = receive_message(Greeting_result)
26
+ return result.success unless result.success.nil?
27
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'greeting failed: unknown result')
28
+ end
29
+
30
+ end
31
+
32
+ class Processor
33
+ include ::Thrift::Processor
34
+
35
+ def process_greeting(seqid, iprot, oprot)
36
+ args = read_args(iprot, Greeting_args)
37
+ result = Greeting_result.new()
38
+ result.success = @handler.greeting(args.english)
39
+ write_result(result, oprot, 'greeting', seqid)
40
+ end
41
+
42
+ end
43
+
44
+ # HELPER FUNCTIONS AND STRUCTURES
45
+
46
+ class Greeting_args
47
+ include ::Thrift::Struct, ::Thrift::Struct_Union
48
+ ENGLISH = 1
49
+
50
+ FIELDS = {
51
+ ENGLISH => {:type => ::Thrift::Types::BOOL, :name => 'english'}
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 Greeting_result
63
+ include ::Thrift::Struct, ::Thrift::Struct_Union
64
+ SUCCESS = 0
65
+
66
+ FIELDS = {
67
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::Base::Hello}
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
+
80
+ end
@@ -0,0 +1,11 @@
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
+ require 'base/base_service_types'
9
+
10
+ module Base
11
+ end
@@ -0,0 +1,26 @@
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 Base
10
+ class Hello
11
+ include ::Thrift::Struct, ::Thrift::Struct_Union
12
+ GREETING = 1
13
+
14
+ FIELDS = {
15
+ GREETING => {:type => ::Thrift::Types::STRING, :name => 'greeting', :default => %q"hello world"}
16
+ }
17
+
18
+ def struct_fields; FIELDS; end
19
+
20
+ def validate
21
+ end
22
+
23
+ ::Thrift::Struct.generate_accessors self
24
+ end
25
+
26
+ end
@@ -0,0 +1,78 @@
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
+ require 'base/base_service'
9
+ require 'extended/extended_service_types'
10
+
11
+ module Extended
12
+ module ExtendedService
13
+ class Client < ::Base::BaseService::Client
14
+ include ::Thrift::Client
15
+
16
+ def ping()
17
+ send_ping()
18
+ recv_ping()
19
+ end
20
+
21
+ def send_ping()
22
+ send_message('ping', Ping_args)
23
+ end
24
+
25
+ def recv_ping()
26
+ result = receive_message(Ping_result)
27
+ return
28
+ end
29
+
30
+ end
31
+
32
+ class Processor < ::Base::BaseService::Processor
33
+ include ::Thrift::Processor
34
+
35
+ def process_ping(seqid, iprot, oprot)
36
+ args = read_args(iprot, Ping_args)
37
+ result = Ping_result.new()
38
+ @handler.ping()
39
+ write_result(result, oprot, 'ping', seqid)
40
+ end
41
+
42
+ end
43
+
44
+ # HELPER FUNCTIONS AND STRUCTURES
45
+
46
+ class Ping_args
47
+ include ::Thrift::Struct, ::Thrift::Struct_Union
48
+
49
+ FIELDS = {
50
+
51
+ }
52
+
53
+ def struct_fields; FIELDS; end
54
+
55
+ def validate
56
+ end
57
+
58
+ ::Thrift::Struct.generate_accessors self
59
+ end
60
+
61
+ class Ping_result
62
+ include ::Thrift::Struct, ::Thrift::Struct_Union
63
+
64
+ FIELDS = {
65
+
66
+ }
67
+
68
+ def struct_fields; FIELDS; end
69
+
70
+ def validate
71
+ end
72
+
73
+ ::Thrift::Struct.generate_accessors self
74
+ end
75
+
76
+ end
77
+
78
+ end
@@ -0,0 +1,11 @@
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
+ require 'extended/extended_service_types'
9
+
10
+ module Extended
11
+ end
@@ -0,0 +1,12 @@
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
+ require 'base/base_service_types'
9
+
10
+
11
+ module Extended
12
+ end
@@ -0,0 +1,272 @@
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
+ require 'thrift_namespaced_spec_types'
9
+
10
+ module NamespacedSpecNamespace
11
+ module NamespacedNonblockingService
12
+ class Client
13
+ include ::Thrift::Client
14
+
15
+ def greeting(english)
16
+ send_greeting(english)
17
+ return recv_greeting()
18
+ end
19
+
20
+ def send_greeting(english)
21
+ send_message('greeting', Greeting_args, :english => english)
22
+ end
23
+
24
+ def recv_greeting()
25
+ result = receive_message(Greeting_result)
26
+ return result.success unless result.success.nil?
27
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'greeting failed: unknown result')
28
+ end
29
+
30
+ def block()
31
+ send_block()
32
+ return recv_block()
33
+ end
34
+
35
+ def send_block()
36
+ send_message('block', Block_args)
37
+ end
38
+
39
+ def recv_block()
40
+ result = receive_message(Block_result)
41
+ return result.success unless result.success.nil?
42
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'block failed: unknown result')
43
+ end
44
+
45
+ def unblock(n)
46
+ send_unblock(n)
47
+ end
48
+
49
+ def send_unblock(n)
50
+ send_oneway_message('unblock', Unblock_args, :n => n)
51
+ end
52
+ def shutdown()
53
+ send_shutdown()
54
+ end
55
+
56
+ def send_shutdown()
57
+ send_oneway_message('shutdown', Shutdown_args)
58
+ end
59
+ def sleep(seconds)
60
+ send_sleep(seconds)
61
+ recv_sleep()
62
+ end
63
+
64
+ def send_sleep(seconds)
65
+ send_message('sleep', Sleep_args, :seconds => seconds)
66
+ end
67
+
68
+ def recv_sleep()
69
+ result = receive_message(Sleep_result)
70
+ return
71
+ end
72
+
73
+ end
74
+
75
+ class Processor
76
+ include ::Thrift::Processor
77
+
78
+ def process_greeting(seqid, iprot, oprot)
79
+ args = read_args(iprot, Greeting_args)
80
+ result = Greeting_result.new()
81
+ result.success = @handler.greeting(args.english)
82
+ write_result(result, oprot, 'greeting', seqid)
83
+ end
84
+
85
+ def process_block(seqid, iprot, oprot)
86
+ args = read_args(iprot, Block_args)
87
+ result = Block_result.new()
88
+ result.success = @handler.block()
89
+ write_result(result, oprot, 'block', seqid)
90
+ end
91
+
92
+ def process_unblock(seqid, iprot, oprot)
93
+ args = read_args(iprot, Unblock_args)
94
+ @handler.unblock(args.n)
95
+ return
96
+ end
97
+
98
+ def process_shutdown(seqid, iprot, oprot)
99
+ args = read_args(iprot, Shutdown_args)
100
+ @handler.shutdown()
101
+ return
102
+ end
103
+
104
+ def process_sleep(seqid, iprot, oprot)
105
+ args = read_args(iprot, Sleep_args)
106
+ result = Sleep_result.new()
107
+ @handler.sleep(args.seconds)
108
+ write_result(result, oprot, 'sleep', seqid)
109
+ end
110
+
111
+ end
112
+
113
+ # HELPER FUNCTIONS AND STRUCTURES
114
+
115
+ class Greeting_args
116
+ include ::Thrift::Struct, ::Thrift::Struct_Union
117
+ ENGLISH = 1
118
+
119
+ FIELDS = {
120
+ ENGLISH => {:type => ::Thrift::Types::BOOL, :name => 'english'}
121
+ }
122
+
123
+ def struct_fields; FIELDS; end
124
+
125
+ def validate
126
+ end
127
+
128
+ ::Thrift::Struct.generate_accessors self
129
+ end
130
+
131
+ class Greeting_result
132
+ include ::Thrift::Struct, ::Thrift::Struct_Union
133
+ SUCCESS = 0
134
+
135
+ FIELDS = {
136
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::NamespacedSpecNamespace::Hello}
137
+ }
138
+
139
+ def struct_fields; FIELDS; end
140
+
141
+ def validate
142
+ end
143
+
144
+ ::Thrift::Struct.generate_accessors self
145
+ end
146
+
147
+ class Block_args
148
+ include ::Thrift::Struct, ::Thrift::Struct_Union
149
+
150
+ FIELDS = {
151
+
152
+ }
153
+
154
+ def struct_fields; FIELDS; end
155
+
156
+ def validate
157
+ end
158
+
159
+ ::Thrift::Struct.generate_accessors self
160
+ end
161
+
162
+ class Block_result
163
+ include ::Thrift::Struct, ::Thrift::Struct_Union
164
+ SUCCESS = 0
165
+
166
+ FIELDS = {
167
+ SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'}
168
+ }
169
+
170
+ def struct_fields; FIELDS; end
171
+
172
+ def validate
173
+ end
174
+
175
+ ::Thrift::Struct.generate_accessors self
176
+ end
177
+
178
+ class Unblock_args
179
+ include ::Thrift::Struct, ::Thrift::Struct_Union
180
+ N = 1
181
+
182
+ FIELDS = {
183
+ N => {:type => ::Thrift::Types::I32, :name => 'n'}
184
+ }
185
+
186
+ def struct_fields; FIELDS; end
187
+
188
+ def validate
189
+ end
190
+
191
+ ::Thrift::Struct.generate_accessors self
192
+ end
193
+
194
+ class Unblock_result
195
+ include ::Thrift::Struct, ::Thrift::Struct_Union
196
+
197
+ FIELDS = {
198
+
199
+ }
200
+
201
+ def struct_fields; FIELDS; end
202
+
203
+ def validate
204
+ end
205
+
206
+ ::Thrift::Struct.generate_accessors self
207
+ end
208
+
209
+ class Shutdown_args
210
+ include ::Thrift::Struct, ::Thrift::Struct_Union
211
+
212
+ FIELDS = {
213
+
214
+ }
215
+
216
+ def struct_fields; FIELDS; end
217
+
218
+ def validate
219
+ end
220
+
221
+ ::Thrift::Struct.generate_accessors self
222
+ end
223
+
224
+ class Shutdown_result
225
+ include ::Thrift::Struct, ::Thrift::Struct_Union
226
+
227
+ FIELDS = {
228
+
229
+ }
230
+
231
+ def struct_fields; FIELDS; end
232
+
233
+ def validate
234
+ end
235
+
236
+ ::Thrift::Struct.generate_accessors self
237
+ end
238
+
239
+ class Sleep_args
240
+ include ::Thrift::Struct, ::Thrift::Struct_Union
241
+ SECONDS = 1
242
+
243
+ FIELDS = {
244
+ SECONDS => {:type => ::Thrift::Types::DOUBLE, :name => 'seconds'}
245
+ }
246
+
247
+ def struct_fields; FIELDS; end
248
+
249
+ def validate
250
+ end
251
+
252
+ ::Thrift::Struct.generate_accessors self
253
+ end
254
+
255
+ class Sleep_result
256
+ include ::Thrift::Struct, ::Thrift::Struct_Union
257
+
258
+ FIELDS = {
259
+
260
+ }
261
+
262
+ def struct_fields; FIELDS; end
263
+
264
+ def validate
265
+ end
266
+
267
+ ::Thrift::Struct.generate_accessors self
268
+ end
269
+
270
+ end
271
+
272
+ end