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,107 @@
|
|
1
|
+
#
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
# or more contributor license agreements. See the NOTICE file
|
4
|
+
# distributed with this work for additional information
|
5
|
+
# regarding copyright ownership. The ASF licenses this file
|
6
|
+
# to you under the Apache License, Version 2.0 (the
|
7
|
+
# "License"); you may not use this file except in compliance
|
8
|
+
# with the License. You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing,
|
13
|
+
# software distributed under the License is distributed on an
|
14
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
# KIND, either express or implied. See the License for the
|
16
|
+
# specific language governing permissions and limitations
|
17
|
+
# under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'spec_helper'
|
21
|
+
require File.expand_path("#{File.dirname(__FILE__)}/socket_spec_shared")
|
22
|
+
|
23
|
+
describe 'UNIXSocket' do
|
24
|
+
|
25
|
+
describe Thrift::UNIXSocket do
|
26
|
+
before(:each) do
|
27
|
+
@path = '/tmp/thrift_spec_socket'
|
28
|
+
@socket = Thrift::UNIXSocket.new(@path)
|
29
|
+
@handle = mock("Handle", :closed? => false)
|
30
|
+
@handle.stub!(:close)
|
31
|
+
::UNIXSocket.stub!(:new).and_return(@handle)
|
32
|
+
end
|
33
|
+
|
34
|
+
it_should_behave_like "a socket"
|
35
|
+
|
36
|
+
it "should raise a TransportException when it cannot open a socket" do
|
37
|
+
::UNIXSocket.should_receive(:new).and_raise(StandardError)
|
38
|
+
lambda { @socket.open }.should raise_error(Thrift::TransportException) { |e| e.type.should == Thrift::TransportException::NOT_OPEN }
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should accept an optional timeout" do
|
42
|
+
::UNIXSocket.stub!(:new)
|
43
|
+
Thrift::UNIXSocket.new(@path, 5).timeout.should == 5
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe Thrift::UNIXServerSocket do
|
48
|
+
before(:each) do
|
49
|
+
@path = '/tmp/thrift_spec_socket'
|
50
|
+
@socket = Thrift::UNIXServerSocket.new(@path)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should create a handle when calling listen" do
|
54
|
+
UNIXServer.should_receive(:new).with(@path)
|
55
|
+
@socket.listen
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should create a Thrift::UNIXSocket to wrap accepted sockets" do
|
59
|
+
handle = mock("UNIXServer")
|
60
|
+
UNIXServer.should_receive(:new).with(@path).and_return(handle)
|
61
|
+
@socket.listen
|
62
|
+
sock = mock("sock")
|
63
|
+
handle.should_receive(:accept).and_return(sock)
|
64
|
+
trans = mock("UNIXSocket")
|
65
|
+
Thrift::UNIXSocket.should_receive(:new).and_return(trans)
|
66
|
+
trans.should_receive(:handle=).with(sock)
|
67
|
+
@socket.accept.should == trans
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should close the handle when closed" do
|
71
|
+
handle = mock("UNIXServer", :closed? => false)
|
72
|
+
UNIXServer.should_receive(:new).with(@path).and_return(handle)
|
73
|
+
@socket.listen
|
74
|
+
handle.should_receive(:close)
|
75
|
+
File.stub!(:delete)
|
76
|
+
@socket.close
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should delete the socket when closed" do
|
80
|
+
handle = mock("UNIXServer", :closed? => false)
|
81
|
+
UNIXServer.should_receive(:new).with(@path).and_return(handle)
|
82
|
+
@socket.listen
|
83
|
+
handle.stub!(:close)
|
84
|
+
File.should_receive(:delete).with(@path)
|
85
|
+
@socket.close
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should return nil when accepting if there is no handle" do
|
89
|
+
@socket.accept.should be_nil
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should return true for closed? when appropriate" do
|
93
|
+
handle = mock("UNIXServer", :closed? => false)
|
94
|
+
UNIXServer.stub!(:new).and_return(handle)
|
95
|
+
File.stub!(:delete)
|
96
|
+
@socket.listen
|
97
|
+
@socket.should_not be_closed
|
98
|
+
handle.stub!(:close)
|
99
|
+
@socket.close
|
100
|
+
@socket.should be_closed
|
101
|
+
@socket.listen
|
102
|
+
@socket.should_not be_closed
|
103
|
+
handle.stub!(:closed?).and_return(true)
|
104
|
+
@socket.should be_closed
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,274 @@
|
|
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 'debug_proto_test_types'
|
9
|
+
|
10
|
+
COMPACT_TEST = ::CompactProtoTestStruct.new({
|
11
|
+
%q"byte_boolean_map" => {
|
12
|
+
1 => true,
|
13
|
+
2 => false,
|
14
|
+
},
|
15
|
+
%q"list_byte_map" => {
|
16
|
+
[
|
17
|
+
1,
|
18
|
+
2,
|
19
|
+
3,
|
20
|
+
] => 1,
|
21
|
+
[
|
22
|
+
0,
|
23
|
+
1,
|
24
|
+
] => 2,
|
25
|
+
[
|
26
|
+
] => 0,
|
27
|
+
},
|
28
|
+
%q"set_byte_map" => {
|
29
|
+
Set.new([
|
30
|
+
1,
|
31
|
+
2,
|
32
|
+
3,
|
33
|
+
]) => 1,
|
34
|
+
Set.new([
|
35
|
+
0,
|
36
|
+
1,
|
37
|
+
]) => 2,
|
38
|
+
Set.new([
|
39
|
+
]) => 0,
|
40
|
+
},
|
41
|
+
%q"map_byte_map" => {
|
42
|
+
{
|
43
|
+
1 => 1,
|
44
|
+
} => 1,
|
45
|
+
{
|
46
|
+
2 => 2,
|
47
|
+
} => 2,
|
48
|
+
{
|
49
|
+
} => 0,
|
50
|
+
},
|
51
|
+
%q"byte_map_map" => {
|
52
|
+
0 => {
|
53
|
+
},
|
54
|
+
1 => {
|
55
|
+
1 => 1,
|
56
|
+
},
|
57
|
+
2 => {
|
58
|
+
1 => 1,
|
59
|
+
2 => 2,
|
60
|
+
},
|
61
|
+
},
|
62
|
+
%q"byte_set_map" => {
|
63
|
+
0 => Set.new([
|
64
|
+
]),
|
65
|
+
1 => Set.new([
|
66
|
+
1,
|
67
|
+
]),
|
68
|
+
2 => Set.new([
|
69
|
+
1,
|
70
|
+
2,
|
71
|
+
]),
|
72
|
+
},
|
73
|
+
%q"byte_list_map" => {
|
74
|
+
0 => [
|
75
|
+
],
|
76
|
+
1 => [
|
77
|
+
1,
|
78
|
+
],
|
79
|
+
2 => [
|
80
|
+
1,
|
81
|
+
2,
|
82
|
+
],
|
83
|
+
},
|
84
|
+
%q"a_byte" => 127,
|
85
|
+
%q"a_i16" => 32000,
|
86
|
+
%q"a_i32" => 1000000000,
|
87
|
+
%q"a_i64" => 1099511627775,
|
88
|
+
%q"a_double" => 5.6789,
|
89
|
+
%q"a_string" => %q"my string",
|
90
|
+
%q"true_field" => true,
|
91
|
+
%q"false_field" => false,
|
92
|
+
%q"empty_struct_field" => ::Empty.new({
|
93
|
+
}),
|
94
|
+
%q"byte_list" => [
|
95
|
+
-127,
|
96
|
+
-1,
|
97
|
+
0,
|
98
|
+
1,
|
99
|
+
127,
|
100
|
+
],
|
101
|
+
%q"i16_list" => [
|
102
|
+
-1,
|
103
|
+
0,
|
104
|
+
1,
|
105
|
+
32767,
|
106
|
+
],
|
107
|
+
%q"i32_list" => [
|
108
|
+
-1,
|
109
|
+
0,
|
110
|
+
255,
|
111
|
+
65535,
|
112
|
+
16777215,
|
113
|
+
2147483647,
|
114
|
+
],
|
115
|
+
%q"i64_list" => [
|
116
|
+
-1,
|
117
|
+
0,
|
118
|
+
255,
|
119
|
+
65535,
|
120
|
+
16777215,
|
121
|
+
4294967295,
|
122
|
+
1099511627775,
|
123
|
+
281474976710655,
|
124
|
+
72057594037927935,
|
125
|
+
9223372036854775807,
|
126
|
+
],
|
127
|
+
%q"double_list" => [
|
128
|
+
0.1,
|
129
|
+
0.2,
|
130
|
+
0.3,
|
131
|
+
],
|
132
|
+
%q"string_list" => [
|
133
|
+
%q"first",
|
134
|
+
%q"second",
|
135
|
+
%q"third",
|
136
|
+
],
|
137
|
+
%q"boolean_list" => [
|
138
|
+
true,
|
139
|
+
true,
|
140
|
+
true,
|
141
|
+
false,
|
142
|
+
false,
|
143
|
+
false,
|
144
|
+
],
|
145
|
+
%q"struct_list" => [
|
146
|
+
::Empty.new({
|
147
|
+
}),
|
148
|
+
::Empty.new({
|
149
|
+
}),
|
150
|
+
],
|
151
|
+
%q"byte_set" => Set.new([
|
152
|
+
-127,
|
153
|
+
-1,
|
154
|
+
0,
|
155
|
+
1,
|
156
|
+
127,
|
157
|
+
]),
|
158
|
+
%q"i16_set" => Set.new([
|
159
|
+
-1,
|
160
|
+
0,
|
161
|
+
1,
|
162
|
+
32767,
|
163
|
+
]),
|
164
|
+
%q"i32_set" => Set.new([
|
165
|
+
1,
|
166
|
+
2,
|
167
|
+
3,
|
168
|
+
]),
|
169
|
+
%q"i64_set" => Set.new([
|
170
|
+
-1,
|
171
|
+
0,
|
172
|
+
255,
|
173
|
+
65535,
|
174
|
+
16777215,
|
175
|
+
4294967295,
|
176
|
+
1099511627775,
|
177
|
+
281474976710655,
|
178
|
+
72057594037927935,
|
179
|
+
9223372036854775807,
|
180
|
+
]),
|
181
|
+
%q"double_set" => Set.new([
|
182
|
+
0.1,
|
183
|
+
0.2,
|
184
|
+
0.3,
|
185
|
+
]),
|
186
|
+
%q"string_set" => Set.new([
|
187
|
+
%q"first",
|
188
|
+
%q"second",
|
189
|
+
%q"third",
|
190
|
+
]),
|
191
|
+
%q"boolean_set" => Set.new([
|
192
|
+
true,
|
193
|
+
false,
|
194
|
+
]),
|
195
|
+
%q"struct_set" => Set.new([
|
196
|
+
::Empty.new({
|
197
|
+
}),
|
198
|
+
]),
|
199
|
+
%q"byte_byte_map" => {
|
200
|
+
1 => 2,
|
201
|
+
},
|
202
|
+
%q"i16_byte_map" => {
|
203
|
+
1 => 1,
|
204
|
+
-1 => 1,
|
205
|
+
32767 => 1,
|
206
|
+
},
|
207
|
+
%q"i32_byte_map" => {
|
208
|
+
1 => 1,
|
209
|
+
-1 => 1,
|
210
|
+
2147483647 => 1,
|
211
|
+
},
|
212
|
+
%q"i64_byte_map" => {
|
213
|
+
0 => 1,
|
214
|
+
1 => 1,
|
215
|
+
-1 => 1,
|
216
|
+
9223372036854775807 => 1,
|
217
|
+
},
|
218
|
+
%q"double_byte_map" => {
|
219
|
+
-1.1 => 1,
|
220
|
+
1.1 => 1,
|
221
|
+
},
|
222
|
+
%q"string_byte_map" => {
|
223
|
+
%q"first" => 1,
|
224
|
+
%q"second" => 2,
|
225
|
+
%q"third" => 3,
|
226
|
+
%q"" => 0,
|
227
|
+
},
|
228
|
+
%q"boolean_byte_map" => {
|
229
|
+
true => 1,
|
230
|
+
false => 0,
|
231
|
+
},
|
232
|
+
%q"byte_i16_map" => {
|
233
|
+
1 => 1,
|
234
|
+
2 => -1,
|
235
|
+
3 => 32767,
|
236
|
+
},
|
237
|
+
%q"byte_i32_map" => {
|
238
|
+
1 => 1,
|
239
|
+
2 => -1,
|
240
|
+
3 => 2147483647,
|
241
|
+
},
|
242
|
+
%q"byte_i64_map" => {
|
243
|
+
1 => 1,
|
244
|
+
2 => -1,
|
245
|
+
3 => 9223372036854775807,
|
246
|
+
},
|
247
|
+
%q"byte_double_map" => {
|
248
|
+
1 => 0.1,
|
249
|
+
2 => -0.1,
|
250
|
+
3 => 1e+06,
|
251
|
+
},
|
252
|
+
%q"byte_string_map" => {
|
253
|
+
1 => %q"",
|
254
|
+
2 => %q"blah",
|
255
|
+
3 => %q"loooooooooooooong string",
|
256
|
+
},
|
257
|
+
})
|
258
|
+
|
259
|
+
MYCONST = 2
|
260
|
+
|
261
|
+
MY_SOME_ENUM = 1
|
262
|
+
|
263
|
+
MY_SOME_ENUM_1 = 1
|
264
|
+
|
265
|
+
MY_ENUM_MAP = {
|
266
|
+
1 => 2,
|
267
|
+
}
|
268
|
+
|
269
|
+
EXTRA_CRAZY_MAP = {
|
270
|
+
1 => ::StructWithSomeEnum.new({
|
271
|
+
%q"blah" => 2,
|
272
|
+
}),
|
273
|
+
}
|
274
|
+
|
@@ -0,0 +1,761 @@
|
|
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 SomeEnum
|
10
|
+
ONE = 1
|
11
|
+
TWO = 2
|
12
|
+
VALUE_MAP = {1 => "ONE", 2 => "TWO"}
|
13
|
+
VALID_VALUES = Set.new([ONE, TWO]).freeze
|
14
|
+
end
|
15
|
+
|
16
|
+
class Doubles
|
17
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
18
|
+
NAN = 1
|
19
|
+
INF = 2
|
20
|
+
NEGINF = 3
|
21
|
+
REPEATING = 4
|
22
|
+
BIG = 5
|
23
|
+
TINY = 6
|
24
|
+
ZERO = 7
|
25
|
+
NEGZERO = 8
|
26
|
+
|
27
|
+
FIELDS = {
|
28
|
+
NAN => {:type => ::Thrift::Types::DOUBLE, :name => 'nan'},
|
29
|
+
INF => {:type => ::Thrift::Types::DOUBLE, :name => 'inf'},
|
30
|
+
NEGINF => {:type => ::Thrift::Types::DOUBLE, :name => 'neginf'},
|
31
|
+
REPEATING => {:type => ::Thrift::Types::DOUBLE, :name => 'repeating'},
|
32
|
+
BIG => {:type => ::Thrift::Types::DOUBLE, :name => 'big'},
|
33
|
+
TINY => {:type => ::Thrift::Types::DOUBLE, :name => 'tiny'},
|
34
|
+
ZERO => {:type => ::Thrift::Types::DOUBLE, :name => 'zero'},
|
35
|
+
NEGZERO => {:type => ::Thrift::Types::DOUBLE, :name => 'negzero'}
|
36
|
+
}
|
37
|
+
|
38
|
+
def struct_fields; FIELDS; end
|
39
|
+
|
40
|
+
def validate
|
41
|
+
end
|
42
|
+
|
43
|
+
::Thrift::Struct.generate_accessors self
|
44
|
+
end
|
45
|
+
|
46
|
+
class OneOfEach
|
47
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
48
|
+
IM_TRUE = 1
|
49
|
+
IM_FALSE = 2
|
50
|
+
A_BITE = 3
|
51
|
+
INTEGER16 = 4
|
52
|
+
INTEGER32 = 5
|
53
|
+
INTEGER64 = 6
|
54
|
+
DOUBLE_PRECISION = 7
|
55
|
+
SOME_CHARACTERS = 8
|
56
|
+
ZOMG_UNICODE = 9
|
57
|
+
WHAT_WHO = 10
|
58
|
+
BASE64 = 11
|
59
|
+
BYTE_LIST = 12
|
60
|
+
I16_LIST = 13
|
61
|
+
I64_LIST = 14
|
62
|
+
|
63
|
+
FIELDS = {
|
64
|
+
IM_TRUE => {:type => ::Thrift::Types::BOOL, :name => 'im_true'},
|
65
|
+
IM_FALSE => {:type => ::Thrift::Types::BOOL, :name => 'im_false'},
|
66
|
+
A_BITE => {:type => ::Thrift::Types::BYTE, :name => 'a_bite', :default => 127},
|
67
|
+
INTEGER16 => {:type => ::Thrift::Types::I16, :name => 'integer16', :default => 32767},
|
68
|
+
INTEGER32 => {:type => ::Thrift::Types::I32, :name => 'integer32'},
|
69
|
+
INTEGER64 => {:type => ::Thrift::Types::I64, :name => 'integer64', :default => 10000000000},
|
70
|
+
DOUBLE_PRECISION => {:type => ::Thrift::Types::DOUBLE, :name => 'double_precision'},
|
71
|
+
SOME_CHARACTERS => {:type => ::Thrift::Types::STRING, :name => 'some_characters'},
|
72
|
+
ZOMG_UNICODE => {:type => ::Thrift::Types::STRING, :name => 'zomg_unicode'},
|
73
|
+
WHAT_WHO => {:type => ::Thrift::Types::BOOL, :name => 'what_who'},
|
74
|
+
BASE64 => {:type => ::Thrift::Types::STRING, :name => 'base64', :binary => true},
|
75
|
+
BYTE_LIST => {:type => ::Thrift::Types::LIST, :name => 'byte_list', :default => [
|
76
|
+
1,
|
77
|
+
2,
|
78
|
+
3,
|
79
|
+
], :element => {:type => ::Thrift::Types::BYTE}},
|
80
|
+
I16_LIST => {:type => ::Thrift::Types::LIST, :name => 'i16_list', :default => [
|
81
|
+
1,
|
82
|
+
2,
|
83
|
+
3,
|
84
|
+
], :element => {:type => ::Thrift::Types::I16}},
|
85
|
+
I64_LIST => {:type => ::Thrift::Types::LIST, :name => 'i64_list', :default => [
|
86
|
+
1,
|
87
|
+
2,
|
88
|
+
3,
|
89
|
+
], :element => {:type => ::Thrift::Types::I64}}
|
90
|
+
}
|
91
|
+
|
92
|
+
def struct_fields; FIELDS; end
|
93
|
+
|
94
|
+
def validate
|
95
|
+
end
|
96
|
+
|
97
|
+
::Thrift::Struct.generate_accessors self
|
98
|
+
end
|
99
|
+
|
100
|
+
class Bonk
|
101
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
102
|
+
TYPE = 1
|
103
|
+
MESSAGE = 2
|
104
|
+
|
105
|
+
FIELDS = {
|
106
|
+
TYPE => {:type => ::Thrift::Types::I32, :name => 'type'},
|
107
|
+
MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
|
108
|
+
}
|
109
|
+
|
110
|
+
def struct_fields; FIELDS; end
|
111
|
+
|
112
|
+
def validate
|
113
|
+
end
|
114
|
+
|
115
|
+
::Thrift::Struct.generate_accessors self
|
116
|
+
end
|
117
|
+
|
118
|
+
class Nesting
|
119
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
120
|
+
MY_BONK = 1
|
121
|
+
MY_OOE = 2
|
122
|
+
|
123
|
+
FIELDS = {
|
124
|
+
MY_BONK => {:type => ::Thrift::Types::STRUCT, :name => 'my_bonk', :class => ::Bonk},
|
125
|
+
MY_OOE => {:type => ::Thrift::Types::STRUCT, :name => 'my_ooe', :class => ::OneOfEach}
|
126
|
+
}
|
127
|
+
|
128
|
+
def struct_fields; FIELDS; end
|
129
|
+
|
130
|
+
def validate
|
131
|
+
end
|
132
|
+
|
133
|
+
::Thrift::Struct.generate_accessors self
|
134
|
+
end
|
135
|
+
|
136
|
+
class HolyMoley
|
137
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
138
|
+
BIG = 1
|
139
|
+
CONTAIN = 2
|
140
|
+
BONKS = 3
|
141
|
+
|
142
|
+
FIELDS = {
|
143
|
+
BIG => {:type => ::Thrift::Types::LIST, :name => 'big', :element => {:type => ::Thrift::Types::STRUCT, :class => ::OneOfEach}},
|
144
|
+
CONTAIN => {:type => ::Thrift::Types::SET, :name => 'contain', :element => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::STRING}}},
|
145
|
+
BONKS => {:type => ::Thrift::Types::MAP, :name => 'bonks', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::STRUCT, :class => ::Bonk}}}
|
146
|
+
}
|
147
|
+
|
148
|
+
def struct_fields; FIELDS; end
|
149
|
+
|
150
|
+
def validate
|
151
|
+
end
|
152
|
+
|
153
|
+
::Thrift::Struct.generate_accessors self
|
154
|
+
end
|
155
|
+
|
156
|
+
class Backwards
|
157
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
158
|
+
FIRST_TAG2 = 2
|
159
|
+
SECOND_TAG1 = 1
|
160
|
+
|
161
|
+
FIELDS = {
|
162
|
+
FIRST_TAG2 => {:type => ::Thrift::Types::I32, :name => 'first_tag2'},
|
163
|
+
SECOND_TAG1 => {:type => ::Thrift::Types::I32, :name => 'second_tag1'}
|
164
|
+
}
|
165
|
+
|
166
|
+
def struct_fields; FIELDS; end
|
167
|
+
|
168
|
+
def validate
|
169
|
+
end
|
170
|
+
|
171
|
+
::Thrift::Struct.generate_accessors self
|
172
|
+
end
|
173
|
+
|
174
|
+
class Empty
|
175
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
176
|
+
|
177
|
+
FIELDS = {
|
178
|
+
|
179
|
+
}
|
180
|
+
|
181
|
+
def struct_fields; FIELDS; end
|
182
|
+
|
183
|
+
def validate
|
184
|
+
end
|
185
|
+
|
186
|
+
::Thrift::Struct.generate_accessors self
|
187
|
+
end
|
188
|
+
|
189
|
+
class Wrapper
|
190
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
191
|
+
FOO = 1
|
192
|
+
|
193
|
+
FIELDS = {
|
194
|
+
FOO => {:type => ::Thrift::Types::STRUCT, :name => 'foo', :class => ::Empty}
|
195
|
+
}
|
196
|
+
|
197
|
+
def struct_fields; FIELDS; end
|
198
|
+
|
199
|
+
def validate
|
200
|
+
end
|
201
|
+
|
202
|
+
::Thrift::Struct.generate_accessors self
|
203
|
+
end
|
204
|
+
|
205
|
+
class RandomStuff
|
206
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
207
|
+
A = 1
|
208
|
+
B = 2
|
209
|
+
C = 3
|
210
|
+
D = 4
|
211
|
+
MYINTLIST = 5
|
212
|
+
MAPS = 6
|
213
|
+
BIGINT = 7
|
214
|
+
TRIPLE = 8
|
215
|
+
|
216
|
+
FIELDS = {
|
217
|
+
A => {:type => ::Thrift::Types::I32, :name => 'a'},
|
218
|
+
B => {:type => ::Thrift::Types::I32, :name => 'b'},
|
219
|
+
C => {:type => ::Thrift::Types::I32, :name => 'c'},
|
220
|
+
D => {:type => ::Thrift::Types::I32, :name => 'd'},
|
221
|
+
MYINTLIST => {:type => ::Thrift::Types::LIST, :name => 'myintlist', :element => {:type => ::Thrift::Types::I32}},
|
222
|
+
MAPS => {:type => ::Thrift::Types::MAP, :name => 'maps', :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::STRUCT, :class => ::Wrapper}},
|
223
|
+
BIGINT => {:type => ::Thrift::Types::I64, :name => 'bigint'},
|
224
|
+
TRIPLE => {:type => ::Thrift::Types::DOUBLE, :name => 'triple'}
|
225
|
+
}
|
226
|
+
|
227
|
+
def struct_fields; FIELDS; end
|
228
|
+
|
229
|
+
def validate
|
230
|
+
end
|
231
|
+
|
232
|
+
::Thrift::Struct.generate_accessors self
|
233
|
+
end
|
234
|
+
|
235
|
+
class Base64
|
236
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
237
|
+
A = 1
|
238
|
+
B1 = 2
|
239
|
+
B2 = 3
|
240
|
+
B3 = 4
|
241
|
+
B4 = 5
|
242
|
+
B5 = 6
|
243
|
+
B6 = 7
|
244
|
+
|
245
|
+
FIELDS = {
|
246
|
+
A => {:type => ::Thrift::Types::I32, :name => 'a'},
|
247
|
+
B1 => {:type => ::Thrift::Types::STRING, :name => 'b1', :binary => true},
|
248
|
+
B2 => {:type => ::Thrift::Types::STRING, :name => 'b2', :binary => true},
|
249
|
+
B3 => {:type => ::Thrift::Types::STRING, :name => 'b3', :binary => true},
|
250
|
+
B4 => {:type => ::Thrift::Types::STRING, :name => 'b4', :binary => true},
|
251
|
+
B5 => {:type => ::Thrift::Types::STRING, :name => 'b5', :binary => true},
|
252
|
+
B6 => {:type => ::Thrift::Types::STRING, :name => 'b6', :binary => true}
|
253
|
+
}
|
254
|
+
|
255
|
+
def struct_fields; FIELDS; end
|
256
|
+
|
257
|
+
def validate
|
258
|
+
end
|
259
|
+
|
260
|
+
::Thrift::Struct.generate_accessors self
|
261
|
+
end
|
262
|
+
|
263
|
+
class CompactProtoTestStruct
|
264
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
265
|
+
A_BYTE = 1
|
266
|
+
A_I16 = 2
|
267
|
+
A_I32 = 3
|
268
|
+
A_I64 = 4
|
269
|
+
A_DOUBLE = 5
|
270
|
+
A_STRING = 6
|
271
|
+
A_BINARY = 7
|
272
|
+
TRUE_FIELD = 8
|
273
|
+
FALSE_FIELD = 9
|
274
|
+
EMPTY_STRUCT_FIELD = 10
|
275
|
+
BYTE_LIST = 11
|
276
|
+
I16_LIST = 12
|
277
|
+
I32_LIST = 13
|
278
|
+
I64_LIST = 14
|
279
|
+
DOUBLE_LIST = 15
|
280
|
+
STRING_LIST = 16
|
281
|
+
BINARY_LIST = 17
|
282
|
+
BOOLEAN_LIST = 18
|
283
|
+
STRUCT_LIST = 19
|
284
|
+
BYTE_SET = 20
|
285
|
+
I16_SET = 21
|
286
|
+
I32_SET = 22
|
287
|
+
I64_SET = 23
|
288
|
+
DOUBLE_SET = 24
|
289
|
+
STRING_SET = 25
|
290
|
+
BINARY_SET = 26
|
291
|
+
BOOLEAN_SET = 27
|
292
|
+
STRUCT_SET = 28
|
293
|
+
BYTE_BYTE_MAP = 29
|
294
|
+
I16_BYTE_MAP = 30
|
295
|
+
I32_BYTE_MAP = 31
|
296
|
+
I64_BYTE_MAP = 32
|
297
|
+
DOUBLE_BYTE_MAP = 33
|
298
|
+
STRING_BYTE_MAP = 34
|
299
|
+
BINARY_BYTE_MAP = 35
|
300
|
+
BOOLEAN_BYTE_MAP = 36
|
301
|
+
BYTE_I16_MAP = 37
|
302
|
+
BYTE_I32_MAP = 38
|
303
|
+
BYTE_I64_MAP = 39
|
304
|
+
BYTE_DOUBLE_MAP = 40
|
305
|
+
BYTE_STRING_MAP = 41
|
306
|
+
BYTE_BINARY_MAP = 42
|
307
|
+
BYTE_BOOLEAN_MAP = 43
|
308
|
+
LIST_BYTE_MAP = 44
|
309
|
+
SET_BYTE_MAP = 45
|
310
|
+
MAP_BYTE_MAP = 46
|
311
|
+
BYTE_MAP_MAP = 47
|
312
|
+
BYTE_SET_MAP = 48
|
313
|
+
BYTE_LIST_MAP = 49
|
314
|
+
|
315
|
+
FIELDS = {
|
316
|
+
A_BYTE => {:type => ::Thrift::Types::BYTE, :name => 'a_byte'},
|
317
|
+
A_I16 => {:type => ::Thrift::Types::I16, :name => 'a_i16'},
|
318
|
+
A_I32 => {:type => ::Thrift::Types::I32, :name => 'a_i32'},
|
319
|
+
A_I64 => {:type => ::Thrift::Types::I64, :name => 'a_i64'},
|
320
|
+
A_DOUBLE => {:type => ::Thrift::Types::DOUBLE, :name => 'a_double'},
|
321
|
+
A_STRING => {:type => ::Thrift::Types::STRING, :name => 'a_string'},
|
322
|
+
A_BINARY => {:type => ::Thrift::Types::STRING, :name => 'a_binary', :binary => true},
|
323
|
+
TRUE_FIELD => {:type => ::Thrift::Types::BOOL, :name => 'true_field'},
|
324
|
+
FALSE_FIELD => {:type => ::Thrift::Types::BOOL, :name => 'false_field'},
|
325
|
+
EMPTY_STRUCT_FIELD => {:type => ::Thrift::Types::STRUCT, :name => 'empty_struct_field', :class => ::Empty},
|
326
|
+
BYTE_LIST => {:type => ::Thrift::Types::LIST, :name => 'byte_list', :element => {:type => ::Thrift::Types::BYTE}},
|
327
|
+
I16_LIST => {:type => ::Thrift::Types::LIST, :name => 'i16_list', :element => {:type => ::Thrift::Types::I16}},
|
328
|
+
I32_LIST => {:type => ::Thrift::Types::LIST, :name => 'i32_list', :element => {:type => ::Thrift::Types::I32}},
|
329
|
+
I64_LIST => {:type => ::Thrift::Types::LIST, :name => 'i64_list', :element => {:type => ::Thrift::Types::I64}},
|
330
|
+
DOUBLE_LIST => {:type => ::Thrift::Types::LIST, :name => 'double_list', :element => {:type => ::Thrift::Types::DOUBLE}},
|
331
|
+
STRING_LIST => {:type => ::Thrift::Types::LIST, :name => 'string_list', :element => {:type => ::Thrift::Types::STRING}},
|
332
|
+
BINARY_LIST => {:type => ::Thrift::Types::LIST, :name => 'binary_list', :element => {:type => ::Thrift::Types::STRING, :binary => true}},
|
333
|
+
BOOLEAN_LIST => {:type => ::Thrift::Types::LIST, :name => 'boolean_list', :element => {:type => ::Thrift::Types::BOOL}},
|
334
|
+
STRUCT_LIST => {:type => ::Thrift::Types::LIST, :name => 'struct_list', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Empty}},
|
335
|
+
BYTE_SET => {:type => ::Thrift::Types::SET, :name => 'byte_set', :element => {:type => ::Thrift::Types::BYTE}},
|
336
|
+
I16_SET => {:type => ::Thrift::Types::SET, :name => 'i16_set', :element => {:type => ::Thrift::Types::I16}},
|
337
|
+
I32_SET => {:type => ::Thrift::Types::SET, :name => 'i32_set', :element => {:type => ::Thrift::Types::I32}},
|
338
|
+
I64_SET => {:type => ::Thrift::Types::SET, :name => 'i64_set', :element => {:type => ::Thrift::Types::I64}},
|
339
|
+
DOUBLE_SET => {:type => ::Thrift::Types::SET, :name => 'double_set', :element => {:type => ::Thrift::Types::DOUBLE}},
|
340
|
+
STRING_SET => {:type => ::Thrift::Types::SET, :name => 'string_set', :element => {:type => ::Thrift::Types::STRING}},
|
341
|
+
BINARY_SET => {:type => ::Thrift::Types::SET, :name => 'binary_set', :element => {:type => ::Thrift::Types::STRING, :binary => true}},
|
342
|
+
BOOLEAN_SET => {:type => ::Thrift::Types::SET, :name => 'boolean_set', :element => {:type => ::Thrift::Types::BOOL}},
|
343
|
+
STRUCT_SET => {:type => ::Thrift::Types::SET, :name => 'struct_set', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Empty}},
|
344
|
+
BYTE_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_byte_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::BYTE}},
|
345
|
+
I16_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'i16_byte_map', :key => {:type => ::Thrift::Types::I16}, :value => {:type => ::Thrift::Types::BYTE}},
|
346
|
+
I32_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'i32_byte_map', :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::BYTE}},
|
347
|
+
I64_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'i64_byte_map', :key => {:type => ::Thrift::Types::I64}, :value => {:type => ::Thrift::Types::BYTE}},
|
348
|
+
DOUBLE_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'double_byte_map', :key => {:type => ::Thrift::Types::DOUBLE}, :value => {:type => ::Thrift::Types::BYTE}},
|
349
|
+
STRING_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'string_byte_map', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::BYTE}},
|
350
|
+
BINARY_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'binary_byte_map', :key => {:type => ::Thrift::Types::STRING, :binary => true}, :value => {:type => ::Thrift::Types::BYTE}},
|
351
|
+
BOOLEAN_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'boolean_byte_map', :key => {:type => ::Thrift::Types::BOOL}, :value => {:type => ::Thrift::Types::BYTE}},
|
352
|
+
BYTE_I16_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_i16_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::I16}},
|
353
|
+
BYTE_I32_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_i32_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::I32}},
|
354
|
+
BYTE_I64_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_i64_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::I64}},
|
355
|
+
BYTE_DOUBLE_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_double_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::DOUBLE}},
|
356
|
+
BYTE_STRING_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_string_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::STRING}},
|
357
|
+
BYTE_BINARY_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_binary_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::STRING, :binary => true}},
|
358
|
+
BYTE_BOOLEAN_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_boolean_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::BOOL}},
|
359
|
+
LIST_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'list_byte_map', :key => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::BYTE}}, :value => {:type => ::Thrift::Types::BYTE}},
|
360
|
+
SET_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'set_byte_map', :key => {:type => ::Thrift::Types::SET, :element => {:type => ::Thrift::Types::BYTE}}, :value => {:type => ::Thrift::Types::BYTE}},
|
361
|
+
MAP_BYTE_MAP => {:type => ::Thrift::Types::MAP, :name => 'map_byte_map', :key => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::BYTE}}, :value => {:type => ::Thrift::Types::BYTE}},
|
362
|
+
BYTE_MAP_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_map_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::BYTE}}},
|
363
|
+
BYTE_SET_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_set_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::SET, :element => {:type => ::Thrift::Types::BYTE}}},
|
364
|
+
BYTE_LIST_MAP => {:type => ::Thrift::Types::MAP, :name => 'byte_list_map', :key => {:type => ::Thrift::Types::BYTE}, :value => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::BYTE}}}
|
365
|
+
}
|
366
|
+
|
367
|
+
def struct_fields; FIELDS; end
|
368
|
+
|
369
|
+
def validate
|
370
|
+
end
|
371
|
+
|
372
|
+
::Thrift::Struct.generate_accessors self
|
373
|
+
end
|
374
|
+
|
375
|
+
class SingleMapTestStruct
|
376
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
377
|
+
I32_MAP = 1
|
378
|
+
|
379
|
+
FIELDS = {
|
380
|
+
I32_MAP => {:type => ::Thrift::Types::MAP, :name => 'i32_map', :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::I32}}
|
381
|
+
}
|
382
|
+
|
383
|
+
def struct_fields; FIELDS; end
|
384
|
+
|
385
|
+
def validate
|
386
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field i32_map is unset!') unless @i32_map
|
387
|
+
end
|
388
|
+
|
389
|
+
::Thrift::Struct.generate_accessors self
|
390
|
+
end
|
391
|
+
|
392
|
+
class ExceptionWithAMap < ::Thrift::Exception
|
393
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
394
|
+
BLAH = 1
|
395
|
+
MAP_FIELD = 2
|
396
|
+
|
397
|
+
FIELDS = {
|
398
|
+
BLAH => {:type => ::Thrift::Types::STRING, :name => 'blah'},
|
399
|
+
MAP_FIELD => {:type => ::Thrift::Types::MAP, :name => 'map_field', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}}
|
400
|
+
}
|
401
|
+
|
402
|
+
def struct_fields; FIELDS; end
|
403
|
+
|
404
|
+
def validate
|
405
|
+
end
|
406
|
+
|
407
|
+
::Thrift::Struct.generate_accessors self
|
408
|
+
end
|
409
|
+
|
410
|
+
class BlowUp
|
411
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
412
|
+
B1 = 1
|
413
|
+
B2 = 2
|
414
|
+
B3 = 3
|
415
|
+
B4 = 4
|
416
|
+
|
417
|
+
FIELDS = {
|
418
|
+
B1 => {:type => ::Thrift::Types::MAP, :name => 'b1', :key => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::I32}}, :value => {:type => ::Thrift::Types::SET, :element => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::STRING}}}},
|
419
|
+
B2 => {:type => ::Thrift::Types::MAP, :name => 'b2', :key => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::I32}}, :value => {:type => ::Thrift::Types::SET, :element => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::STRING}}}},
|
420
|
+
B3 => {:type => ::Thrift::Types::MAP, :name => 'b3', :key => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::I32}}, :value => {:type => ::Thrift::Types::SET, :element => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::STRING}}}},
|
421
|
+
B4 => {:type => ::Thrift::Types::MAP, :name => 'b4', :key => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::I32}}, :value => {:type => ::Thrift::Types::SET, :element => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::STRING}}}}
|
422
|
+
}
|
423
|
+
|
424
|
+
def struct_fields; FIELDS; end
|
425
|
+
|
426
|
+
def validate
|
427
|
+
end
|
428
|
+
|
429
|
+
::Thrift::Struct.generate_accessors self
|
430
|
+
end
|
431
|
+
|
432
|
+
class ReverseOrderStruct
|
433
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
434
|
+
FIRST = 4
|
435
|
+
SECOND = 3
|
436
|
+
THIRD = 2
|
437
|
+
FOURTH = 1
|
438
|
+
|
439
|
+
FIELDS = {
|
440
|
+
FIRST => {:type => ::Thrift::Types::STRING, :name => 'first'},
|
441
|
+
SECOND => {:type => ::Thrift::Types::I16, :name => 'second'},
|
442
|
+
THIRD => {:type => ::Thrift::Types::I32, :name => 'third'},
|
443
|
+
FOURTH => {:type => ::Thrift::Types::I64, :name => 'fourth'}
|
444
|
+
}
|
445
|
+
|
446
|
+
def struct_fields; FIELDS; end
|
447
|
+
|
448
|
+
def validate
|
449
|
+
end
|
450
|
+
|
451
|
+
::Thrift::Struct.generate_accessors self
|
452
|
+
end
|
453
|
+
|
454
|
+
class StructWithSomeEnum
|
455
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
456
|
+
BLAH = 1
|
457
|
+
|
458
|
+
FIELDS = {
|
459
|
+
BLAH => {:type => ::Thrift::Types::I32, :name => 'blah', :enum_class => ::SomeEnum}
|
460
|
+
}
|
461
|
+
|
462
|
+
def struct_fields; FIELDS; end
|
463
|
+
|
464
|
+
def validate
|
465
|
+
unless @blah.nil? || ::SomeEnum::VALID_VALUES.include?(@blah)
|
466
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field blah!')
|
467
|
+
end
|
468
|
+
end
|
469
|
+
|
470
|
+
::Thrift::Struct.generate_accessors self
|
471
|
+
end
|
472
|
+
|
473
|
+
class TestUnion < ::Thrift::Union
|
474
|
+
include ::Thrift::Struct_Union
|
475
|
+
class << self
|
476
|
+
def string_field(val)
|
477
|
+
TestUnion.new(:string_field, val)
|
478
|
+
end
|
479
|
+
|
480
|
+
def i32_field(val)
|
481
|
+
TestUnion.new(:i32_field, val)
|
482
|
+
end
|
483
|
+
|
484
|
+
def struct_field(val)
|
485
|
+
TestUnion.new(:struct_field, val)
|
486
|
+
end
|
487
|
+
|
488
|
+
def struct_list(val)
|
489
|
+
TestUnion.new(:struct_list, val)
|
490
|
+
end
|
491
|
+
|
492
|
+
def other_i32_field(val)
|
493
|
+
TestUnion.new(:other_i32_field, val)
|
494
|
+
end
|
495
|
+
|
496
|
+
def enum_field(val)
|
497
|
+
TestUnion.new(:enum_field, val)
|
498
|
+
end
|
499
|
+
|
500
|
+
def i32_set(val)
|
501
|
+
TestUnion.new(:i32_set, val)
|
502
|
+
end
|
503
|
+
|
504
|
+
def i32_map(val)
|
505
|
+
TestUnion.new(:i32_map, val)
|
506
|
+
end
|
507
|
+
end
|
508
|
+
|
509
|
+
STRING_FIELD = 1
|
510
|
+
I32_FIELD = 2
|
511
|
+
STRUCT_FIELD = 3
|
512
|
+
STRUCT_LIST = 4
|
513
|
+
OTHER_I32_FIELD = 5
|
514
|
+
ENUM_FIELD = 6
|
515
|
+
I32_SET = 7
|
516
|
+
I32_MAP = 8
|
517
|
+
|
518
|
+
FIELDS = {
|
519
|
+
# A doc string
|
520
|
+
STRING_FIELD => {:type => ::Thrift::Types::STRING, :name => 'string_field'},
|
521
|
+
I32_FIELD => {:type => ::Thrift::Types::I32, :name => 'i32_field'},
|
522
|
+
STRUCT_FIELD => {:type => ::Thrift::Types::STRUCT, :name => 'struct_field', :class => ::OneOfEach},
|
523
|
+
STRUCT_LIST => {:type => ::Thrift::Types::LIST, :name => 'struct_list', :element => {:type => ::Thrift::Types::STRUCT, :class => ::RandomStuff}},
|
524
|
+
OTHER_I32_FIELD => {:type => ::Thrift::Types::I32, :name => 'other_i32_field'},
|
525
|
+
ENUM_FIELD => {:type => ::Thrift::Types::I32, :name => 'enum_field', :enum_class => ::SomeEnum},
|
526
|
+
I32_SET => {:type => ::Thrift::Types::SET, :name => 'i32_set', :element => {:type => ::Thrift::Types::I32}},
|
527
|
+
I32_MAP => {:type => ::Thrift::Types::MAP, :name => 'i32_map', :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::I32}}
|
528
|
+
}
|
529
|
+
|
530
|
+
def struct_fields; FIELDS; end
|
531
|
+
|
532
|
+
def validate
|
533
|
+
raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
|
534
|
+
if get_set_field == :enum_field
|
535
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field enum_field!') unless ::SomeEnum::VALID_VALUES.include?(get_value)
|
536
|
+
end
|
537
|
+
end
|
538
|
+
|
539
|
+
::Thrift::Union.generate_accessors self
|
540
|
+
end
|
541
|
+
|
542
|
+
class TestUnionMinusStringField < ::Thrift::Union
|
543
|
+
include ::Thrift::Struct_Union
|
544
|
+
class << self
|
545
|
+
def i32_field(val)
|
546
|
+
TestUnionMinusStringField.new(:i32_field, val)
|
547
|
+
end
|
548
|
+
|
549
|
+
def struct_field(val)
|
550
|
+
TestUnionMinusStringField.new(:struct_field, val)
|
551
|
+
end
|
552
|
+
|
553
|
+
def struct_list(val)
|
554
|
+
TestUnionMinusStringField.new(:struct_list, val)
|
555
|
+
end
|
556
|
+
|
557
|
+
def other_i32_field(val)
|
558
|
+
TestUnionMinusStringField.new(:other_i32_field, val)
|
559
|
+
end
|
560
|
+
|
561
|
+
def enum_field(val)
|
562
|
+
TestUnionMinusStringField.new(:enum_field, val)
|
563
|
+
end
|
564
|
+
|
565
|
+
def i32_set(val)
|
566
|
+
TestUnionMinusStringField.new(:i32_set, val)
|
567
|
+
end
|
568
|
+
|
569
|
+
def i32_map(val)
|
570
|
+
TestUnionMinusStringField.new(:i32_map, val)
|
571
|
+
end
|
572
|
+
end
|
573
|
+
|
574
|
+
I32_FIELD = 2
|
575
|
+
STRUCT_FIELD = 3
|
576
|
+
STRUCT_LIST = 4
|
577
|
+
OTHER_I32_FIELD = 5
|
578
|
+
ENUM_FIELD = 6
|
579
|
+
I32_SET = 7
|
580
|
+
I32_MAP = 8
|
581
|
+
|
582
|
+
FIELDS = {
|
583
|
+
I32_FIELD => {:type => ::Thrift::Types::I32, :name => 'i32_field'},
|
584
|
+
STRUCT_FIELD => {:type => ::Thrift::Types::STRUCT, :name => 'struct_field', :class => ::OneOfEach},
|
585
|
+
STRUCT_LIST => {:type => ::Thrift::Types::LIST, :name => 'struct_list', :element => {:type => ::Thrift::Types::STRUCT, :class => ::RandomStuff}},
|
586
|
+
OTHER_I32_FIELD => {:type => ::Thrift::Types::I32, :name => 'other_i32_field'},
|
587
|
+
ENUM_FIELD => {:type => ::Thrift::Types::I32, :name => 'enum_field', :enum_class => ::SomeEnum},
|
588
|
+
I32_SET => {:type => ::Thrift::Types::SET, :name => 'i32_set', :element => {:type => ::Thrift::Types::I32}},
|
589
|
+
I32_MAP => {:type => ::Thrift::Types::MAP, :name => 'i32_map', :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::I32}}
|
590
|
+
}
|
591
|
+
|
592
|
+
def struct_fields; FIELDS; end
|
593
|
+
|
594
|
+
def validate
|
595
|
+
raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
|
596
|
+
if get_set_field == :enum_field
|
597
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field enum_field!') unless ::SomeEnum::VALID_VALUES.include?(get_value)
|
598
|
+
end
|
599
|
+
end
|
600
|
+
|
601
|
+
::Thrift::Union.generate_accessors self
|
602
|
+
end
|
603
|
+
|
604
|
+
class ComparableUnion < ::Thrift::Union
|
605
|
+
include ::Thrift::Struct_Union
|
606
|
+
class << self
|
607
|
+
def string_field(val)
|
608
|
+
ComparableUnion.new(:string_field, val)
|
609
|
+
end
|
610
|
+
|
611
|
+
def binary_field(val)
|
612
|
+
ComparableUnion.new(:binary_field, val)
|
613
|
+
end
|
614
|
+
end
|
615
|
+
|
616
|
+
STRING_FIELD = 1
|
617
|
+
BINARY_FIELD = 2
|
618
|
+
|
619
|
+
FIELDS = {
|
620
|
+
STRING_FIELD => {:type => ::Thrift::Types::STRING, :name => 'string_field'},
|
621
|
+
BINARY_FIELD => {:type => ::Thrift::Types::STRING, :name => 'binary_field', :binary => true}
|
622
|
+
}
|
623
|
+
|
624
|
+
def struct_fields; FIELDS; end
|
625
|
+
|
626
|
+
def validate
|
627
|
+
raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
|
628
|
+
end
|
629
|
+
|
630
|
+
::Thrift::Union.generate_accessors self
|
631
|
+
end
|
632
|
+
|
633
|
+
class StructWithAUnion
|
634
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
635
|
+
TEST_UNION = 1
|
636
|
+
|
637
|
+
FIELDS = {
|
638
|
+
TEST_UNION => {:type => ::Thrift::Types::STRUCT, :name => 'test_union', :class => ::TestUnion}
|
639
|
+
}
|
640
|
+
|
641
|
+
def struct_fields; FIELDS; end
|
642
|
+
|
643
|
+
def validate
|
644
|
+
end
|
645
|
+
|
646
|
+
::Thrift::Struct.generate_accessors self
|
647
|
+
end
|
648
|
+
|
649
|
+
class PrimitiveThenStruct
|
650
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
651
|
+
BLAH = 1
|
652
|
+
BLAH2 = 2
|
653
|
+
BW = 3
|
654
|
+
|
655
|
+
FIELDS = {
|
656
|
+
BLAH => {:type => ::Thrift::Types::I32, :name => 'blah'},
|
657
|
+
BLAH2 => {:type => ::Thrift::Types::I32, :name => 'blah2'},
|
658
|
+
BW => {:type => ::Thrift::Types::STRUCT, :name => 'bw', :class => ::Backwards}
|
659
|
+
}
|
660
|
+
|
661
|
+
def struct_fields; FIELDS; end
|
662
|
+
|
663
|
+
def validate
|
664
|
+
end
|
665
|
+
|
666
|
+
::Thrift::Struct.generate_accessors self
|
667
|
+
end
|
668
|
+
|
669
|
+
class StructWithASomemap
|
670
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
671
|
+
SOMEMAP_FIELD = 1
|
672
|
+
|
673
|
+
FIELDS = {
|
674
|
+
SOMEMAP_FIELD => {:type => ::Thrift::Types::MAP, :name => 'somemap_field', :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::I32}}
|
675
|
+
}
|
676
|
+
|
677
|
+
def struct_fields; FIELDS; end
|
678
|
+
|
679
|
+
def validate
|
680
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field somemap_field is unset!') unless @somemap_field
|
681
|
+
end
|
682
|
+
|
683
|
+
::Thrift::Struct.generate_accessors self
|
684
|
+
end
|
685
|
+
|
686
|
+
class BigFieldIdStruct
|
687
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
688
|
+
FIELD1 = 1
|
689
|
+
FIELD2 = 45
|
690
|
+
|
691
|
+
FIELDS = {
|
692
|
+
FIELD1 => {:type => ::Thrift::Types::STRING, :name => 'field1'},
|
693
|
+
FIELD2 => {:type => ::Thrift::Types::STRING, :name => 'field2'}
|
694
|
+
}
|
695
|
+
|
696
|
+
def struct_fields; FIELDS; end
|
697
|
+
|
698
|
+
def validate
|
699
|
+
end
|
700
|
+
|
701
|
+
::Thrift::Struct.generate_accessors self
|
702
|
+
end
|
703
|
+
|
704
|
+
class BreaksRubyCompactProtocol
|
705
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
706
|
+
FIELD1 = 1
|
707
|
+
FIELD2 = 2
|
708
|
+
FIELD3 = 3
|
709
|
+
|
710
|
+
FIELDS = {
|
711
|
+
FIELD1 => {:type => ::Thrift::Types::STRING, :name => 'field1'},
|
712
|
+
FIELD2 => {:type => ::Thrift::Types::STRUCT, :name => 'field2', :class => ::BigFieldIdStruct},
|
713
|
+
FIELD3 => {:type => ::Thrift::Types::I32, :name => 'field3'}
|
714
|
+
}
|
715
|
+
|
716
|
+
def struct_fields; FIELDS; end
|
717
|
+
|
718
|
+
def validate
|
719
|
+
end
|
720
|
+
|
721
|
+
::Thrift::Struct.generate_accessors self
|
722
|
+
end
|
723
|
+
|
724
|
+
class TupleProtocolTestStruct
|
725
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
726
|
+
FIELD1 = -1
|
727
|
+
FIELD2 = -2
|
728
|
+
FIELD3 = -3
|
729
|
+
FIELD4 = -4
|
730
|
+
FIELD5 = -5
|
731
|
+
FIELD6 = -6
|
732
|
+
FIELD7 = -7
|
733
|
+
FIELD8 = -8
|
734
|
+
FIELD9 = -9
|
735
|
+
FIELD10 = -10
|
736
|
+
FIELD11 = -11
|
737
|
+
FIELD12 = -12
|
738
|
+
|
739
|
+
FIELDS = {
|
740
|
+
FIELD1 => {:type => ::Thrift::Types::I32, :name => 'field1', :optional => true},
|
741
|
+
FIELD2 => {:type => ::Thrift::Types::I32, :name => 'field2', :optional => true},
|
742
|
+
FIELD3 => {:type => ::Thrift::Types::I32, :name => 'field3', :optional => true},
|
743
|
+
FIELD4 => {:type => ::Thrift::Types::I32, :name => 'field4', :optional => true},
|
744
|
+
FIELD5 => {:type => ::Thrift::Types::I32, :name => 'field5', :optional => true},
|
745
|
+
FIELD6 => {:type => ::Thrift::Types::I32, :name => 'field6', :optional => true},
|
746
|
+
FIELD7 => {:type => ::Thrift::Types::I32, :name => 'field7', :optional => true},
|
747
|
+
FIELD8 => {:type => ::Thrift::Types::I32, :name => 'field8', :optional => true},
|
748
|
+
FIELD9 => {:type => ::Thrift::Types::I32, :name => 'field9', :optional => true},
|
749
|
+
FIELD10 => {:type => ::Thrift::Types::I32, :name => 'field10', :optional => true},
|
750
|
+
FIELD11 => {:type => ::Thrift::Types::I32, :name => 'field11', :optional => true},
|
751
|
+
FIELD12 => {:type => ::Thrift::Types::I32, :name => 'field12', :optional => true}
|
752
|
+
}
|
753
|
+
|
754
|
+
def struct_fields; FIELDS; end
|
755
|
+
|
756
|
+
def validate
|
757
|
+
end
|
758
|
+
|
759
|
+
::Thrift::Struct.generate_accessors self
|
760
|
+
end
|
761
|
+
|