thrift 0.16.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/binary_protocol_accelerated.c +5 -5
- data/ext/compact_protocol.c +9 -9
- data/ext/memory_buffer.c +1 -1
- data/ext/struct.c +1 -1
- data/lib/thrift/client.rb +10 -2
- data/spec/client_spec.rb +3 -1
- metadata +68 -69
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe32174805f7e6b9801ebf00500fad76c1922c3f5e816fba597dfc0aae195c5d
|
4
|
+
data.tar.gz: b908a7a66b4bff7fc95728778240d2583d685f2fdcdf563edb125dc571cb0040
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd8377282c40257b9d4bd2e95633584a04f27609118a8694d9a0037cbf9affc4d9f42aa4647c4dcd43ed64668a77f7abb375f77ca6e5bef8aaae03db8702dcd8
|
7
|
+
data.tar.gz: 31637b8001126ee81c9a74803e2cbb942cb57dfbc529a72ceb121a28a2614695689d55bd0204dc12429d82ce38a7c0057c18420a872921f376e20e178b213c5e
|
@@ -82,7 +82,7 @@ static void write_string_direct(VALUE trans, VALUE str) {
|
|
82
82
|
rb_raise(rb_eStandardError, "Value should be a string");
|
83
83
|
}
|
84
84
|
str = convert_to_utf8_byte_buffer(str);
|
85
|
-
write_i32_direct(trans, RSTRING_LEN(str));
|
85
|
+
write_i32_direct(trans, (int32_t)RSTRING_LEN(str));
|
86
86
|
rb_funcall(trans, write_method_id, 1, str);
|
87
87
|
}
|
88
88
|
|
@@ -223,7 +223,7 @@ VALUE rb_thrift_binary_proto_write_binary(VALUE self, VALUE buf) {
|
|
223
223
|
CHECK_NIL(buf);
|
224
224
|
VALUE trans = GET_TRANSPORT(self);
|
225
225
|
buf = force_binary_encoding(buf);
|
226
|
-
write_i32_direct(trans, RSTRING_LEN(buf));
|
226
|
+
write_i32_direct(trans, (int32_t)RSTRING_LEN(buf));
|
227
227
|
rb_funcall(trans, write_method_id, 1, buf);
|
228
228
|
return Qnil;
|
229
229
|
}
|
@@ -403,9 +403,9 @@ VALUE rb_thrift_binary_proto_read_binary(VALUE self) {
|
|
403
403
|
void Init_binary_protocol_accelerated() {
|
404
404
|
VALUE thrift_binary_protocol_class = rb_const_get(thrift_module, rb_intern("BinaryProtocol"));
|
405
405
|
|
406
|
-
VERSION_1 = rb_num2ll(rb_const_get(thrift_binary_protocol_class, rb_intern("VERSION_1")));
|
407
|
-
VERSION_MASK = rb_num2ll(rb_const_get(thrift_binary_protocol_class, rb_intern("VERSION_MASK")));
|
408
|
-
TYPE_MASK = rb_num2ll(rb_const_get(thrift_binary_protocol_class, rb_intern("TYPE_MASK")));
|
406
|
+
VERSION_1 = (int)rb_num2ll(rb_const_get(thrift_binary_protocol_class, rb_intern("VERSION_1")));
|
407
|
+
VERSION_MASK = (int)rb_num2ll(rb_const_get(thrift_binary_protocol_class, rb_intern("VERSION_MASK")));
|
408
|
+
TYPE_MASK = (int)rb_num2ll(rb_const_get(thrift_binary_protocol_class, rb_intern("TYPE_MASK")));
|
409
409
|
|
410
410
|
VALUE bpa_class = rb_define_class_under(thrift_module, "BinaryProtocolAccelerated", thrift_binary_protocol_class);
|
411
411
|
|
data/ext/compact_protocol.c
CHANGED
@@ -315,7 +315,7 @@ VALUE rb_thrift_compact_proto_write_string(VALUE self, VALUE str) {
|
|
315
315
|
VALUE rb_thrift_compact_proto_write_binary(VALUE self, VALUE buf) {
|
316
316
|
buf = force_binary_encoding(buf);
|
317
317
|
VALUE transport = GET_TRANSPORT(self);
|
318
|
-
write_varint32(transport, RSTRING_LEN(buf));
|
318
|
+
write_varint32(transport, (uint32_t)RSTRING_LEN(buf));
|
319
319
|
WRITE(transport, StringValuePtr(buf), RSTRING_LEN(buf));
|
320
320
|
return Qnil;
|
321
321
|
}
|
@@ -452,7 +452,7 @@ VALUE rb_thrift_compact_proto_read_message_begin(VALUE self) {
|
|
452
452
|
}
|
453
453
|
|
454
454
|
int8_t type = (version_and_type >> TYPE_SHIFT_AMOUNT) & TYPE_BITS;
|
455
|
-
int32_t seqid = read_varint64(self);
|
455
|
+
int32_t seqid = (int32_t)read_varint64(self);
|
456
456
|
VALUE messageName = rb_thrift_compact_proto_read_string(self);
|
457
457
|
return rb_ary_new3(3, messageName, INT2FIX(type), INT2NUM(seqid));
|
458
458
|
}
|
@@ -490,7 +490,7 @@ VALUE rb_thrift_compact_proto_read_field_begin(VALUE self) {
|
|
490
490
|
}
|
491
491
|
|
492
492
|
VALUE rb_thrift_compact_proto_read_map_begin(VALUE self) {
|
493
|
-
int32_t size = read_varint64(self);
|
493
|
+
int32_t size = (int32_t)read_varint64(self);
|
494
494
|
uint8_t key_and_value_type = size == 0 ? 0 : read_byte_direct(self);
|
495
495
|
return rb_ary_new3(3, INT2FIX(get_ttype(key_and_value_type >> 4)), INT2FIX(get_ttype(key_and_value_type & 0xf)), INT2FIX(size));
|
496
496
|
}
|
@@ -499,7 +499,7 @@ VALUE rb_thrift_compact_proto_read_list_begin(VALUE self) {
|
|
499
499
|
uint8_t size_and_type = read_byte_direct(self);
|
500
500
|
int32_t size = (size_and_type >> 4) & 0x0f;
|
501
501
|
if (size == 15) {
|
502
|
-
size = read_varint64(self);
|
502
|
+
size = (int32_t)read_varint64(self);
|
503
503
|
}
|
504
504
|
uint8_t type = get_ttype(size_and_type & 0x0f);
|
505
505
|
return rb_ary_new3(2, INT2FIX(type), INT2FIX(size));
|
@@ -528,7 +528,7 @@ VALUE rb_thrift_compact_proto_read_i16(VALUE self) {
|
|
528
528
|
}
|
529
529
|
|
530
530
|
VALUE rb_thrift_compact_proto_read_i32(VALUE self) {
|
531
|
-
return INT2NUM(zig_zag_to_int(read_varint64(self)));
|
531
|
+
return INT2NUM(zig_zag_to_int((int32_t)read_varint64(self)));
|
532
532
|
}
|
533
533
|
|
534
534
|
VALUE rb_thrift_compact_proto_read_i64(VALUE self) {
|
@@ -569,10 +569,10 @@ static void Init_constants() {
|
|
569
569
|
thrift_compact_protocol_class = rb_const_get(thrift_module, rb_intern("CompactProtocol"));
|
570
570
|
rb_global_variable(&thrift_compact_protocol_class);
|
571
571
|
|
572
|
-
VERSION = rb_num2ll(rb_const_get(thrift_compact_protocol_class, rb_intern("VERSION")));
|
573
|
-
VERSION_MASK = rb_num2ll(rb_const_get(thrift_compact_protocol_class, rb_intern("VERSION_MASK")));
|
574
|
-
TYPE_MASK = rb_num2ll(rb_const_get(thrift_compact_protocol_class, rb_intern("TYPE_MASK")));
|
575
|
-
TYPE_BITS = rb_num2ll(rb_const_get(thrift_compact_protocol_class, rb_intern("TYPE_BITS")));
|
572
|
+
VERSION = (int32_t)rb_num2ll(rb_const_get(thrift_compact_protocol_class, rb_intern("VERSION")));
|
573
|
+
VERSION_MASK = (int32_t)rb_num2ll(rb_const_get(thrift_compact_protocol_class, rb_intern("VERSION_MASK")));
|
574
|
+
TYPE_MASK = (int32_t)rb_num2ll(rb_const_get(thrift_compact_protocol_class, rb_intern("TYPE_MASK")));
|
575
|
+
TYPE_BITS = (int32_t)rb_num2ll(rb_const_get(thrift_compact_protocol_class, rb_intern("TYPE_BITS")));
|
576
576
|
TYPE_SHIFT_AMOUNT = FIX2INT(rb_const_get(thrift_compact_protocol_class, rb_intern("TYPE_SHIFT_AMOUNT")));
|
577
577
|
PROTOCOL_ID = FIX2INT(rb_const_get(thrift_compact_protocol_class, rb_intern("PROTOCOL_ID")));
|
578
578
|
|
data/ext/memory_buffer.c
CHANGED
@@ -54,7 +54,7 @@ VALUE rb_thrift_memory_buffer_read(VALUE self, VALUE length_value) {
|
|
54
54
|
|
55
55
|
index += length;
|
56
56
|
if (index > RSTRING_LEN(buf)) {
|
57
|
-
index = RSTRING_LEN(buf);
|
57
|
+
index = (int)RSTRING_LEN(buf);
|
58
58
|
}
|
59
59
|
if (index >= GARBAGE_BUFFER_SIZE) {
|
60
60
|
rb_ivar_set(self, buf_ivar_id, rb_funcall(buf, slice_method_id, 2, INT2FIX(index), INT2FIX(RSTRING_LEN(buf) - 1)));
|
data/ext/struct.c
CHANGED
data/lib/thrift/client.rb
CHANGED
@@ -50,9 +50,17 @@ module Thrift
|
|
50
50
|
@oprot.trans.flush
|
51
51
|
end
|
52
52
|
|
53
|
-
def
|
53
|
+
def receive_message_begin()
|
54
54
|
fname, mtype, rseqid = @iprot.read_message_begin
|
55
|
-
|
55
|
+
[fname, mtype, rseqid]
|
56
|
+
end
|
57
|
+
|
58
|
+
def reply_seqid(rseqid)
|
59
|
+
result = (rseqid==@seqid)?true:false
|
60
|
+
result
|
61
|
+
end
|
62
|
+
|
63
|
+
def receive_message(result_klass)
|
56
64
|
result = result_klass.new
|
57
65
|
result.read(@iprot)
|
58
66
|
@iprot.read_message_end
|
data/spec/client_spec.rb
CHANGED
@@ -69,6 +69,7 @@ describe 'Client' do
|
|
69
69
|
expect(@prot).to receive(:read_message_end)
|
70
70
|
mock_klass = double("#<MockClass:mock>")
|
71
71
|
expect(mock_klass).to receive(:read).with(@prot)
|
72
|
+
@client.receive_message_begin()
|
72
73
|
@client.receive_message(double("MockClass", :new => mock_klass))
|
73
74
|
end
|
74
75
|
|
@@ -80,7 +81,8 @@ describe 'Client' do
|
|
80
81
|
expect(mock_exc).to receive(:read).with(@prot)
|
81
82
|
end
|
82
83
|
end
|
83
|
-
|
84
|
+
fname, mtype, sqeid = @client.receive_message_begin()
|
85
|
+
expect { @client.handle_exception(mtype) }.to raise_error(StandardError)
|
84
86
|
end
|
85
87
|
|
86
88
|
it "should close the transport if an error occurs while sending a message" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thrift
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Apache Thrift Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 2.
|
75
|
+
version: 2.2.6.4
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 2.
|
82
|
+
version: 2.2.6.4
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rack-test
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -158,65 +158,65 @@ extensions:
|
|
158
158
|
- ext/extconf.rb
|
159
159
|
extra_rdoc_files:
|
160
160
|
- README.md
|
161
|
-
- ext/
|
161
|
+
- ext/binary_protocol_accelerated.c
|
162
162
|
- ext/bytes.c
|
163
|
+
- ext/compact_protocol.c
|
164
|
+
- ext/memory_buffer.c
|
163
165
|
- ext/protocol.c
|
164
166
|
- ext/strlcpy.c
|
165
|
-
- ext/memory_buffer.c
|
166
|
-
- ext/binary_protocol_accelerated.c
|
167
167
|
- ext/struct.c
|
168
|
-
- ext/
|
168
|
+
- ext/thrift_native.c
|
169
|
+
- ext/binary_protocol_accelerated.h
|
170
|
+
- ext/bytes.h
|
171
|
+
- ext/compact_protocol.h
|
169
172
|
- ext/constants.h
|
170
173
|
- ext/macros.h
|
171
|
-
- ext/strlcpy.h
|
172
|
-
- ext/bytes.h
|
173
174
|
- ext/memory_buffer.h
|
174
175
|
- ext/protocol.h
|
175
|
-
- ext/
|
176
|
+
- ext/strlcpy.h
|
176
177
|
- ext/struct.h
|
177
|
-
- ext/compact_protocol.h
|
178
178
|
- ext/extconf.rb
|
179
|
-
- lib/thrift/
|
180
|
-
- lib/thrift/
|
179
|
+
- lib/thrift/bytes.rb
|
180
|
+
- lib/thrift/client.rb
|
181
|
+
- lib/thrift/core_ext/fixnum.rb
|
182
|
+
- lib/thrift/core_ext.rb
|
183
|
+
- lib/thrift/exceptions.rb
|
184
|
+
- lib/thrift/multiplexed_processor.rb
|
181
185
|
- lib/thrift/processor.rb
|
186
|
+
- lib/thrift/protocol/base_protocol.rb
|
187
|
+
- lib/thrift/protocol/binary_protocol.rb
|
188
|
+
- lib/thrift/protocol/binary_protocol_accelerated.rb
|
189
|
+
- lib/thrift/protocol/compact_protocol.rb
|
182
190
|
- lib/thrift/protocol/json_protocol.rb
|
183
191
|
- lib/thrift/protocol/multiplexed_protocol.rb
|
184
192
|
- lib/thrift/protocol/protocol_decorator.rb
|
185
|
-
- lib/thrift/
|
186
|
-
- lib/thrift/
|
187
|
-
- lib/thrift/
|
188
|
-
- lib/thrift/
|
189
|
-
- lib/thrift/
|
190
|
-
- lib/thrift/thrift_native.rb
|
191
|
-
- lib/thrift/union.rb
|
192
|
-
- lib/thrift/bytes.rb
|
193
|
-
- lib/thrift/client.rb
|
194
|
-
- lib/thrift/multiplexed_processor.rb
|
195
|
-
- lib/thrift/server/thin_http_server.rb
|
193
|
+
- lib/thrift/serializer/deserializer.rb
|
194
|
+
- lib/thrift/serializer/serializer.rb
|
195
|
+
- lib/thrift/server/base_server.rb
|
196
|
+
- lib/thrift/server/mongrel_http_server.rb
|
197
|
+
- lib/thrift/server/nonblocking_server.rb
|
196
198
|
- lib/thrift/server/simple_server.rb
|
199
|
+
- lib/thrift/server/thin_http_server.rb
|
197
200
|
- lib/thrift/server/thread_pool_server.rb
|
198
201
|
- lib/thrift/server/threaded_server.rb
|
199
|
-
- lib/thrift/
|
200
|
-
- lib/thrift/
|
201
|
-
- lib/thrift/
|
202
|
-
- lib/thrift/transport/
|
203
|
-
- lib/thrift/transport/
|
202
|
+
- lib/thrift/struct.rb
|
203
|
+
- lib/thrift/struct_union.rb
|
204
|
+
- lib/thrift/thrift_native.rb
|
205
|
+
- lib/thrift/transport/base_server_transport.rb
|
206
|
+
- lib/thrift/transport/base_transport.rb
|
204
207
|
- lib/thrift/transport/buffered_transport.rb
|
205
|
-
- lib/thrift/transport/socket.rb
|
206
208
|
- lib/thrift/transport/framed_transport.rb
|
207
209
|
- lib/thrift/transport/http_client_transport.rb
|
208
|
-
- lib/thrift/transport/base_server_transport.rb
|
209
|
-
- lib/thrift/transport/ssl_server_socket.rb
|
210
|
-
- lib/thrift/transport/unix_server_socket.rb
|
211
|
-
- lib/thrift/transport/base_transport.rb
|
212
210
|
- lib/thrift/transport/io_stream_transport.rb
|
211
|
+
- lib/thrift/transport/memory_buffer_transport.rb
|
213
212
|
- lib/thrift/transport/server_socket.rb
|
213
|
+
- lib/thrift/transport/socket.rb
|
214
|
+
- lib/thrift/transport/ssl_server_socket.rb
|
215
|
+
- lib/thrift/transport/ssl_socket.rb
|
216
|
+
- lib/thrift/transport/unix_server_socket.rb
|
214
217
|
- lib/thrift/transport/unix_socket.rb
|
215
|
-
- lib/thrift/
|
216
|
-
- lib/thrift/
|
217
|
-
- lib/thrift/core_ext/fixnum.rb
|
218
|
-
- lib/thrift/serializer/deserializer.rb
|
219
|
-
- lib/thrift/serializer/serializer.rb
|
218
|
+
- lib/thrift/types.rb
|
219
|
+
- lib/thrift/union.rb
|
220
220
|
- lib/thrift.rb
|
221
221
|
files:
|
222
222
|
- README.md
|
@@ -345,48 +345,47 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
345
345
|
- !ruby/object:Gem::Version
|
346
346
|
version: '0'
|
347
347
|
requirements: []
|
348
|
-
|
349
|
-
rubygems_version: 2.7.6.2
|
348
|
+
rubygems_version: 3.3.15
|
350
349
|
signing_key:
|
351
350
|
specification_version: 4
|
352
351
|
summary: Ruby bindings for Apache Thrift
|
353
352
|
test_files:
|
354
|
-
- spec/
|
355
|
-
- spec/
|
353
|
+
- spec/BaseService.thrift
|
354
|
+
- spec/ExtendedService.thrift
|
355
|
+
- spec/Referenced.thrift
|
356
|
+
- spec/ThriftNamespacedSpec.thrift
|
356
357
|
- spec/ThriftSpec.thrift
|
357
|
-
- spec/
|
358
|
+
- spec/base_protocol_spec.rb
|
359
|
+
- spec/base_transport_spec.rb
|
358
360
|
- spec/binary_protocol_accelerated_spec.rb
|
359
|
-
- spec/ssl_socket_spec.rb
|
360
|
-
- spec/http_client_spec.rb
|
361
|
-
- spec/flat_spec.rb
|
362
|
-
- spec/server_socket_spec.rb
|
363
|
-
- spec/bytes_spec.rb
|
364
361
|
- spec/binary_protocol_spec.rb
|
365
|
-
- spec/
|
366
|
-
- spec/
|
367
|
-
- spec/
|
368
|
-
- spec/thin_http_server_spec.rb
|
369
|
-
- spec/BaseService.thrift
|
362
|
+
- spec/binary_protocol_spec_shared.rb
|
363
|
+
- spec/bytes_spec.rb
|
364
|
+
- spec/client_spec.rb
|
370
365
|
- spec/compact_protocol_spec.rb
|
366
|
+
- spec/exception_spec.rb
|
367
|
+
- spec/flat_spec.rb
|
368
|
+
- spec/http_client_spec.rb
|
369
|
+
- spec/json_protocol_spec.rb
|
371
370
|
- spec/namespaced_spec.rb
|
371
|
+
- spec/nonblocking_server_spec.rb
|
372
372
|
- spec/processor_spec.rb
|
373
|
+
- spec/serializer_spec.rb
|
374
|
+
- spec/server_socket_spec.rb
|
375
|
+
- spec/server_spec.rb
|
376
|
+
- spec/socket_spec.rb
|
377
|
+
- spec/socket_spec_shared.rb
|
378
|
+
- spec/spec_helper.rb
|
373
379
|
- spec/ssl_server_socket_spec.rb
|
374
|
-
- spec/
|
375
|
-
- spec/binary_protocol_spec_shared.rb
|
380
|
+
- spec/ssl_socket_spec.rb
|
376
381
|
- spec/struct_nested_containers_spec.rb
|
377
|
-
- spec/
|
378
|
-
- spec/
|
379
|
-
- spec/
|
380
|
-
- spec/
|
381
|
-
- spec/nonblocking_server_spec.rb
|
382
|
-
- spec/Referenced.thrift
|
382
|
+
- spec/struct_spec.rb
|
383
|
+
- spec/thin_http_server_spec.rb
|
384
|
+
- spec/types_spec.rb
|
385
|
+
- spec/union_spec.rb
|
383
386
|
- spec/unix_socket_spec.rb
|
384
|
-
-
|
385
|
-
- spec/ThriftNamespacedSpec.thrift
|
386
|
-
- spec/server_spec.rb
|
387
|
-
- spec/client_spec.rb
|
387
|
+
- benchmark/Benchmark.thrift
|
388
388
|
- benchmark/benchmark.rb
|
389
|
+
- benchmark/client.rb
|
389
390
|
- benchmark/server.rb
|
390
391
|
- benchmark/thin_server.rb
|
391
|
-
- benchmark/client.rb
|
392
|
-
- benchmark/Benchmark.thrift
|