thrift 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +15 -0
  2. data/ext/binary_protocol_accelerated.c +19 -3
  3. data/ext/compact_protocol.c +21 -7
  4. data/ext/constants.h +1 -5
  5. data/ext/extconf.rb +1 -1
  6. data/ext/protocol.c +0 -185
  7. data/ext/protocol.h +0 -20
  8. data/ext/struct.c +0 -3
  9. data/ext/thrift_native.c +1 -11
  10. data/lib/thrift.rb +1 -0
  11. data/lib/thrift/exceptions.rb +3 -0
  12. data/lib/thrift/protocol/base_protocol.rb +87 -10
  13. data/lib/thrift/protocol/binary_protocol.rb +13 -5
  14. data/lib/thrift/protocol/compact_protocol.rb +14 -7
  15. data/lib/thrift/protocol/json_protocol.rb +19 -15
  16. data/lib/thrift/server/mongrel_http_server.rb +2 -0
  17. data/lib/thrift/server/thin_http_server.rb +91 -0
  18. data/lib/thrift/struct.rb +1 -1
  19. data/lib/thrift/struct_union.rb +2 -2
  20. data/lib/thrift/transport/http_client_transport.rb +4 -1
  21. data/spec/base_protocol_spec.rb +65 -7
  22. data/spec/binary_protocol_spec_shared.rb +30 -0
  23. data/spec/compact_protocol_spec.rb +1 -3
  24. data/spec/http_client_spec.rb +49 -0
  25. data/spec/json_protocol_spec.rb +2 -2
  26. data/spec/thin_http_server_spec.rb +140 -0
  27. data/spec/union_spec.rb +13 -1
  28. metadata +113 -93
  29. data/benchmark/gen-rb/benchmark_constants.rb +0 -11
  30. data/benchmark/gen-rb/benchmark_service.rb +0 -80
  31. data/benchmark/gen-rb/benchmark_types.rb +0 -10
  32. data/spec/gen-rb/nonblocking_service.rb +0 -272
  33. data/spec/gen-rb/thrift_spec_constants.rb +0 -11
  34. data/spec/gen-rb/thrift_spec_types.rb +0 -538
  35. data/spec/mongrel_http_server_spec.rb +0 -114
  36. data/test/debug_proto/gen-rb/debug_proto_test_constants.rb +0 -274
  37. data/test/debug_proto/gen-rb/debug_proto_test_types.rb +0 -761
  38. data/test/debug_proto/gen-rb/empty_service.rb +0 -24
  39. data/test/debug_proto/gen-rb/inherited.rb +0 -79
  40. data/test/debug_proto/gen-rb/reverse_order_service.rb +0 -82
  41. data/test/debug_proto/gen-rb/service_for_exception_with_a_map.rb +0 -81
  42. data/test/debug_proto/gen-rb/srv.rb +0 -330
@@ -1,114 +0,0 @@
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 'thrift/server/mongrel_http_server'
22
-
23
- describe 'HTTPServer' do
24
-
25
- describe Thrift::MongrelHTTPServer do
26
- it "should have appropriate defaults" do
27
- mock_factory = mock("BinaryProtocolFactory")
28
- mock_proc = mock("Processor")
29
- Thrift::BinaryProtocolFactory.should_receive(:new).and_return(mock_factory)
30
- Mongrel::HttpServer.should_receive(:new).with("0.0.0.0", 80).and_return do
31
- mock("Mongrel::HttpServer").tap do |mock|
32
- handler = mock("Handler")
33
- Thrift::MongrelHTTPServer::Handler.should_receive(:new).with(mock_proc, mock_factory).and_return(handler)
34
- mock.should_receive(:register).with("/", handler)
35
- end
36
- end
37
- Thrift::MongrelHTTPServer.new(mock_proc)
38
- end
39
-
40
- it "should understand :ip, :port, :path, and :protocol_factory" do
41
- mock_proc = mock("Processor")
42
- mock_factory = mock("ProtocolFactory")
43
- Mongrel::HttpServer.should_receive(:new).with("1.2.3.4", 1234).and_return do
44
- mock("Mongrel::HttpServer").tap do |mock|
45
- handler = mock("Handler")
46
- Thrift::MongrelHTTPServer::Handler.should_receive(:new).with(mock_proc, mock_factory).and_return(handler)
47
- mock.should_receive(:register).with("/foo", handler)
48
- end
49
- end
50
- Thrift::MongrelHTTPServer.new(mock_proc, :ip => "1.2.3.4", :port => 1234, :path => "foo",
51
- :protocol_factory => mock_factory)
52
- end
53
-
54
- it "should serve using Mongrel::HttpServer" do
55
- Thrift::BinaryProtocolFactory.stub!(:new)
56
- Mongrel::HttpServer.should_receive(:new).and_return do
57
- mock("Mongrel::HttpServer").tap do |mock|
58
- Thrift::MongrelHTTPServer::Handler.stub!(:new)
59
- mock.stub!(:register)
60
- mock.should_receive(:run).and_return do
61
- mock("Mongrel::HttpServer.run").tap do |runner|
62
- runner.should_receive(:join)
63
- end
64
- end
65
- end
66
- end
67
- Thrift::MongrelHTTPServer.new(nil).serve
68
- end
69
- end
70
-
71
- describe Thrift::MongrelHTTPServer::Handler do
72
- before(:each) do
73
- @processor = mock("Processor")
74
- @factory = mock("ProtocolFactory")
75
- @handler = described_class.new(@processor, @factory)
76
- end
77
-
78
- it "should return 404 for non-POST requests" do
79
- request = mock("request", :params => {"REQUEST_METHOD" => "GET"})
80
- response = mock("response")
81
- response.should_receive(:start).with(404)
82
- response.should_not_receive(:start).with(200)
83
- @handler.process(request, response)
84
- end
85
-
86
- it "should serve using application/x-thrift" do
87
- request = mock("request", :params => {"REQUEST_METHOD" => "POST"}, :body => nil)
88
- response = mock("response")
89
- head = mock("head")
90
- head.should_receive(:[]=).with("Content-Type", "application/x-thrift")
91
- Thrift::IOStreamTransport.stub!(:new)
92
- @factory.stub!(:get_protocol)
93
- @processor.stub!(:process)
94
- response.should_receive(:start).with(200).and_yield(head, nil)
95
- @handler.process(request, response)
96
- end
97
-
98
- it "should use the IOStreamTransport" do
99
- body = mock("body")
100
- request = mock("request", :params => {"REQUEST_METHOD" => "POST"}, :body => body)
101
- response = mock("response")
102
- head = mock("head")
103
- head.stub!(:[]=)
104
- out = mock("out")
105
- protocol = mock("protocol")
106
- transport = mock("transport")
107
- Thrift::IOStreamTransport.should_receive(:new).with(body, out).and_return(transport)
108
- @factory.should_receive(:get_protocol).with(transport).and_return(protocol)
109
- @processor.should_receive(:process).with(protocol, protocol)
110
- response.should_receive(:start).with(200).and_yield(head, out)
111
- @handler.process(request, response)
112
- end
113
- end
114
- end
@@ -1,274 +0,0 @@
1
- #
2
- # Autogenerated by Thrift Compiler (0.9.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
- COMPACT_TEST = ::CompactProtoTestStruct.new({
11
- %q"a_byte" => 127,
12
- %q"a_i16" => 32000,
13
- %q"a_i32" => 1000000000,
14
- %q"a_i64" => 1099511627775,
15
- %q"a_double" => 5.6789,
16
- %q"a_string" => %q"my string",
17
- %q"true_field" => true,
18
- %q"false_field" => false,
19
- %q"empty_struct_field" => ::Empty.new({
20
- }),
21
- %q"byte_list" => [
22
- -127,
23
- -1,
24
- 0,
25
- 1,
26
- 127,
27
- ],
28
- %q"i16_list" => [
29
- -1,
30
- 0,
31
- 1,
32
- 32767,
33
- ],
34
- %q"i32_list" => [
35
- -1,
36
- 0,
37
- 255,
38
- 65535,
39
- 16777215,
40
- 2147483647,
41
- ],
42
- %q"i64_list" => [
43
- -1,
44
- 0,
45
- 255,
46
- 65535,
47
- 16777215,
48
- 4294967295,
49
- 1099511627775,
50
- 281474976710655,
51
- 72057594037927935,
52
- 9223372036854775807,
53
- ],
54
- %q"double_list" => [
55
- 0.1,
56
- 0.2,
57
- 0.3,
58
- ],
59
- %q"string_list" => [
60
- %q"first",
61
- %q"second",
62
- %q"third",
63
- ],
64
- %q"boolean_list" => [
65
- true,
66
- true,
67
- true,
68
- false,
69
- false,
70
- false,
71
- ],
72
- %q"struct_list" => [
73
- ::Empty.new({
74
- }),
75
- ::Empty.new({
76
- }),
77
- ],
78
- %q"byte_set" => Set.new([
79
- -127,
80
- -1,
81
- 0,
82
- 1,
83
- 127,
84
- ]),
85
- %q"i16_set" => Set.new([
86
- -1,
87
- 0,
88
- 1,
89
- 32767,
90
- ]),
91
- %q"i32_set" => Set.new([
92
- 1,
93
- 2,
94
- 3,
95
- ]),
96
- %q"i64_set" => Set.new([
97
- -1,
98
- 0,
99
- 255,
100
- 65535,
101
- 16777215,
102
- 4294967295,
103
- 1099511627775,
104
- 281474976710655,
105
- 72057594037927935,
106
- 9223372036854775807,
107
- ]),
108
- %q"double_set" => Set.new([
109
- 0.1,
110
- 0.2,
111
- 0.3,
112
- ]),
113
- %q"string_set" => Set.new([
114
- %q"first",
115
- %q"second",
116
- %q"third",
117
- ]),
118
- %q"boolean_set" => Set.new([
119
- true,
120
- false,
121
- ]),
122
- %q"struct_set" => Set.new([
123
- ::Empty.new({
124
- }),
125
- ]),
126
- %q"byte_byte_map" => {
127
- 1 => 2,
128
- },
129
- %q"i16_byte_map" => {
130
- 1 => 1,
131
- -1 => 1,
132
- 32767 => 1,
133
- },
134
- %q"i32_byte_map" => {
135
- 1 => 1,
136
- -1 => 1,
137
- 2147483647 => 1,
138
- },
139
- %q"i64_byte_map" => {
140
- 0 => 1,
141
- 1 => 1,
142
- -1 => 1,
143
- 9223372036854775807 => 1,
144
- },
145
- %q"double_byte_map" => {
146
- -1.1 => 1,
147
- 1.1 => 1,
148
- },
149
- %q"string_byte_map" => {
150
- %q"first" => 1,
151
- %q"second" => 2,
152
- %q"third" => 3,
153
- %q"" => 0,
154
- },
155
- %q"boolean_byte_map" => {
156
- true => 1,
157
- false => 0,
158
- },
159
- %q"byte_i16_map" => {
160
- 1 => 1,
161
- 2 => -1,
162
- 3 => 32767,
163
- },
164
- %q"byte_i32_map" => {
165
- 1 => 1,
166
- 2 => -1,
167
- 3 => 2147483647,
168
- },
169
- %q"byte_i64_map" => {
170
- 1 => 1,
171
- 2 => -1,
172
- 3 => 9223372036854775807,
173
- },
174
- %q"byte_double_map" => {
175
- 1 => 0.1,
176
- 2 => -0.1,
177
- 3 => 1e+06,
178
- },
179
- %q"byte_string_map" => {
180
- 1 => %q"",
181
- 2 => %q"blah",
182
- 3 => %q"loooooooooooooong string",
183
- },
184
- %q"byte_boolean_map" => {
185
- 1 => true,
186
- 2 => false,
187
- },
188
- %q"list_byte_map" => {
189
- [
190
- 1,
191
- 2,
192
- 3,
193
- ] => 1,
194
- [
195
- 0,
196
- 1,
197
- ] => 2,
198
- [
199
- ] => 0,
200
- },
201
- %q"set_byte_map" => {
202
- Set.new([
203
- 1,
204
- 2,
205
- 3,
206
- ]) => 1,
207
- Set.new([
208
- 0,
209
- 1,
210
- ]) => 2,
211
- Set.new([
212
- ]) => 0,
213
- },
214
- %q"map_byte_map" => {
215
- {
216
- 1 => 1,
217
- } => 1,
218
- {
219
- 2 => 2,
220
- } => 2,
221
- {
222
- } => 0,
223
- },
224
- %q"byte_map_map" => {
225
- 0 => {
226
- },
227
- 1 => {
228
- 1 => 1,
229
- },
230
- 2 => {
231
- 1 => 1,
232
- 2 => 2,
233
- },
234
- },
235
- %q"byte_set_map" => {
236
- 0 => Set.new([
237
- ]),
238
- 1 => Set.new([
239
- 1,
240
- ]),
241
- 2 => Set.new([
242
- 1,
243
- 2,
244
- ]),
245
- },
246
- %q"byte_list_map" => {
247
- 0 => [
248
- ],
249
- 1 => [
250
- 1,
251
- ],
252
- 2 => [
253
- 1,
254
- 2,
255
- ],
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
-
@@ -1,761 +0,0 @@
1
- #
2
- # Autogenerated by Thrift Compiler (0.9.0)
3
- #
4
- # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
- #
6
-
7
- require 'thrift'
8
-
9
- module 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
- SMALL = 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
- SMALL => {:type => ::Thrift::Types::DOUBLE, :name => 'small'},
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
-