upfluence-thrift 2.7.9 → 2.7.12
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/ext/struct.c +2 -1
- data/lib/thrift/processor.rb +8 -7
- data/lib/thrift/union.rb +2 -2
- data/spec/json_protocol_spec.rb +12 -0
- data/spec/processor_spec.rb +33 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9855b1966c6fd48cc31f981908b2fdcd8fd7e1b0637dd831bdcefaf9b7b779a8
|
|
4
|
+
data.tar.gz: 8aa5d8b3a438e5ab63e6d640cbb3f9d00c9c17073db85ca94dcf07471f8944a1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 53091d560bfdb7f7a4a8702028d47eed179823a92cdda0488b55c1ce047a676aa6e1111719ef1e7f52638e9872803205539084985253390a1778b7cc56dcdc1a
|
|
7
|
+
data.tar.gz: a4442f36ef65e752eaf1c291782a14c2da0d67772343c5c5c883e138a7213070ca50a8bbadeff635582f2be6a3f78b715e474453cce77aabde12cecfd52a866a
|
data/ext/struct.c
CHANGED
|
@@ -676,8 +676,9 @@ static VALUE rb_thrift_union_write(VALUE self, VALUE protocol) {
|
|
|
676
676
|
|
|
677
677
|
VALUE ttype_value = rb_hash_aref(field_info, type_sym);
|
|
678
678
|
int ttype = FIX2INT(ttype_value);
|
|
679
|
+
VALUE field_name = rb_hash_aref(field_info, name_sym);
|
|
679
680
|
|
|
680
|
-
default_write_field_begin(protocol,
|
|
681
|
+
default_write_field_begin(protocol, field_name, ttype_value, field_id);
|
|
681
682
|
|
|
682
683
|
write_anything(ttype, setvalue, protocol, field_info);
|
|
683
684
|
|
data/lib/thrift/processor.rb
CHANGED
|
@@ -92,13 +92,14 @@ module Thrift
|
|
|
92
92
|
end
|
|
93
93
|
@middleware = Middleware.wrap(middlewares)
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
# Walk ancestors child first so inherited methods are exposed and overrides win.
|
|
96
|
+
@processors = self.class.ancestors.each_with_object({}) do |klass, acc|
|
|
97
|
+
next unless klass.const_defined?(:METHODS, false)
|
|
98
|
+
|
|
99
|
+
klass::METHODS.each do |name, info|
|
|
100
|
+
acc[name] ||= build_processor(name, info)
|
|
101
|
+
end
|
|
102
|
+
end
|
|
102
103
|
end
|
|
103
104
|
|
|
104
105
|
def read_args(iprot, args_class)
|
data/lib/thrift/union.rb
CHANGED
|
@@ -75,11 +75,11 @@ module Thrift
|
|
|
75
75
|
field_info = struct_fields[fid]
|
|
76
76
|
type = field_info[:type]
|
|
77
77
|
if is_container? type
|
|
78
|
-
oprot.write_field_begin(
|
|
78
|
+
oprot.write_field_begin(field_info[:name], type, fid)
|
|
79
79
|
write_container(oprot, @value, field_info)
|
|
80
80
|
oprot.write_field_end
|
|
81
81
|
else
|
|
82
|
-
oprot.write_field(
|
|
82
|
+
oprot.write_field(field_info[:name], type, fid, @value)
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
oprot.write_field_stop
|
data/spec/json_protocol_spec.rb
CHANGED
|
@@ -33,6 +33,18 @@ describe 'JsonProtocol' do
|
|
|
33
33
|
@trans.read(@trans.available).should == '{"greeting":"hello world"}'
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
+
it 'should pretty print union' do
|
|
37
|
+
SpecNamespace::My_union.new(:integer32, 25).write(@prot)
|
|
38
|
+
|
|
39
|
+
@trans.read(@trans.available).should == '{"integer32":25}'
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'should pretty print union with a container field' do
|
|
43
|
+
SpecNamespace::My_union.new(:my_map, { SpecNamespace::SomeEnum::ONE => [] }).write(@prot)
|
|
44
|
+
|
|
45
|
+
@trans.read(@trans.available).should == '{"my_map":{"0":[]}}'
|
|
46
|
+
end
|
|
47
|
+
|
|
36
48
|
it 'shound not be able to read message' do
|
|
37
49
|
@trans.write('{"greeting":"hello world"}')
|
|
38
50
|
expect {@prot.read_message_begin}.to raise_error(Thrift::ProtocolException)
|
data/spec/processor_spec.rb
CHANGED
|
@@ -77,6 +77,20 @@ describe Thrift::Processor do
|
|
|
77
77
|
result_klass: EmptyResult,
|
|
78
78
|
args: [],
|
|
79
79
|
exceptions: {},
|
|
80
|
+
void_result: true,
|
|
81
|
+
oneway: false
|
|
82
|
+
}
|
|
83
|
+
}.freeze
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
class ExtendedProcessor < CurrentProcessor
|
|
87
|
+
METHODS = {
|
|
88
|
+
'pong' => {
|
|
89
|
+
args_klass: EmptyArgs,
|
|
90
|
+
result_klass: EmptyResult,
|
|
91
|
+
args: [],
|
|
92
|
+
exceptions: {},
|
|
93
|
+
void_result: true,
|
|
80
94
|
oneway: false
|
|
81
95
|
}
|
|
82
96
|
}.freeze
|
|
@@ -179,6 +193,25 @@ describe Thrift::Processor do
|
|
|
179
193
|
)
|
|
180
194
|
end
|
|
181
195
|
|
|
196
|
+
%w[ping pong].each do |name|
|
|
197
|
+
it "processes #{name} with a processor extending another service" do
|
|
198
|
+
handler = double('handler', ping: nil, pong: nil)
|
|
199
|
+
processor = ExtendedProcessor.new(handler)
|
|
200
|
+
oprot, trans = output_protocol
|
|
201
|
+
|
|
202
|
+
expect(processor.process(request_protocol(name), oprot)).to eq(true)
|
|
203
|
+
expect(oprot.read_message_begin).to eq(
|
|
204
|
+
[name, Thrift::MessageTypes::REPLY, 17]
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
EmptyResult.new.read(oprot)
|
|
208
|
+
oprot.read_message_end
|
|
209
|
+
|
|
210
|
+
expect(trans.available).to eq(0)
|
|
211
|
+
expect(handler).to have_received(name)
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
|
|
182
215
|
it 'writes internal errors raised by a current processor' do
|
|
183
216
|
handler = double('handler')
|
|
184
217
|
allow(handler).to receive(:ping).and_raise(StandardError, 'boom')
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: upfluence-thrift
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.7.
|
|
4
|
+
version: 2.7.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thrift Developers
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-09-
|
|
10
|
+
date: 2026-09-16 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rspec
|