upfluence-thrift 2.6.8 → 2.7.4
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 +4 -4
- data/benchmark/{gen-rb/benchmark_constants.rb → benchmark_constants.rb} +1 -1
- data/benchmark/{gen-rb/benchmark_service.rb → benchmark_service.rb} +2 -2
- data/benchmark/{gen-rb/benchmark_types.rb → benchmark_types.rb} +1 -1
- data/ext/struct.c +5 -1
- data/lib/thrift/base_stream.rb +85 -0
- data/lib/thrift/bidi_stream.rb +183 -0
- data/lib/thrift/client.rb +84 -17
- data/lib/thrift/inbound_stream.rb +72 -0
- data/lib/thrift/middleware.rb +42 -0
- data/lib/thrift/outbound_stream.rb +52 -0
- data/lib/thrift/processor.rb +287 -47
- data/lib/thrift/protocol/base_protocol.rb +35 -33
- data/lib/thrift/protocol/binary_protocol.rb +8 -1
- data/lib/thrift/protocol/binary_protocol_accelerated.rb +8 -0
- data/lib/thrift/protocol/compact_protocol.rb +8 -0
- data/lib/thrift/protocol/json_protocol.rb +21 -4
- data/lib/thrift/protocol/multiplexed_protocol.rb +5 -1
- data/lib/thrift/server/base_server.rb +8 -2
- data/lib/thrift/server/nonblocking_server.rb +5 -4
- data/lib/thrift/server/simple_server.rb +5 -1
- data/lib/thrift/server/thread_pool_server.rb +5 -1
- data/lib/thrift/server/threaded_server.rb +5 -1
- data/lib/thrift/transport/base_server_transport.rb +1 -1
- data/lib/thrift/transport/base_transport.rb +8 -0
- data/lib/thrift/transport/buffered_transport.rb +9 -1
- data/lib/thrift/transport/framed_transport.rb +9 -1
- data/lib/thrift/transport/http_client_transport.rb +4 -0
- data/lib/thrift/transport/io_stream_transport.rb +4 -1
- data/lib/thrift/transport/memory_buffer_transport.rb +4 -0
- data/lib/thrift/transport/server_socket.rb +5 -0
- data/lib/thrift/transport/socket.rb +21 -17
- data/lib/thrift/transport/ssl_server_socket.rb +41 -0
- data/lib/thrift/transport/ssl_socket.rb +51 -0
- data/lib/thrift/transport/unix_server_socket.rb +5 -1
- data/lib/thrift/transport/unix_socket.rb +5 -1
- data/lib/thrift/types/annotation/deprecation/deprecation_constants.rb +1 -1
- data/lib/thrift/types/annotation/deprecation/deprecation_types.rb +2 -2
- data/lib/thrift/types/annotation/exception/exception_constants.rb +17 -0
- data/lib/thrift/types/annotation/exception/exception_types.rb +44 -0
- data/lib/thrift/types/annotation/naming/naming_constants.rb +1 -1
- data/lib/thrift/types/annotation/naming/naming_types.rb +2 -2
- data/lib/thrift/types/annotation/rpc/rpc_constants.rb +17 -0
- data/lib/thrift/types/annotation/rpc/rpc_types.rb +74 -0
- data/lib/thrift/types/annotation_definition/annotation_definition_constants.rb +15 -0
- data/lib/thrift/types/annotation_definition/annotation_definition_types.rb +116 -0
- data/lib/thrift/types/constant_definition/constant_definition_constants.rb +15 -0
- data/lib/thrift/types/constant_definition/constant_definition_types.rb +292 -0
- data/lib/thrift/types/core/core_constants.rb +15 -0
- data/lib/thrift/types/core/core_types.rb +58 -0
- data/lib/thrift/types/enum_definition/enum_definition_constants.rb +15 -0
- data/lib/thrift/types/enum_definition/enum_definition_types.rb +106 -0
- data/lib/thrift/types/known/any/any_constants.rb +1 -1
- data/lib/thrift/types/known/any/any_types.rb +2 -2
- data/lib/thrift/types/known/duration/duration_constants.rb +1 -1
- data/lib/thrift/types/known/duration/duration_types.rb +2 -2
- data/lib/thrift/types/known/timestamp/timestamp_constants.rb +1 -1
- data/lib/thrift/types/known/timestamp/timestamp_types.rb +2 -2
- data/lib/thrift/types/plugin/plugin.rb +139 -0
- data/lib/thrift/types/plugin/plugin_constants.rb +15 -0
- data/lib/thrift/types/plugin/plugin_types.rb +106 -0
- data/lib/thrift/types/program_definition/program_definition_constants.rb +15 -0
- data/lib/thrift/types/program_definition/program_definition_types.rb +137 -0
- data/lib/thrift/types/service_definition/service_definition_constants.rb +15 -0
- data/lib/thrift/types/service_definition/service_definition_types.rb +160 -0
- data/lib/thrift/types/struct_definition/struct_definition_constants.rb +15 -0
- data/lib/thrift/types/struct_definition/struct_definition_types.rb +157 -0
- data/lib/thrift/types/type_definition/type_definition_constants.rb +15 -0
- data/lib/thrift/types/type_definition/type_definition_types.rb +242 -0
- data/lib/thrift/types/value/value_constants.rb +1 -1
- data/lib/thrift/types/value/value_types.rb +50 -51
- data/lib/thrift/types.rb +11 -3
- data/lib/thrift/union.rb +3 -6
- data/lib/thrift.rb +6 -0
- data/lib/types/annotation/deprecation/deprecation_constants.rb +16 -0
- data/lib/types/annotation/deprecation/deprecation_types.rb +42 -0
- data/lib/types/annotation/naming/naming_constants.rb +16 -0
- data/lib/types/annotation/naming/naming_types.rb +57 -0
- data/lib/types/annotation_definition/annotation_definition_constants.rb +14 -0
- data/lib/types/annotation_definition/annotation_definition_types.rb +114 -0
- data/lib/types/constant_definition/constant_definition_constants.rb +14 -0
- data/lib/types/constant_definition/constant_definition_types.rb +290 -0
- data/lib/types/core/core_constants.rb +14 -0
- data/lib/types/core/core_types.rb +56 -0
- data/lib/types/enum_definition/enum_definition_constants.rb +14 -0
- data/lib/types/enum_definition/enum_definition_types.rb +104 -0
- data/lib/types/known/any/any_constants.rb +16 -0
- data/lib/types/known/any/any_types.rb +59 -0
- data/lib/types/known/duration/duration_constants.rb +16 -0
- data/lib/types/known/duration/duration_types.rb +59 -0
- data/lib/types/known/timestamp/timestamp_constants.rb +16 -0
- data/lib/types/known/timestamp/timestamp_types.rb +59 -0
- data/lib/types/plugin/plugin.rb +137 -0
- data/lib/types/plugin/plugin_constants.rb +14 -0
- data/lib/types/plugin/plugin_types.rb +104 -0
- data/lib/types/program_definition/program_definition_constants.rb +14 -0
- data/lib/types/program_definition/program_definition_types.rb +135 -0
- data/lib/types/service_definition/service_definition_constants.rb +14 -0
- data/lib/types/service_definition/service_definition_types.rb +158 -0
- data/lib/types/struct_definition/struct_definition_constants.rb +14 -0
- data/lib/types/struct_definition/struct_definition_types.rb +155 -0
- data/lib/types/type_definition/type_definition_constants.rb +14 -0
- data/lib/types/type_definition/type_definition_types.rb +240 -0
- data/lib/types/value/value_constants.rb +14 -0
- data/lib/types/value/value_types.rb +330 -0
- data/spec/{gen-rb/base → base}/base_service.rb +2 -2
- data/spec/{gen-rb/base → base}/base_service_constants.rb +1 -1
- data/spec/{gen-rb/base → base}/base_service_types.rb +1 -1
- data/spec/base_protocol_spec.rb +79 -71
- data/spec/base_transport_spec.rb +155 -117
- data/spec/binary_protocol_accelerated_spec.rb +6 -2
- data/spec/binary_protocol_spec.rb +16 -8
- data/spec/binary_protocol_spec_shared.rb +77 -77
- data/spec/bytes_spec.rb +38 -38
- data/spec/client_spec.rb +48 -50
- data/spec/compact_protocol_spec.rb +59 -46
- data/spec/exception_spec.rb +54 -54
- data/spec/{gen-rb/extended → extended}/extended_service.rb +2 -2
- data/spec/{gen-rb/extended → extended}/extended_service_constants.rb +1 -1
- data/spec/{gen-rb/extended → extended}/extended_service_types.rb +1 -1
- data/spec/flat_spec.rb +5 -5
- data/spec/gen-rb/flat/namespaced_nonblocking_service.rb +4 -4
- data/spec/gen-rb/flat/referenced_constants.rb +1 -1
- data/spec/gen-rb/flat/referenced_types.rb +1 -1
- data/spec/gen-rb/flat/thrift_namespaced_spec_constants.rb +1 -1
- data/spec/gen-rb/flat/thrift_namespaced_spec_types.rb +1 -1
- data/spec/http_client_spec.rb +96 -43
- data/spec/json_protocol_spec.rb +170 -131
- data/spec/namespaced_spec.rb +24 -27
- data/spec/{gen-rb/namespaced_spec_namespace → namespaced_spec_namespace}/namespaced_nonblocking_service.rb +4 -4
- data/spec/{gen-rb/namespaced_spec_namespace → namespaced_spec_namespace}/thrift_namespaced_spec_constants.rb +1 -1
- data/spec/{gen-rb/namespaced_spec_namespace → namespaced_spec_namespace}/thrift_namespaced_spec_types.rb +1 -1
- data/spec/nonblocking_server_spec.rb +16 -16
- data/spec/{gen-rb/nonblocking_service.rb → nonblocking_service.rb} +4 -4
- data/spec/{gen-rb/other_namespace → other_namespace}/referenced_constants.rb +1 -1
- data/spec/{gen-rb/other_namespace → other_namespace}/referenced_types.rb +1 -1
- data/spec/processor_spec.rb +42 -31
- data/spec/rack_application_spec.rb +22 -26
- data/spec/serializer_spec.rb +20 -20
- data/spec/server_socket_spec.rb +27 -22
- data/spec/server_spec.rb +91 -51
- data/spec/socket_spec.rb +23 -16
- data/spec/socket_spec_shared.rb +31 -31
- data/spec/spec_helper.rb +1 -1
- data/spec/ssl_server_socket_spec.rb +34 -0
- data/spec/ssl_socket_spec.rb +78 -0
- data/spec/streaming_spec.rb +442 -0
- data/spec/struct_nested_containers_spec.rb +24 -24
- data/spec/struct_spec.rb +120 -120
- data/spec/thin_http_server_spec.rb +71 -28
- data/spec/{gen-rb/thrift_spec_constants.rb → thrift_spec_constants.rb} +1 -1
- data/spec/{gen-rb/thrift_spec_types.rb → thrift_spec_types.rb} +16 -16
- data/spec/types/known/any_spec.rb +2 -2
- data/spec/types/known/duration_spec.rb +1 -1
- data/spec/types/known/timestamp_spec.rb +1 -1
- data/spec/types/value_spec.rb +2 -1
- data/spec/types_spec.rb +56 -53
- data/spec/union_spec.rb +51 -40
- data/spec/unix_socket_spec.rb +43 -34
- data/test/debug_proto/gen-rb/debug_proto_test_constants.rb +267 -260
- data/test/debug_proto/gen-rb/debug_proto_test_types.rb +1481 -1416
- data/test/debug_proto/gen-rb/empty_service.rb +31 -27
- data/test/debug_proto/gen-rb/inherited.rb +102 -98
- data/test/debug_proto/gen-rb/reverse_order_service.rb +112 -108
- data/test/debug_proto/gen-rb/service_for_exception_with_a_map.rb +99 -95
- data/test/debug_proto/gen-rb/srv.rb +525 -406
- metadata +178 -41
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Autogenerated by Thrift Compiler (2.7.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 Types
|
|
10
|
+
module Value
|
|
11
|
+
class NullValue; end
|
|
12
|
+
|
|
13
|
+
class ListValue; end
|
|
14
|
+
|
|
15
|
+
class MapEntry; end
|
|
16
|
+
|
|
17
|
+
class MapValue; end
|
|
18
|
+
|
|
19
|
+
class Value < ::Thrift::Union; end
|
|
20
|
+
|
|
21
|
+
class StructValue; end
|
|
22
|
+
|
|
23
|
+
class NullValue
|
|
24
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
|
25
|
+
|
|
26
|
+
NAME = 'NullValue'.freeze
|
|
27
|
+
NAMESPACE = 'types.value'.freeze
|
|
28
|
+
|
|
29
|
+
LEGACY_ANNOTATIONS = {
|
|
30
|
+
}.freeze
|
|
31
|
+
|
|
32
|
+
STRUCTURED_ANNOTATIONS = [
|
|
33
|
+
].freeze
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
FIELDS = {
|
|
37
|
+
|
|
38
|
+
}.freeze
|
|
39
|
+
|
|
40
|
+
def struct_fields; FIELDS; end
|
|
41
|
+
|
|
42
|
+
def validate
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
::Thrift::Struct.generate_accessors self
|
|
46
|
+
::Thrift.register_struct_type self
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class ListValue
|
|
50
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
|
51
|
+
|
|
52
|
+
NAME = 'ListValue'.freeze
|
|
53
|
+
NAMESPACE = 'types.value'.freeze
|
|
54
|
+
|
|
55
|
+
LEGACY_ANNOTATIONS = {
|
|
56
|
+
}.freeze
|
|
57
|
+
|
|
58
|
+
STRUCTURED_ANNOTATIONS = [
|
|
59
|
+
].freeze
|
|
60
|
+
|
|
61
|
+
THRIFT_FIELD_INDEX_VALUES = 1
|
|
62
|
+
|
|
63
|
+
THRIFT_FIELD_VALUES_LEGACY_ANNOTATIONS = {
|
|
64
|
+
}.freeze
|
|
65
|
+
|
|
66
|
+
THRIFT_FIELD_VALUES_STRUCTURED_ANNOTATIONS = [
|
|
67
|
+
].freeze
|
|
68
|
+
|
|
69
|
+
FIELDS = {
|
|
70
|
+
THRIFT_FIELD_INDEX_VALUES => {type: ::Thrift::Types::LIST, name: 'values', element: {type: ::Thrift::Types::STRUCT, class: ::Types::Value::Value}, legacy_annotations: THRIFT_FIELD_VALUES_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_VALUES_STRUCTURED_ANNOTATIONS}
|
|
71
|
+
}.freeze
|
|
72
|
+
|
|
73
|
+
def struct_fields; FIELDS; end
|
|
74
|
+
|
|
75
|
+
def validate
|
|
76
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field values is unset!') unless @values
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
::Thrift::Struct.generate_accessors self
|
|
80
|
+
::Thrift.register_struct_type self
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
class MapEntry
|
|
84
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
|
85
|
+
|
|
86
|
+
NAME = 'MapEntry'.freeze
|
|
87
|
+
NAMESPACE = 'types.value'.freeze
|
|
88
|
+
|
|
89
|
+
LEGACY_ANNOTATIONS = {
|
|
90
|
+
}.freeze
|
|
91
|
+
|
|
92
|
+
STRUCTURED_ANNOTATIONS = [
|
|
93
|
+
].freeze
|
|
94
|
+
|
|
95
|
+
THRIFT_FIELD_INDEX_KEY = 1
|
|
96
|
+
THRIFT_FIELD_INDEX_VALUE = 2
|
|
97
|
+
|
|
98
|
+
THRIFT_FIELD_KEY_LEGACY_ANNOTATIONS = {
|
|
99
|
+
}.freeze
|
|
100
|
+
|
|
101
|
+
THRIFT_FIELD_KEY_STRUCTURED_ANNOTATIONS = [
|
|
102
|
+
].freeze
|
|
103
|
+
|
|
104
|
+
THRIFT_FIELD_VALUE_LEGACY_ANNOTATIONS = {
|
|
105
|
+
}.freeze
|
|
106
|
+
|
|
107
|
+
THRIFT_FIELD_VALUE_STRUCTURED_ANNOTATIONS = [
|
|
108
|
+
].freeze
|
|
109
|
+
|
|
110
|
+
FIELDS = {
|
|
111
|
+
THRIFT_FIELD_INDEX_KEY => {type: ::Thrift::Types::STRUCT, name: 'key', class: ::Types::Value::Value, legacy_annotations: THRIFT_FIELD_KEY_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_KEY_STRUCTURED_ANNOTATIONS},
|
|
112
|
+
THRIFT_FIELD_INDEX_VALUE => {type: ::Thrift::Types::STRUCT, name: 'value', class: ::Types::Value::Value, legacy_annotations: THRIFT_FIELD_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_VALUE_STRUCTURED_ANNOTATIONS}
|
|
113
|
+
}.freeze
|
|
114
|
+
|
|
115
|
+
def struct_fields; FIELDS; end
|
|
116
|
+
|
|
117
|
+
def validate
|
|
118
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field key is unset!') unless @key
|
|
119
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field value is unset!') unless @value
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
::Thrift::Struct.generate_accessors self
|
|
123
|
+
::Thrift.register_struct_type self
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
class MapValue
|
|
127
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
|
128
|
+
|
|
129
|
+
NAME = 'MapValue'.freeze
|
|
130
|
+
NAMESPACE = 'types.value'.freeze
|
|
131
|
+
|
|
132
|
+
LEGACY_ANNOTATIONS = {
|
|
133
|
+
}.freeze
|
|
134
|
+
|
|
135
|
+
STRUCTURED_ANNOTATIONS = [
|
|
136
|
+
].freeze
|
|
137
|
+
|
|
138
|
+
THRIFT_FIELD_INDEX_ENTRIES = 1
|
|
139
|
+
|
|
140
|
+
THRIFT_FIELD_ENTRIES_LEGACY_ANNOTATIONS = {
|
|
141
|
+
}.freeze
|
|
142
|
+
|
|
143
|
+
THRIFT_FIELD_ENTRIES_STRUCTURED_ANNOTATIONS = [
|
|
144
|
+
].freeze
|
|
145
|
+
|
|
146
|
+
FIELDS = {
|
|
147
|
+
THRIFT_FIELD_INDEX_ENTRIES => {type: ::Thrift::Types::LIST, name: 'entries', element: {type: ::Thrift::Types::STRUCT, class: ::Types::Value::MapEntry}, legacy_annotations: THRIFT_FIELD_ENTRIES_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_ENTRIES_STRUCTURED_ANNOTATIONS}
|
|
148
|
+
}.freeze
|
|
149
|
+
|
|
150
|
+
def struct_fields; FIELDS; end
|
|
151
|
+
|
|
152
|
+
def validate
|
|
153
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field entries is unset!') unless @entries
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
::Thrift::Struct.generate_accessors self
|
|
157
|
+
::Thrift.register_struct_type self
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
class Value < ::Thrift::Union
|
|
161
|
+
include ::Thrift::Struct_Union
|
|
162
|
+
|
|
163
|
+
NAME = 'Value'.freeze
|
|
164
|
+
NAMESPACE = 'types.value'.freeze
|
|
165
|
+
|
|
166
|
+
LEGACY_ANNOTATIONS = {
|
|
167
|
+
}.freeze
|
|
168
|
+
|
|
169
|
+
STRUCTURED_ANNOTATIONS = [
|
|
170
|
+
].freeze
|
|
171
|
+
|
|
172
|
+
class << self
|
|
173
|
+
def null_value(val)
|
|
174
|
+
Value.new(:null_value, val)
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def string_value(val)
|
|
178
|
+
Value.new(:string_value, val)
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def binary_value(val)
|
|
182
|
+
Value.new(:binary_value, val)
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def integer_value(val)
|
|
186
|
+
Value.new(:integer_value, val)
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def double_value(val)
|
|
190
|
+
Value.new(:double_value, val)
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
def bool_value(val)
|
|
194
|
+
Value.new(:bool_value, val)
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def list_value(val)
|
|
198
|
+
Value.new(:list_value, val)
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
def map_value(val)
|
|
202
|
+
Value.new(:map_value, val)
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
def struct_value(val)
|
|
206
|
+
Value.new(:struct_value, val)
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
THRIFT_FIELD_INDEX_NULL_VALUE = 1
|
|
211
|
+
THRIFT_FIELD_INDEX_STRING_VALUE = 2
|
|
212
|
+
THRIFT_FIELD_INDEX_BINARY_VALUE = 3
|
|
213
|
+
THRIFT_FIELD_INDEX_INTEGER_VALUE = 4
|
|
214
|
+
THRIFT_FIELD_INDEX_DOUBLE_VALUE = 5
|
|
215
|
+
THRIFT_FIELD_INDEX_BOOL_VALUE = 6
|
|
216
|
+
THRIFT_FIELD_INDEX_LIST_VALUE = 7
|
|
217
|
+
THRIFT_FIELD_INDEX_MAP_VALUE = 8
|
|
218
|
+
THRIFT_FIELD_INDEX_STRUCT_VALUE = 9
|
|
219
|
+
|
|
220
|
+
THRIFT_FIELD_NULL_VALUE_LEGACY_ANNOTATIONS = {
|
|
221
|
+
}.freeze
|
|
222
|
+
|
|
223
|
+
THRIFT_FIELD_NULL_VALUE_STRUCTURED_ANNOTATIONS = [
|
|
224
|
+
].freeze
|
|
225
|
+
|
|
226
|
+
THRIFT_FIELD_STRING_VALUE_LEGACY_ANNOTATIONS = {
|
|
227
|
+
}.freeze
|
|
228
|
+
|
|
229
|
+
THRIFT_FIELD_STRING_VALUE_STRUCTURED_ANNOTATIONS = [
|
|
230
|
+
].freeze
|
|
231
|
+
|
|
232
|
+
THRIFT_FIELD_BINARY_VALUE_LEGACY_ANNOTATIONS = {
|
|
233
|
+
}.freeze
|
|
234
|
+
|
|
235
|
+
THRIFT_FIELD_BINARY_VALUE_STRUCTURED_ANNOTATIONS = [
|
|
236
|
+
].freeze
|
|
237
|
+
|
|
238
|
+
THRIFT_FIELD_INTEGER_VALUE_LEGACY_ANNOTATIONS = {
|
|
239
|
+
}.freeze
|
|
240
|
+
|
|
241
|
+
THRIFT_FIELD_INTEGER_VALUE_STRUCTURED_ANNOTATIONS = [
|
|
242
|
+
].freeze
|
|
243
|
+
|
|
244
|
+
THRIFT_FIELD_DOUBLE_VALUE_LEGACY_ANNOTATIONS = {
|
|
245
|
+
}.freeze
|
|
246
|
+
|
|
247
|
+
THRIFT_FIELD_DOUBLE_VALUE_STRUCTURED_ANNOTATIONS = [
|
|
248
|
+
].freeze
|
|
249
|
+
|
|
250
|
+
THRIFT_FIELD_BOOL_VALUE_LEGACY_ANNOTATIONS = {
|
|
251
|
+
}.freeze
|
|
252
|
+
|
|
253
|
+
THRIFT_FIELD_BOOL_VALUE_STRUCTURED_ANNOTATIONS = [
|
|
254
|
+
].freeze
|
|
255
|
+
|
|
256
|
+
THRIFT_FIELD_LIST_VALUE_LEGACY_ANNOTATIONS = {
|
|
257
|
+
}.freeze
|
|
258
|
+
|
|
259
|
+
THRIFT_FIELD_LIST_VALUE_STRUCTURED_ANNOTATIONS = [
|
|
260
|
+
].freeze
|
|
261
|
+
|
|
262
|
+
THRIFT_FIELD_MAP_VALUE_LEGACY_ANNOTATIONS = {
|
|
263
|
+
}.freeze
|
|
264
|
+
|
|
265
|
+
THRIFT_FIELD_MAP_VALUE_STRUCTURED_ANNOTATIONS = [
|
|
266
|
+
].freeze
|
|
267
|
+
|
|
268
|
+
THRIFT_FIELD_STRUCT_VALUE_LEGACY_ANNOTATIONS = {
|
|
269
|
+
}.freeze
|
|
270
|
+
|
|
271
|
+
THRIFT_FIELD_STRUCT_VALUE_STRUCTURED_ANNOTATIONS = [
|
|
272
|
+
].freeze
|
|
273
|
+
|
|
274
|
+
FIELDS = {
|
|
275
|
+
THRIFT_FIELD_INDEX_NULL_VALUE => {type: ::Thrift::Types::STRUCT, name: 'null_value', class: ::Types::Value::NullValue, optional: true, legacy_annotations: THRIFT_FIELD_NULL_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_NULL_VALUE_STRUCTURED_ANNOTATIONS},
|
|
276
|
+
THRIFT_FIELD_INDEX_STRING_VALUE => {type: ::Thrift::Types::STRING, name: 'string_value', optional: true, legacy_annotations: THRIFT_FIELD_STRING_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_STRING_VALUE_STRUCTURED_ANNOTATIONS},
|
|
277
|
+
THRIFT_FIELD_INDEX_BINARY_VALUE => {type: ::Thrift::Types::STRING, name: 'binary_value', binary: true, optional: true, legacy_annotations: THRIFT_FIELD_BINARY_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_BINARY_VALUE_STRUCTURED_ANNOTATIONS},
|
|
278
|
+
THRIFT_FIELD_INDEX_INTEGER_VALUE => {type: ::Thrift::Types::I64, name: 'integer_value', optional: true, legacy_annotations: THRIFT_FIELD_INTEGER_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_INTEGER_VALUE_STRUCTURED_ANNOTATIONS},
|
|
279
|
+
THRIFT_FIELD_INDEX_DOUBLE_VALUE => {type: ::Thrift::Types::DOUBLE, name: 'double_value', optional: true, legacy_annotations: THRIFT_FIELD_DOUBLE_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_DOUBLE_VALUE_STRUCTURED_ANNOTATIONS},
|
|
280
|
+
THRIFT_FIELD_INDEX_BOOL_VALUE => {type: ::Thrift::Types::BOOL, name: 'bool_value', optional: true, legacy_annotations: THRIFT_FIELD_BOOL_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_BOOL_VALUE_STRUCTURED_ANNOTATIONS},
|
|
281
|
+
THRIFT_FIELD_INDEX_LIST_VALUE => {type: ::Thrift::Types::STRUCT, name: 'list_value', class: ::Types::Value::ListValue, optional: true, legacy_annotations: THRIFT_FIELD_LIST_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_LIST_VALUE_STRUCTURED_ANNOTATIONS},
|
|
282
|
+
THRIFT_FIELD_INDEX_MAP_VALUE => {type: ::Thrift::Types::STRUCT, name: 'map_value', class: ::Types::Value::MapValue, optional: true, legacy_annotations: THRIFT_FIELD_MAP_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_MAP_VALUE_STRUCTURED_ANNOTATIONS},
|
|
283
|
+
THRIFT_FIELD_INDEX_STRUCT_VALUE => {type: ::Thrift::Types::STRUCT, name: 'struct_value', class: ::Types::Value::StructValue, optional: true, legacy_annotations: THRIFT_FIELD_STRUCT_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_STRUCT_VALUE_STRUCTURED_ANNOTATIONS}
|
|
284
|
+
}.freeze
|
|
285
|
+
|
|
286
|
+
def struct_fields; FIELDS; end
|
|
287
|
+
|
|
288
|
+
def validate
|
|
289
|
+
raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
::Thrift::Union.generate_accessors self
|
|
293
|
+
::Thrift.register_struct_type self
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
class StructValue
|
|
297
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
|
298
|
+
|
|
299
|
+
NAME = 'StructValue'.freeze
|
|
300
|
+
NAMESPACE = 'types.value'.freeze
|
|
301
|
+
|
|
302
|
+
LEGACY_ANNOTATIONS = {
|
|
303
|
+
}.freeze
|
|
304
|
+
|
|
305
|
+
STRUCTURED_ANNOTATIONS = [
|
|
306
|
+
].freeze
|
|
307
|
+
|
|
308
|
+
THRIFT_FIELD_INDEX_FIELDS = 1
|
|
309
|
+
|
|
310
|
+
THRIFT_FIELD_FIELDS_LEGACY_ANNOTATIONS = {
|
|
311
|
+
}.freeze
|
|
312
|
+
|
|
313
|
+
THRIFT_FIELD_FIELDS_STRUCTURED_ANNOTATIONS = [
|
|
314
|
+
].freeze
|
|
315
|
+
|
|
316
|
+
FIELDS = {
|
|
317
|
+
THRIFT_FIELD_INDEX_FIELDS => {type: ::Thrift::Types::MAP, name: 'fields', key: {type: ::Thrift::Types::STRING}, value: {type: ::Thrift::Types::STRUCT, class: ::Types::Value::Value}, optional: true, legacy_annotations: THRIFT_FIELD_FIELDS_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_FIELDS_STRUCTURED_ANNOTATIONS}
|
|
318
|
+
}.freeze
|
|
319
|
+
|
|
320
|
+
def struct_fields; FIELDS; end
|
|
321
|
+
|
|
322
|
+
def validate
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
::Thrift::Struct.generate_accessors self
|
|
326
|
+
::Thrift.register_struct_type self
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
end
|
|
330
|
+
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Autogenerated by Thrift Compiler ()
|
|
2
|
+
# Autogenerated by Thrift Compiler (v0.0.1-upfluence)
|
|
3
3
|
#
|
|
4
4
|
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
|
5
5
|
#
|
|
@@ -123,7 +123,7 @@ module Base
|
|
|
123
123
|
].freeze
|
|
124
124
|
|
|
125
125
|
METHODS = {
|
|
126
|
-
'greeting' => { args_klass: Greeting_args, oneway: false, legacy_annotations: THRIFT_METHOD_GREETING_STRUCTURED_ANNOTATIONS, structured_annotations: THRIFT_METHOD_GREETING_STRUCTURED_ANNOTATIONS},
|
|
126
|
+
'greeting' => { args_klass: Greeting_args, result_klass: Greeting_result, oneway: false, legacy_annotations: THRIFT_METHOD_GREETING_STRUCTURED_ANNOTATIONS, structured_annotations: THRIFT_METHOD_GREETING_STRUCTURED_ANNOTATIONS},
|
|
127
127
|
}.freeze
|
|
128
128
|
|
|
129
129
|
def execute_greeting(args)
|
data/spec/base_protocol_spec.rb
CHANGED
|
@@ -22,41 +22,46 @@ require 'spec_helper'
|
|
|
22
22
|
describe 'BaseProtocol' do
|
|
23
23
|
|
|
24
24
|
before(:each) do
|
|
25
|
-
@trans =
|
|
25
|
+
@trans = double("MockTransport")
|
|
26
26
|
@prot = Thrift::BaseProtocol.new(@trans)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
describe Thrift::BaseProtocol do
|
|
30
30
|
# most of the methods are stubs, so we can ignore them
|
|
31
31
|
|
|
32
|
+
it "should provide a reasonable to_s" do
|
|
33
|
+
expect(@trans).to receive(:to_s).once.and_return("trans")
|
|
34
|
+
expect(@prot.to_s).to eq("trans")
|
|
35
|
+
end
|
|
36
|
+
|
|
32
37
|
it "should make trans accessible" do
|
|
33
|
-
@prot.trans.
|
|
38
|
+
expect(@prot.trans).to eql(@trans)
|
|
34
39
|
end
|
|
35
40
|
|
|
36
41
|
it 'should write out a field nicely (deprecated write_field signature)' do
|
|
37
|
-
@prot.
|
|
38
|
-
@prot.
|
|
39
|
-
@prot.
|
|
42
|
+
expect(@prot).to receive(:write_field_begin).with('field', 'type', 'fid').ordered
|
|
43
|
+
expect(@prot).to receive(:write_type).with({:name => 'field', :type => 'type'}, 'value').ordered
|
|
44
|
+
expect(@prot).to receive(:write_field_end).ordered
|
|
40
45
|
@prot.write_field('field', 'type', 'fid', 'value')
|
|
41
46
|
end
|
|
42
47
|
|
|
43
48
|
it 'should write out a field nicely' do
|
|
44
|
-
@prot.
|
|
45
|
-
@prot.
|
|
46
|
-
@prot.
|
|
49
|
+
expect(@prot).to receive(:write_field_begin).with('field', 'type', 'fid').ordered
|
|
50
|
+
expect(@prot).to receive(:write_type).with({:name => 'field', :type => 'type', :binary => false}, 'value').ordered
|
|
51
|
+
expect(@prot).to receive(:write_field_end).ordered
|
|
47
52
|
@prot.write_field({:name => 'field', :type => 'type', :binary => false}, 'fid', 'value')
|
|
48
53
|
end
|
|
49
54
|
|
|
50
55
|
it 'should write out the different types (deprecated write_type signature)' do
|
|
51
|
-
@prot.
|
|
52
|
-
@prot.
|
|
53
|
-
@prot.
|
|
54
|
-
@prot.
|
|
55
|
-
@prot.
|
|
56
|
-
@prot.
|
|
57
|
-
@prot.
|
|
58
|
-
struct =
|
|
59
|
-
struct.
|
|
56
|
+
expect(@prot).to receive(:write_bool).with('bool').ordered
|
|
57
|
+
expect(@prot).to receive(:write_byte).with('byte').ordered
|
|
58
|
+
expect(@prot).to receive(:write_double).with('double').ordered
|
|
59
|
+
expect(@prot).to receive(:write_i16).with('i16').ordered
|
|
60
|
+
expect(@prot).to receive(:write_i32).with('i32').ordered
|
|
61
|
+
expect(@prot).to receive(:write_i64).with('i64').ordered
|
|
62
|
+
expect(@prot).to receive(:write_string).with('string').ordered
|
|
63
|
+
struct = double('Struct')
|
|
64
|
+
expect(struct).to receive(:write).with(@prot).ordered
|
|
60
65
|
@prot.write_type(Thrift::Types::BOOL, 'bool')
|
|
61
66
|
@prot.write_type(Thrift::Types::BYTE, 'byte')
|
|
62
67
|
@prot.write_type(Thrift::Types::DOUBLE, 'double')
|
|
@@ -72,16 +77,16 @@ describe 'BaseProtocol' do
|
|
|
72
77
|
end
|
|
73
78
|
|
|
74
79
|
it 'should write out the different types' do
|
|
75
|
-
@prot.
|
|
76
|
-
@prot.
|
|
77
|
-
@prot.
|
|
78
|
-
@prot.
|
|
79
|
-
@prot.
|
|
80
|
-
@prot.
|
|
81
|
-
@prot.
|
|
82
|
-
@prot.
|
|
83
|
-
struct =
|
|
84
|
-
struct.
|
|
80
|
+
expect(@prot).to receive(:write_bool).with('bool').ordered
|
|
81
|
+
expect(@prot).to receive(:write_byte).with('byte').ordered
|
|
82
|
+
expect(@prot).to receive(:write_double).with('double').ordered
|
|
83
|
+
expect(@prot).to receive(:write_i16).with('i16').ordered
|
|
84
|
+
expect(@prot).to receive(:write_i32).with('i32').ordered
|
|
85
|
+
expect(@prot).to receive(:write_i64).with('i64').ordered
|
|
86
|
+
expect(@prot).to receive(:write_string).with('string').ordered
|
|
87
|
+
expect(@prot).to receive(:write_binary).with('binary').ordered
|
|
88
|
+
struct = double('Struct')
|
|
89
|
+
expect(struct).to receive(:write).with(@prot).ordered
|
|
85
90
|
@prot.write_type({:type => Thrift::Types::BOOL}, 'bool')
|
|
86
91
|
@prot.write_type({:type => Thrift::Types::BYTE}, 'byte')
|
|
87
92
|
@prot.write_type({:type => Thrift::Types::DOUBLE}, 'double')
|
|
@@ -98,13 +103,13 @@ describe 'BaseProtocol' do
|
|
|
98
103
|
end
|
|
99
104
|
|
|
100
105
|
it 'should read the different types (deprecated read_type signature)' do
|
|
101
|
-
@prot.
|
|
102
|
-
@prot.
|
|
103
|
-
@prot.
|
|
104
|
-
@prot.
|
|
105
|
-
@prot.
|
|
106
|
-
@prot.
|
|
107
|
-
@prot.
|
|
106
|
+
expect(@prot).to receive(:read_bool).ordered
|
|
107
|
+
expect(@prot).to receive(:read_byte).ordered
|
|
108
|
+
expect(@prot).to receive(:read_i16).ordered
|
|
109
|
+
expect(@prot).to receive(:read_i32).ordered
|
|
110
|
+
expect(@prot).to receive(:read_i64).ordered
|
|
111
|
+
expect(@prot).to receive(:read_double).ordered
|
|
112
|
+
expect(@prot).to receive(:read_string).ordered
|
|
108
113
|
@prot.read_type(Thrift::Types::BOOL)
|
|
109
114
|
@prot.read_type(Thrift::Types::BYTE)
|
|
110
115
|
@prot.read_type(Thrift::Types::I16)
|
|
@@ -120,14 +125,14 @@ describe 'BaseProtocol' do
|
|
|
120
125
|
end
|
|
121
126
|
|
|
122
127
|
it 'should read the different types' do
|
|
123
|
-
@prot.
|
|
124
|
-
@prot.
|
|
125
|
-
@prot.
|
|
126
|
-
@prot.
|
|
127
|
-
@prot.
|
|
128
|
-
@prot.
|
|
129
|
-
@prot.
|
|
130
|
-
@prot.
|
|
128
|
+
expect(@prot).to receive(:read_bool).ordered
|
|
129
|
+
expect(@prot).to receive(:read_byte).ordered
|
|
130
|
+
expect(@prot).to receive(:read_i16).ordered
|
|
131
|
+
expect(@prot).to receive(:read_i32).ordered
|
|
132
|
+
expect(@prot).to receive(:read_i64).ordered
|
|
133
|
+
expect(@prot).to receive(:read_double).ordered
|
|
134
|
+
expect(@prot).to receive(:read_string).ordered
|
|
135
|
+
expect(@prot).to receive(:read_binary).ordered
|
|
131
136
|
@prot.read_type({:type => Thrift::Types::BOOL})
|
|
132
137
|
@prot.read_type({:type => Thrift::Types::BYTE})
|
|
133
138
|
@prot.read_type({:type => Thrift::Types::I16})
|
|
@@ -144,13 +149,13 @@ describe 'BaseProtocol' do
|
|
|
144
149
|
end
|
|
145
150
|
|
|
146
151
|
it "should skip the basic types" do
|
|
147
|
-
@prot.
|
|
148
|
-
@prot.
|
|
149
|
-
@prot.
|
|
150
|
-
@prot.
|
|
151
|
-
@prot.
|
|
152
|
-
@prot.
|
|
153
|
-
@prot.
|
|
152
|
+
expect(@prot).to receive(:read_bool).ordered
|
|
153
|
+
expect(@prot).to receive(:read_byte).ordered
|
|
154
|
+
expect(@prot).to receive(:read_i16).ordered
|
|
155
|
+
expect(@prot).to receive(:read_i32).ordered
|
|
156
|
+
expect(@prot).to receive(:read_i64).ordered
|
|
157
|
+
expect(@prot).to receive(:read_double).ordered
|
|
158
|
+
expect(@prot).to receive(:read_string).ordered
|
|
154
159
|
@prot.skip(Thrift::Types::BOOL)
|
|
155
160
|
@prot.skip(Thrift::Types::BYTE)
|
|
156
161
|
@prot.skip(Thrift::Types::I16)
|
|
@@ -158,52 +163,51 @@ describe 'BaseProtocol' do
|
|
|
158
163
|
@prot.skip(Thrift::Types::I64)
|
|
159
164
|
@prot.skip(Thrift::Types::DOUBLE)
|
|
160
165
|
@prot.skip(Thrift::Types::STRING)
|
|
161
|
-
@prot.skip(Thrift::Types::STOP) # should do absolutely nothing
|
|
162
166
|
end
|
|
163
167
|
|
|
164
168
|
it "should skip structs" do
|
|
165
169
|
real_skip = @prot.method(:skip)
|
|
166
|
-
@prot.
|
|
167
|
-
@prot.
|
|
170
|
+
expect(@prot).to receive(:read_struct_begin).ordered
|
|
171
|
+
expect(@prot).to receive(:read_field_begin).exactly(4).times.and_return(
|
|
168
172
|
['field 1', Thrift::Types::STRING, 1],
|
|
169
173
|
['field 2', Thrift::Types::I32, 2],
|
|
170
174
|
['field 3', Thrift::Types::MAP, 3],
|
|
171
175
|
[nil, Thrift::Types::STOP, 0]
|
|
172
176
|
)
|
|
173
|
-
@prot.
|
|
174
|
-
@prot.
|
|
175
|
-
@prot.
|
|
176
|
-
@prot.
|
|
177
|
+
expect(@prot).to receive(:read_field_end).exactly(3).times
|
|
178
|
+
expect(@prot).to receive(:read_string).exactly(3).times
|
|
179
|
+
expect(@prot).to receive(:read_i32).ordered
|
|
180
|
+
expect(@prot).to receive(:read_map_begin).ordered.and_return([Thrift::Types::STRING, Thrift::Types::STRING, 1])
|
|
177
181
|
# @prot.should_receive(:read_string).exactly(2).times
|
|
178
|
-
@prot.
|
|
179
|
-
@prot.
|
|
182
|
+
expect(@prot).to receive(:read_map_end).ordered
|
|
183
|
+
expect(@prot).to receive(:read_struct_end).ordered
|
|
180
184
|
real_skip.call(Thrift::Types::STRUCT)
|
|
181
185
|
end
|
|
182
186
|
|
|
183
187
|
it "should skip maps" do
|
|
184
188
|
real_skip = @prot.method(:skip)
|
|
185
|
-
@prot.
|
|
186
|
-
@prot.
|
|
187
|
-
@prot.
|
|
188
|
-
@prot.
|
|
189
|
-
@prot.
|
|
190
|
-
@prot.
|
|
189
|
+
expect(@prot).to receive(:read_map_begin).ordered.and_return([Thrift::Types::STRING, Thrift::Types::STRUCT, 1])
|
|
190
|
+
expect(@prot).to receive(:read_string).ordered
|
|
191
|
+
expect(@prot).to receive(:read_struct_begin).ordered.and_return(["some_struct"])
|
|
192
|
+
expect(@prot).to receive(:read_field_begin).ordered.and_return([nil, Thrift::Types::STOP, nil]);
|
|
193
|
+
expect(@prot).to receive(:read_struct_end).ordered
|
|
194
|
+
expect(@prot).to receive(:read_map_end).ordered
|
|
191
195
|
real_skip.call(Thrift::Types::MAP)
|
|
192
196
|
end
|
|
193
197
|
|
|
194
198
|
it "should skip sets" do
|
|
195
199
|
real_skip = @prot.method(:skip)
|
|
196
|
-
@prot.
|
|
197
|
-
@prot.
|
|
198
|
-
@prot.
|
|
200
|
+
expect(@prot).to receive(:read_set_begin).ordered.and_return([Thrift::Types::I64, 9])
|
|
201
|
+
expect(@prot).to receive(:read_i64).ordered.exactly(9).times
|
|
202
|
+
expect(@prot).to receive(:read_set_end)
|
|
199
203
|
real_skip.call(Thrift::Types::SET)
|
|
200
204
|
end
|
|
201
205
|
|
|
202
206
|
it "should skip lists" do
|
|
203
207
|
real_skip = @prot.method(:skip)
|
|
204
|
-
@prot.
|
|
205
|
-
@prot.
|
|
206
|
-
@prot.
|
|
208
|
+
expect(@prot).to receive(:read_list_begin).ordered.and_return([Thrift::Types::DOUBLE, 11])
|
|
209
|
+
expect(@prot).to receive(:read_double).ordered.exactly(11).times
|
|
210
|
+
expect(@prot).to receive(:read_list_end)
|
|
207
211
|
real_skip.call(Thrift::Types::LIST)
|
|
208
212
|
end
|
|
209
213
|
end
|
|
@@ -211,7 +215,11 @@ describe 'BaseProtocol' do
|
|
|
211
215
|
describe Thrift::BaseProtocolFactory do
|
|
212
216
|
it "should raise NotImplementedError" do
|
|
213
217
|
# returning nil since Protocol is just an abstract class
|
|
214
|
-
|
|
218
|
+
expect {Thrift::BaseProtocolFactory.new.get_protocol(double("MockTransport"))}.to raise_error(NotImplementedError)
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
it "should provide a reasonable to_s" do
|
|
222
|
+
expect(Thrift::BaseProtocolFactory.new.to_s).to eq("base")
|
|
215
223
|
end
|
|
216
224
|
end
|
|
217
225
|
end
|