thrift 0.2.0.4 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1 -13
- data/Manifest +11 -23
- data/Rakefile +8 -6
- data/ext/binary_protocol_accelerated.c +4 -53
- data/ext/compact_protocol.c +3 -53
- data/ext/extconf.rb +4 -18
- data/ext/struct.c +181 -130
- data/ext/struct.h +2 -44
- data/ext/thrift_native.c +3 -3
- data/lib/thrift.rb +6 -1
- data/lib/thrift/protocol/binary_protocol_accelerated.rb +5 -1
- data/lib/thrift/protocol/compact_protocol.rb +1 -0
- data/lib/thrift/server/nonblocking_server.rb +1 -2
- data/lib/thrift/struct.rb +46 -112
- data/lib/thrift/struct_union.rb +159 -0
- data/lib/thrift/transport/http_client_transport.rb +12 -6
- data/lib/thrift/transport/memory_buffer_transport.rb +2 -2
- data/lib/thrift/types.rb +1 -1
- data/lib/thrift/union.rb +179 -0
- data/spec/ThriftSpec.thrift +48 -0
- data/spec/binary_protocol_accelerated_spec.rb +18 -13
- data/spec/binary_protocol_spec_shared.rb +2 -2
- data/spec/compact_protocol_spec.rb +19 -3
- data/spec/http_client_spec.rb +17 -2
- data/spec/struct_spec.rb +34 -0
- data/spec/union_spec.rb +193 -0
- data/thrift.gemspec +11 -13
- metadata +36 -67
- data.tar.gz.sig +0 -2
- data/Makefile.am +0 -47
- data/benchmark/gen-rb/BenchmarkService.rb +0 -81
- data/benchmark/gen-rb/Benchmark_constants.rb +0 -11
- data/benchmark/gen-rb/Benchmark_types.rb +0 -10
- data/lib/thrift/protocol/binaryprotocol.rb +0 -213
- data/lib/thrift/protocol/binaryprotocolaccelerated.rb +0 -19
- data/lib/thrift/protocol/tbinaryprotocol.rb +0 -2
- data/lib/thrift/protocol/tprotocol.rb +0 -2
- data/lib/thrift/server/httpserver.rb +0 -44
- data/lib/thrift/server/nonblockingserver.rb +0 -278
- data/lib/thrift/server/thttpserver.rb +0 -2
- data/lib/thrift/server/tserver.rb +0 -2
- data/spec/gen-rb/NonblockingService.rb +0 -268
- data/spec/gen-rb/ThriftSpec_constants.rb +0 -11
- data/spec/gen-rb/ThriftSpec_types.rb +0 -134
- metadata.gz.sig +0 -0
@@ -1,268 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Autogenerated by Thrift
|
3
|
-
#
|
4
|
-
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
-
#
|
6
|
-
|
7
|
-
require 'thrift'
|
8
|
-
require 'thrift/protocol'
|
9
|
-
require File.dirname(__FILE__) + '/ThriftSpec_types'
|
10
|
-
|
11
|
-
module SpecNamespace
|
12
|
-
module NonblockingService
|
13
|
-
class Client
|
14
|
-
include ::Thrift::Client
|
15
|
-
|
16
|
-
def greeting(english)
|
17
|
-
send_greeting(english)
|
18
|
-
return recv_greeting()
|
19
|
-
end
|
20
|
-
|
21
|
-
def send_greeting(english)
|
22
|
-
send_message('greeting', Greeting_args, :english => english)
|
23
|
-
end
|
24
|
-
|
25
|
-
def recv_greeting()
|
26
|
-
result = receive_message(Greeting_result)
|
27
|
-
return result.success unless result.success.nil?
|
28
|
-
raise Thrift::ApplicationException.new(Thrift::ApplicationException::MISSING_RESULT, 'greeting failed: unknown result')
|
29
|
-
end
|
30
|
-
|
31
|
-
def block()
|
32
|
-
send_block()
|
33
|
-
return recv_block()
|
34
|
-
end
|
35
|
-
|
36
|
-
def send_block()
|
37
|
-
send_message('block', Block_args)
|
38
|
-
end
|
39
|
-
|
40
|
-
def recv_block()
|
41
|
-
result = receive_message(Block_result)
|
42
|
-
return result.success unless result.success.nil?
|
43
|
-
raise Thrift::ApplicationException.new(Thrift::ApplicationException::MISSING_RESULT, 'block failed: unknown result')
|
44
|
-
end
|
45
|
-
|
46
|
-
def unblock(n)
|
47
|
-
send_unblock(n)
|
48
|
-
end
|
49
|
-
|
50
|
-
def send_unblock(n)
|
51
|
-
send_message('unblock', Unblock_args, :n => n)
|
52
|
-
end
|
53
|
-
def shutdown()
|
54
|
-
send_shutdown()
|
55
|
-
end
|
56
|
-
|
57
|
-
def send_shutdown()
|
58
|
-
send_message('shutdown', Shutdown_args)
|
59
|
-
end
|
60
|
-
def sleep(seconds)
|
61
|
-
send_sleep(seconds)
|
62
|
-
recv_sleep()
|
63
|
-
end
|
64
|
-
|
65
|
-
def send_sleep(seconds)
|
66
|
-
send_message('sleep', Sleep_args, :seconds => seconds)
|
67
|
-
end
|
68
|
-
|
69
|
-
def recv_sleep()
|
70
|
-
result = receive_message(Sleep_result)
|
71
|
-
return
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
class Processor
|
77
|
-
include ::Thrift::Processor
|
78
|
-
|
79
|
-
def process_greeting(seqid, iprot, oprot)
|
80
|
-
args = read_args(iprot, Greeting_args)
|
81
|
-
result = Greeting_result.new()
|
82
|
-
result.success = @handler.greeting(args.english)
|
83
|
-
write_result(result, oprot, 'greeting', seqid)
|
84
|
-
end
|
85
|
-
|
86
|
-
def process_block(seqid, iprot, oprot)
|
87
|
-
args = read_args(iprot, Block_args)
|
88
|
-
result = Block_result.new()
|
89
|
-
result.success = @handler.block()
|
90
|
-
write_result(result, oprot, 'block', seqid)
|
91
|
-
end
|
92
|
-
|
93
|
-
def process_unblock(seqid, iprot, oprot)
|
94
|
-
args = read_args(iprot, Unblock_args)
|
95
|
-
@handler.unblock(args.n)
|
96
|
-
return
|
97
|
-
end
|
98
|
-
|
99
|
-
def process_shutdown(seqid, iprot, oprot)
|
100
|
-
args = read_args(iprot, Shutdown_args)
|
101
|
-
@handler.shutdown()
|
102
|
-
return
|
103
|
-
end
|
104
|
-
|
105
|
-
def process_sleep(seqid, iprot, oprot)
|
106
|
-
args = read_args(iprot, Sleep_args)
|
107
|
-
result = Sleep_result.new()
|
108
|
-
@handler.sleep(args.seconds)
|
109
|
-
write_result(result, oprot, 'sleep', seqid)
|
110
|
-
end
|
111
|
-
|
112
|
-
end
|
113
|
-
|
114
|
-
# HELPER FUNCTIONS AND STRUCTURES
|
115
|
-
|
116
|
-
class Greeting_args
|
117
|
-
include ::Thrift::Struct
|
118
|
-
ENGLISH = 1
|
119
|
-
|
120
|
-
Thrift::Struct.field_accessor self, :english
|
121
|
-
FIELDS = {
|
122
|
-
ENGLISH => {:type => Thrift::Types::BOOL, :name => 'english'}
|
123
|
-
}
|
124
|
-
|
125
|
-
def struct_fields; FIELDS; end
|
126
|
-
|
127
|
-
def validate
|
128
|
-
end
|
129
|
-
|
130
|
-
end
|
131
|
-
|
132
|
-
class Greeting_result
|
133
|
-
include ::Thrift::Struct
|
134
|
-
SUCCESS = 0
|
135
|
-
|
136
|
-
Thrift::Struct.field_accessor self, :success
|
137
|
-
FIELDS = {
|
138
|
-
SUCCESS => {:type => Thrift::Types::STRUCT, :name => 'success', :class => SpecNamespace::Hello}
|
139
|
-
}
|
140
|
-
|
141
|
-
def struct_fields; FIELDS; end
|
142
|
-
|
143
|
-
def validate
|
144
|
-
end
|
145
|
-
|
146
|
-
end
|
147
|
-
|
148
|
-
class Block_args
|
149
|
-
include ::Thrift::Struct
|
150
|
-
|
151
|
-
FIELDS = {
|
152
|
-
|
153
|
-
}
|
154
|
-
|
155
|
-
def struct_fields; FIELDS; end
|
156
|
-
|
157
|
-
def validate
|
158
|
-
end
|
159
|
-
|
160
|
-
end
|
161
|
-
|
162
|
-
class Block_result
|
163
|
-
include ::Thrift::Struct
|
164
|
-
SUCCESS = 0
|
165
|
-
|
166
|
-
Thrift::Struct.field_accessor self, :success
|
167
|
-
FIELDS = {
|
168
|
-
SUCCESS => {:type => Thrift::Types::BOOL, :name => 'success'}
|
169
|
-
}
|
170
|
-
|
171
|
-
def struct_fields; FIELDS; end
|
172
|
-
|
173
|
-
def validate
|
174
|
-
end
|
175
|
-
|
176
|
-
end
|
177
|
-
|
178
|
-
class Unblock_args
|
179
|
-
include ::Thrift::Struct
|
180
|
-
N = 1
|
181
|
-
|
182
|
-
Thrift::Struct.field_accessor self, :n
|
183
|
-
FIELDS = {
|
184
|
-
N => {:type => Thrift::Types::I32, :name => 'n'}
|
185
|
-
}
|
186
|
-
|
187
|
-
def struct_fields; FIELDS; end
|
188
|
-
|
189
|
-
def validate
|
190
|
-
end
|
191
|
-
|
192
|
-
end
|
193
|
-
|
194
|
-
class Unblock_result
|
195
|
-
include ::Thrift::Struct
|
196
|
-
|
197
|
-
FIELDS = {
|
198
|
-
|
199
|
-
}
|
200
|
-
|
201
|
-
def struct_fields; FIELDS; end
|
202
|
-
|
203
|
-
def validate
|
204
|
-
end
|
205
|
-
|
206
|
-
end
|
207
|
-
|
208
|
-
class Shutdown_args
|
209
|
-
include ::Thrift::Struct
|
210
|
-
|
211
|
-
FIELDS = {
|
212
|
-
|
213
|
-
}
|
214
|
-
|
215
|
-
def struct_fields; FIELDS; end
|
216
|
-
|
217
|
-
def validate
|
218
|
-
end
|
219
|
-
|
220
|
-
end
|
221
|
-
|
222
|
-
class Shutdown_result
|
223
|
-
include ::Thrift::Struct
|
224
|
-
|
225
|
-
FIELDS = {
|
226
|
-
|
227
|
-
}
|
228
|
-
|
229
|
-
def struct_fields; FIELDS; end
|
230
|
-
|
231
|
-
def validate
|
232
|
-
end
|
233
|
-
|
234
|
-
end
|
235
|
-
|
236
|
-
class Sleep_args
|
237
|
-
include ::Thrift::Struct
|
238
|
-
SECONDS = 1
|
239
|
-
|
240
|
-
Thrift::Struct.field_accessor self, :seconds
|
241
|
-
FIELDS = {
|
242
|
-
SECONDS => {:type => Thrift::Types::DOUBLE, :name => 'seconds'}
|
243
|
-
}
|
244
|
-
|
245
|
-
def struct_fields; FIELDS; end
|
246
|
-
|
247
|
-
def validate
|
248
|
-
end
|
249
|
-
|
250
|
-
end
|
251
|
-
|
252
|
-
class Sleep_result
|
253
|
-
include ::Thrift::Struct
|
254
|
-
|
255
|
-
FIELDS = {
|
256
|
-
|
257
|
-
}
|
258
|
-
|
259
|
-
def struct_fields; FIELDS; end
|
260
|
-
|
261
|
-
def validate
|
262
|
-
end
|
263
|
-
|
264
|
-
end
|
265
|
-
|
266
|
-
end
|
267
|
-
|
268
|
-
end
|
@@ -1,134 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Autogenerated by Thrift
|
3
|
-
#
|
4
|
-
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
-
#
|
6
|
-
|
7
|
-
require 'thrift/protocol'
|
8
|
-
|
9
|
-
module SpecNamespace
|
10
|
-
class Hello
|
11
|
-
include ::Thrift::Struct
|
12
|
-
GREETING = 1
|
13
|
-
|
14
|
-
Thrift::Struct.field_accessor self, :greeting
|
15
|
-
FIELDS = {
|
16
|
-
GREETING => {:type => Thrift::Types::STRING, :name => 'greeting', :default => %q"hello world"}
|
17
|
-
}
|
18
|
-
|
19
|
-
def struct_fields; FIELDS; end
|
20
|
-
|
21
|
-
def validate
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
class Foo
|
27
|
-
include ::Thrift::Struct
|
28
|
-
SIMPLE = 1
|
29
|
-
WORDS = 2
|
30
|
-
HELLO = 3
|
31
|
-
INTS = 4
|
32
|
-
COMPLEX = 5
|
33
|
-
SHORTS = 6
|
34
|
-
OPT_STRING = 7
|
35
|
-
|
36
|
-
Thrift::Struct.field_accessor self, :simple, :words, :hello, :ints, :complex, :shorts, :opt_string
|
37
|
-
FIELDS = {
|
38
|
-
SIMPLE => {:type => Thrift::Types::I32, :name => 'simple', :default => 53},
|
39
|
-
WORDS => {:type => Thrift::Types::STRING, :name => 'words', :default => %q"words"},
|
40
|
-
HELLO => {:type => Thrift::Types::STRUCT, :name => 'hello', :default => Hello.new({
|
41
|
-
%q"greeting" => %q"hello, world!",
|
42
|
-
}), :class => SpecNamespace::Hello},
|
43
|
-
INTS => {:type => Thrift::Types::LIST, :name => 'ints', :default => [
|
44
|
-
1,
|
45
|
-
2,
|
46
|
-
2,
|
47
|
-
3,
|
48
|
-
], :element => {:type => Thrift::Types::I32}},
|
49
|
-
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}}},
|
50
|
-
SHORTS => {:type => Thrift::Types::SET, :name => 'shorts', :default => Set.new([ 5,
|
51
|
-
17,
|
52
|
-
239,
|
53
|
-
]), :element => {:type => Thrift::Types::I16}},
|
54
|
-
OPT_STRING => {:type => Thrift::Types::STRING, :name => 'opt_string', :optional => true}
|
55
|
-
}
|
56
|
-
|
57
|
-
def struct_fields; FIELDS; end
|
58
|
-
|
59
|
-
def validate
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
class BoolStruct
|
65
|
-
include ::Thrift::Struct
|
66
|
-
YESNO = 1
|
67
|
-
|
68
|
-
Thrift::Struct.field_accessor self, :yesno
|
69
|
-
FIELDS = {
|
70
|
-
YESNO => {:type => Thrift::Types::BOOL, :name => 'yesno', :default => true}
|
71
|
-
}
|
72
|
-
|
73
|
-
def struct_fields; FIELDS; end
|
74
|
-
|
75
|
-
def validate
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
79
|
-
|
80
|
-
class SimpleList
|
81
|
-
include ::Thrift::Struct
|
82
|
-
BOOLS = 1
|
83
|
-
BYTES = 2
|
84
|
-
I16S = 3
|
85
|
-
I32S = 4
|
86
|
-
I64S = 5
|
87
|
-
DOUBLES = 6
|
88
|
-
STRINGS = 7
|
89
|
-
MAPS = 8
|
90
|
-
LISTS = 9
|
91
|
-
SETS = 10
|
92
|
-
HELLOS = 11
|
93
|
-
|
94
|
-
Thrift::Struct.field_accessor self, :bools, :bytes, :i16s, :i32s, :i64s, :doubles, :strings, :maps, :lists, :sets, :hellos
|
95
|
-
FIELDS = {
|
96
|
-
BOOLS => {:type => Thrift::Types::LIST, :name => 'bools', :element => {:type => Thrift::Types::BOOL}},
|
97
|
-
BYTES => {:type => Thrift::Types::LIST, :name => 'bytes', :element => {:type => Thrift::Types::BYTE}},
|
98
|
-
I16S => {:type => Thrift::Types::LIST, :name => 'i16s', :element => {:type => Thrift::Types::I16}},
|
99
|
-
I32S => {:type => Thrift::Types::LIST, :name => 'i32s', :element => {:type => Thrift::Types::I32}},
|
100
|
-
I64S => {:type => Thrift::Types::LIST, :name => 'i64s', :element => {:type => Thrift::Types::I64}},
|
101
|
-
DOUBLES => {:type => Thrift::Types::LIST, :name => 'doubles', :element => {:type => Thrift::Types::DOUBLE}},
|
102
|
-
STRINGS => {:type => Thrift::Types::LIST, :name => 'strings', :element => {:type => Thrift::Types::STRING}},
|
103
|
-
MAPS => {:type => Thrift::Types::LIST, :name => 'maps', :element => {:type => Thrift::Types::MAP, :key => {:type => Thrift::Types::I16}, :value => {:type => Thrift::Types::I16}}},
|
104
|
-
LISTS => {:type => Thrift::Types::LIST, :name => 'lists', :element => {:type => Thrift::Types::LIST, :element => {:type => Thrift::Types::I16}}},
|
105
|
-
SETS => {:type => Thrift::Types::LIST, :name => 'sets', :element => {:type => Thrift::Types::SET, :element => {:type => Thrift::Types::I16}}},
|
106
|
-
HELLOS => {:type => Thrift::Types::LIST, :name => 'hellos', :element => {:type => Thrift::Types::STRUCT, :class => SpecNamespace::Hello}}
|
107
|
-
}
|
108
|
-
|
109
|
-
def struct_fields; FIELDS; end
|
110
|
-
|
111
|
-
def validate
|
112
|
-
end
|
113
|
-
|
114
|
-
end
|
115
|
-
|
116
|
-
class Xception < Thrift::Exception
|
117
|
-
include ::Thrift::Struct
|
118
|
-
MESSAGE = 1
|
119
|
-
CODE = 2
|
120
|
-
|
121
|
-
Thrift::Struct.field_accessor self, :message, :code
|
122
|
-
FIELDS = {
|
123
|
-
MESSAGE => {:type => Thrift::Types::STRING, :name => 'message'},
|
124
|
-
CODE => {:type => Thrift::Types::I32, :name => 'code', :default => 1}
|
125
|
-
}
|
126
|
-
|
127
|
-
def struct_fields; FIELDS; end
|
128
|
-
|
129
|
-
def validate
|
130
|
-
end
|
131
|
-
|
132
|
-
end
|
133
|
-
|
134
|
-
end
|
metadata.gz.sig
DELETED
Binary file
|