upfluence-thrift 1.0.1
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.
- checksums.yaml +7 -0
- data/README.md +43 -0
- data/benchmark/Benchmark.thrift +24 -0
- data/benchmark/benchmark.rb +271 -0
- data/benchmark/client.rb +74 -0
- data/benchmark/gen-rb/benchmark_constants.rb +11 -0
- data/benchmark/gen-rb/benchmark_service.rb +80 -0
- data/benchmark/gen-rb/benchmark_types.rb +10 -0
- data/benchmark/server.rb +82 -0
- data/benchmark/thin_server.rb +44 -0
- data/ext/binary_protocol_accelerated.c +460 -0
- data/ext/binary_protocol_accelerated.h +20 -0
- data/ext/bytes.c +36 -0
- data/ext/bytes.h +31 -0
- data/ext/compact_protocol.c +637 -0
- data/ext/compact_protocol.h +20 -0
- data/ext/constants.h +99 -0
- data/ext/extconf.rb +34 -0
- data/ext/macros.h +41 -0
- data/ext/memory_buffer.c +134 -0
- data/ext/memory_buffer.h +20 -0
- data/ext/protocol.c +0 -0
- data/ext/protocol.h +0 -0
- data/ext/strlcpy.c +41 -0
- data/ext/strlcpy.h +34 -0
- data/ext/struct.c +707 -0
- data/ext/struct.h +25 -0
- data/ext/thrift_native.c +201 -0
- data/lib/thrift.rb +68 -0
- data/lib/thrift/bytes.rb +131 -0
- data/lib/thrift/client.rb +71 -0
- data/lib/thrift/core_ext.rb +23 -0
- data/lib/thrift/core_ext/fixnum.rb +29 -0
- data/lib/thrift/exceptions.rb +87 -0
- data/lib/thrift/multiplexed_processor.rb +76 -0
- data/lib/thrift/processor.rb +57 -0
- data/lib/thrift/protocol/base_protocol.rb +379 -0
- data/lib/thrift/protocol/binary_protocol.rb +237 -0
- data/lib/thrift/protocol/binary_protocol_accelerated.rb +39 -0
- data/lib/thrift/protocol/compact_protocol.rb +435 -0
- data/lib/thrift/protocol/json_protocol.rb +769 -0
- data/lib/thrift/protocol/multiplexed_protocol.rb +40 -0
- data/lib/thrift/protocol/protocol_decorator.rb +194 -0
- data/lib/thrift/serializer/deserializer.rb +33 -0
- data/lib/thrift/serializer/serializer.rb +34 -0
- data/lib/thrift/server/base_server.rb +31 -0
- data/lib/thrift/server/mongrel_http_server.rb +60 -0
- data/lib/thrift/server/nonblocking_server.rb +305 -0
- data/lib/thrift/server/rack_application.rb +61 -0
- data/lib/thrift/server/simple_server.rb +43 -0
- data/lib/thrift/server/thin_http_server.rb +51 -0
- data/lib/thrift/server/thread_pool_server.rb +75 -0
- data/lib/thrift/server/threaded_server.rb +47 -0
- data/lib/thrift/struct.rb +237 -0
- data/lib/thrift/struct_union.rb +192 -0
- data/lib/thrift/thrift_native.rb +24 -0
- data/lib/thrift/transport/base_server_transport.rb +37 -0
- data/lib/thrift/transport/base_transport.rb +109 -0
- data/lib/thrift/transport/buffered_transport.rb +114 -0
- data/lib/thrift/transport/framed_transport.rb +117 -0
- data/lib/thrift/transport/http_client_transport.rb +56 -0
- data/lib/thrift/transport/io_stream_transport.rb +39 -0
- data/lib/thrift/transport/memory_buffer_transport.rb +125 -0
- data/lib/thrift/transport/server_socket.rb +63 -0
- data/lib/thrift/transport/socket.rb +139 -0
- data/lib/thrift/transport/unix_server_socket.rb +60 -0
- data/lib/thrift/transport/unix_socket.rb +40 -0
- data/lib/thrift/types.rb +101 -0
- data/lib/thrift/union.rb +179 -0
- data/spec/BaseService.thrift +27 -0
- data/spec/ExtendedService.thrift +25 -0
- data/spec/Referenced.thrift +44 -0
- data/spec/ThriftNamespacedSpec.thrift +53 -0
- data/spec/ThriftSpec.thrift +183 -0
- data/spec/base_protocol_spec.rb +217 -0
- data/spec/base_transport_spec.rb +350 -0
- data/spec/binary_protocol_accelerated_spec.rb +42 -0
- data/spec/binary_protocol_spec.rb +66 -0
- data/spec/binary_protocol_spec_shared.rb +455 -0
- data/spec/bytes_spec.rb +160 -0
- data/spec/client_spec.rb +99 -0
- data/spec/compact_protocol_spec.rb +143 -0
- data/spec/exception_spec.rb +141 -0
- data/spec/flat_spec.rb +62 -0
- data/spec/gen-rb/base/base_service.rb +80 -0
- data/spec/gen-rb/base/base_service_constants.rb +11 -0
- data/spec/gen-rb/base/base_service_types.rb +26 -0
- data/spec/gen-rb/extended/extended_service.rb +78 -0
- data/spec/gen-rb/extended/extended_service_constants.rb +11 -0
- data/spec/gen-rb/extended/extended_service_types.rb +12 -0
- data/spec/gen-rb/flat/namespaced_nonblocking_service.rb +272 -0
- data/spec/gen-rb/flat/referenced_constants.rb +11 -0
- data/spec/gen-rb/flat/referenced_types.rb +17 -0
- data/spec/gen-rb/flat/thrift_namespaced_spec_constants.rb +11 -0
- data/spec/gen-rb/flat/thrift_namespaced_spec_types.rb +28 -0
- data/spec/gen-rb/namespaced_spec_namespace/namespaced_nonblocking_service.rb +272 -0
- data/spec/gen-rb/namespaced_spec_namespace/thrift_namespaced_spec_constants.rb +11 -0
- data/spec/gen-rb/namespaced_spec_namespace/thrift_namespaced_spec_types.rb +28 -0
- data/spec/gen-rb/nonblocking_service.rb +272 -0
- data/spec/gen-rb/other_namespace/referenced_constants.rb +11 -0
- data/spec/gen-rb/other_namespace/referenced_types.rb +17 -0
- data/spec/gen-rb/thrift_spec_constants.rb +11 -0
- data/spec/gen-rb/thrift_spec_types.rb +538 -0
- data/spec/http_client_spec.rb +120 -0
- data/spec/json_protocol_spec.rb +513 -0
- data/spec/namespaced_spec.rb +67 -0
- data/spec/nonblocking_server_spec.rb +263 -0
- data/spec/processor_spec.rb +80 -0
- data/spec/serializer_spec.rb +67 -0
- data/spec/server_socket_spec.rb +79 -0
- data/spec/server_spec.rb +147 -0
- data/spec/socket_spec.rb +61 -0
- data/spec/socket_spec_shared.rb +104 -0
- data/spec/spec_helper.rb +64 -0
- data/spec/struct_nested_containers_spec.rb +191 -0
- data/spec/struct_spec.rb +293 -0
- data/spec/thin_http_server_spec.rb +141 -0
- data/spec/types_spec.rb +115 -0
- data/spec/union_spec.rb +203 -0
- data/spec/unix_socket_spec.rb +107 -0
- data/test/debug_proto/gen-rb/debug_proto_test_constants.rb +274 -0
- data/test/debug_proto/gen-rb/debug_proto_test_types.rb +761 -0
- data/test/debug_proto/gen-rb/empty_service.rb +24 -0
- data/test/debug_proto/gen-rb/inherited.rb +79 -0
- data/test/debug_proto/gen-rb/reverse_order_service.rb +82 -0
- data/test/debug_proto/gen-rb/service_for_exception_with_a_map.rb +81 -0
- data/test/debug_proto/gen-rb/srv.rb +330 -0
- metadata +388 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift Compiler (1.0.0-upfluence)
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'thrift'
|
8
|
+
|
9
|
+
module OtherNamespace
|
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
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift Compiler (1.0.0-upfluence)
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'thrift'
|
8
|
+
require 'referenced_types'
|
9
|
+
|
10
|
+
|
11
|
+
module NamespacedSpecNamespace
|
12
|
+
class Hello
|
13
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
14
|
+
GREETING = 1
|
15
|
+
|
16
|
+
FIELDS = {
|
17
|
+
GREETING => {:type => ::Thrift::Types::STRING, :name => 'greeting', :default => %q"hello world"}
|
18
|
+
}
|
19
|
+
|
20
|
+
def struct_fields; FIELDS; end
|
21
|
+
|
22
|
+
def validate
|
23
|
+
end
|
24
|
+
|
25
|
+
::Thrift::Struct.generate_accessors self
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,272 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift Compiler (1.0.0-upfluence)
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'thrift'
|
8
|
+
require 'namespaced_spec_namespace/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
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift Compiler (1.0.0-upfluence)
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'thrift'
|
8
|
+
require 'namespaced_spec_namespace/thrift_namespaced_spec_types'
|
9
|
+
|
10
|
+
module NamespacedSpecNamespace
|
11
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift Compiler (1.0.0-upfluence)
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'thrift'
|
8
|
+
require 'other_namespace/referenced_types'
|
9
|
+
|
10
|
+
|
11
|
+
module NamespacedSpecNamespace
|
12
|
+
class Hello
|
13
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
14
|
+
GREETING = 1
|
15
|
+
|
16
|
+
FIELDS = {
|
17
|
+
GREETING => {:type => ::Thrift::Types::STRING, :name => 'greeting', :default => %q"hello world"}
|
18
|
+
}
|
19
|
+
|
20
|
+
def struct_fields; FIELDS; end
|
21
|
+
|
22
|
+
def validate
|
23
|
+
end
|
24
|
+
|
25
|
+
::Thrift::Struct.generate_accessors self
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,272 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift Compiler (1.0.0-upfluence)
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'thrift'
|
8
|
+
require 'thrift_spec_types'
|
9
|
+
|
10
|
+
module SpecNamespace
|
11
|
+
module NonblockingService
|
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 => ::SpecNamespace::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
|