thrift 0.6.0 → 0.7.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.
- data/InstalledFiles +1 -0
- data/Makefile +512 -0
- data/Makefile.am +3 -1
- data/Makefile.in +117 -45
- data/Manifest +17 -0
- data/Rakefile +6 -8
- data/benchmark/gen-rb/benchmark_constants.rb +10 -0
- data/benchmark/gen-rb/benchmark_service.rb +80 -0
- data/benchmark/gen-rb/benchmark_types.rb +9 -0
- data/debug_proto_test/gen-rb/debug_proto_test_constants.rb +273 -0
- data/debug_proto_test/gen-rb/debug_proto_test_types.rb +705 -0
- data/debug_proto_test/gen-rb/empty_service.rb +24 -0
- data/debug_proto_test/gen-rb/inherited.rb +79 -0
- data/debug_proto_test/gen-rb/reverse_order_service.rb +82 -0
- data/debug_proto_test/gen-rb/service_for_exception_with_a_map.rb +81 -0
- data/debug_proto_test/gen-rb/srv.rb +330 -0
- data/ext/binary_protocol_accelerated.c +24 -11
- data/ext/compact_protocol.c +14 -11
- data/ext/constants.h +1 -0
- data/ext/memory_buffer.c +56 -1
- data/ext/struct.c +76 -19
- data/ext/thrift_native.c +2 -0
- data/lib/thrift/exceptions.rb +3 -1
- data/lib/thrift/protocol/binary_protocol.rb +14 -10
- data/lib/thrift/protocol/compact_protocol.rb +7 -4
- data/lib/thrift/server/nonblocking_server.rb +15 -5
- data/lib/thrift/struct.rb +9 -6
- data/lib/thrift/struct_union.rb +47 -14
- data/lib/thrift/transport/base_transport.rb +39 -2
- data/lib/thrift/transport/buffered_transport.rb +31 -0
- data/lib/thrift/transport/framed_transport.rb +26 -0
- data/lib/thrift/transport/memory_buffer_transport.rb +29 -0
- data/spec/binary_protocol_spec.rb +2 -4
- data/spec/gen-rb/nonblocking_service.rb +272 -0
- data/spec/gen-rb/thrift_spec_constants.rb +10 -0
- data/spec/gen-rb/thrift_spec_types.rb +345 -0
- data/spec/spec_helper.rb +1 -3
- data/thrift.gemspec +10 -11
- data/tmp/thrift-0.7.0.gem +0 -0
- metadata +22 -8
@@ -0,0 +1,24 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift Compiler (0.7.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
|
+
|
@@ -0,0 +1,79 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift Compiler (0.7.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
|
+
|
@@ -0,0 +1,82 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift Compiler (0.7.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
|
+
|
@@ -0,0 +1,81 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift Compiler (0.7.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
|
+
|
@@ -0,0 +1,330 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift Compiler (0.7.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
|
+
|
@@ -34,6 +34,7 @@ static int VERSION_1;
|
|
34
34
|
static int VERSION_MASK;
|
35
35
|
static int TYPE_MASK;
|
36
36
|
static int BAD_VERSION;
|
37
|
+
static ID rbuf_ivar_id;
|
37
38
|
|
38
39
|
static void write_byte_direct(VALUE trans, int8_t b) {
|
39
40
|
WRITE(trans, (char*)&b, 1);
|
@@ -226,26 +227,36 @@ VALUE rb_thrift_binary_proto_read_i32(VALUE self);
|
|
226
227
|
VALUE rb_thrift_binary_proto_read_i16(VALUE self);
|
227
228
|
|
228
229
|
static char read_byte_direct(VALUE self) {
|
229
|
-
VALUE
|
230
|
-
return
|
230
|
+
VALUE byte = rb_funcall(GET_TRANSPORT(self), read_byte_method_id, 0);
|
231
|
+
return (char)(FIX2INT(byte));
|
231
232
|
}
|
232
233
|
|
233
234
|
static int16_t read_i16_direct(VALUE self) {
|
234
|
-
VALUE
|
235
|
-
|
235
|
+
VALUE rbuf = rb_ivar_get(self, rbuf_ivar_id);
|
236
|
+
rb_funcall(GET_TRANSPORT(self), read_into_buffer_method_id, 2, rbuf, INT2FIX(2));
|
237
|
+
return (int16_t)(((uint8_t)(RSTRING_PTR(rbuf)[1])) | ((uint16_t)((RSTRING_PTR(rbuf)[0]) << 8)));
|
236
238
|
}
|
237
239
|
|
238
240
|
static int32_t read_i32_direct(VALUE self) {
|
239
|
-
VALUE
|
240
|
-
|
241
|
-
|
242
|
-
(((uint8_t)(RSTRING_PTR(
|
243
|
-
(((uint8_t)(RSTRING_PTR(
|
241
|
+
VALUE rbuf = rb_ivar_get(self, rbuf_ivar_id);
|
242
|
+
rb_funcall(GET_TRANSPORT(self), read_into_buffer_method_id, 2, rbuf, INT2FIX(4));
|
243
|
+
return ((uint8_t)(RSTRING_PTR(rbuf)[3])) |
|
244
|
+
(((uint8_t)(RSTRING_PTR(rbuf)[2])) << 8) |
|
245
|
+
(((uint8_t)(RSTRING_PTR(rbuf)[1])) << 16) |
|
246
|
+
(((uint8_t)(RSTRING_PTR(rbuf)[0])) << 24);
|
244
247
|
}
|
245
248
|
|
246
249
|
static int64_t read_i64_direct(VALUE self) {
|
247
|
-
|
248
|
-
|
250
|
+
VALUE rbuf = rb_ivar_get(self, rbuf_ivar_id);
|
251
|
+
rb_funcall(GET_TRANSPORT(self), read_into_buffer_method_id, 2, rbuf, INT2FIX(8));
|
252
|
+
uint64_t hi = ((uint8_t)(RSTRING_PTR(rbuf)[3])) |
|
253
|
+
(((uint8_t)(RSTRING_PTR(rbuf)[2])) << 8) |
|
254
|
+
(((uint8_t)(RSTRING_PTR(rbuf)[1])) << 16) |
|
255
|
+
(((uint8_t)(RSTRING_PTR(rbuf)[0])) << 24);
|
256
|
+
uint32_t lo = ((uint8_t)(RSTRING_PTR(rbuf)[7])) |
|
257
|
+
(((uint8_t)(RSTRING_PTR(rbuf)[6])) << 8) |
|
258
|
+
(((uint8_t)(RSTRING_PTR(rbuf)[5])) << 16) |
|
259
|
+
(((uint8_t)(RSTRING_PTR(rbuf)[4])) << 24);
|
249
260
|
return (hi << 32) | lo;
|
250
261
|
}
|
251
262
|
|
@@ -425,4 +436,6 @@ void Init_binary_protocol_accelerated() {
|
|
425
436
|
rb_define_method(bpa_class, "read_map_end", rb_thift_binary_proto_read_map_end, 0);
|
426
437
|
rb_define_method(bpa_class, "read_list_end", rb_thift_binary_proto_read_list_end, 0);
|
427
438
|
rb_define_method(bpa_class, "read_set_end", rb_thift_binary_proto_read_set_end, 0);
|
439
|
+
|
440
|
+
rbuf_ivar_id = rb_intern("@rbuf");
|
428
441
|
}
|
data/ext/compact_protocol.c
CHANGED
@@ -34,6 +34,7 @@ VALUE rb_thrift_compact_proto_native_qmark(VALUE self) {
|
|
34
34
|
static ID last_field_id;
|
35
35
|
static ID boolean_field_id;
|
36
36
|
static ID bool_value_id;
|
37
|
+
static ID rbuf_ivar_id;
|
37
38
|
|
38
39
|
static int VERSION;
|
39
40
|
static int VERSION_MASK;
|
@@ -354,8 +355,8 @@ static int8_t get_ttype(int8_t ctype) {
|
|
354
355
|
}
|
355
356
|
|
356
357
|
static char read_byte_direct(VALUE self) {
|
357
|
-
VALUE
|
358
|
-
return
|
358
|
+
VALUE byte = rb_funcall(GET_TRANSPORT(self), read_byte_method_id, 0);
|
359
|
+
return (char)(FIX2INT(byte));
|
359
360
|
}
|
360
361
|
|
361
362
|
static int64_t zig_zag_to_ll(int64_t n) {
|
@@ -528,15 +529,16 @@ VALUE rb_thrift_compact_proto_read_double(VALUE self) {
|
|
528
529
|
double f;
|
529
530
|
int64_t l;
|
530
531
|
} transfer;
|
531
|
-
VALUE
|
532
|
-
|
533
|
-
|
534
|
-
| (((uint8_t)(RSTRING_PTR(
|
535
|
-
| (((uint8_t)(RSTRING_PTR(
|
536
|
-
|
537
|
-
|
538
|
-
| (((uint8_t)(RSTRING_PTR(
|
539
|
-
| (((uint8_t)(RSTRING_PTR(
|
532
|
+
VALUE rbuf = rb_ivar_get(self, rbuf_ivar_id);
|
533
|
+
rb_funcall(GET_TRANSPORT(self), read_into_buffer_method_id, 2, rbuf, INT2FIX(8));
|
534
|
+
uint32_t lo = ((uint8_t)(RSTRING_PTR(rbuf)[0]))
|
535
|
+
| (((uint8_t)(RSTRING_PTR(rbuf)[1])) << 8)
|
536
|
+
| (((uint8_t)(RSTRING_PTR(rbuf)[2])) << 16)
|
537
|
+
| (((uint8_t)(RSTRING_PTR(rbuf)[3])) << 24);
|
538
|
+
uint64_t hi = (((uint8_t)(RSTRING_PTR(rbuf)[4])))
|
539
|
+
| (((uint8_t)(RSTRING_PTR(rbuf)[5])) << 8)
|
540
|
+
| (((uint8_t)(RSTRING_PTR(rbuf)[6])) << 16)
|
541
|
+
| (((uint8_t)(RSTRING_PTR(rbuf)[7])) << 24);
|
540
542
|
transfer.l = (hi << 32) | lo;
|
541
543
|
|
542
544
|
return rb_float_new(transfer.f);
|
@@ -559,6 +561,7 @@ static void Init_constants() {
|
|
559
561
|
last_field_id = rb_intern("@last_field");
|
560
562
|
boolean_field_id = rb_intern("@boolean_field");
|
561
563
|
bool_value_id = rb_intern("@bool_value");
|
564
|
+
rbuf_ivar_id = rb_intern("@rbuf");
|
562
565
|
}
|
563
566
|
|
564
567
|
static void Init_rb_methods() {
|