thrift 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/ext/binary_protocol_accelerated.c +19 -3
- data/ext/compact_protocol.c +21 -7
- data/ext/constants.h +1 -5
- data/ext/extconf.rb +1 -1
- data/ext/protocol.c +0 -185
- data/ext/protocol.h +0 -20
- data/ext/struct.c +0 -3
- data/ext/thrift_native.c +1 -11
- data/lib/thrift.rb +1 -0
- data/lib/thrift/exceptions.rb +3 -0
- data/lib/thrift/protocol/base_protocol.rb +87 -10
- data/lib/thrift/protocol/binary_protocol.rb +13 -5
- data/lib/thrift/protocol/compact_protocol.rb +14 -7
- data/lib/thrift/protocol/json_protocol.rb +19 -15
- data/lib/thrift/server/mongrel_http_server.rb +2 -0
- data/lib/thrift/server/thin_http_server.rb +91 -0
- data/lib/thrift/struct.rb +1 -1
- data/lib/thrift/struct_union.rb +2 -2
- data/lib/thrift/transport/http_client_transport.rb +4 -1
- data/spec/base_protocol_spec.rb +65 -7
- data/spec/binary_protocol_spec_shared.rb +30 -0
- data/spec/compact_protocol_spec.rb +1 -3
- data/spec/http_client_spec.rb +49 -0
- data/spec/json_protocol_spec.rb +2 -2
- data/spec/thin_http_server_spec.rb +140 -0
- data/spec/union_spec.rb +13 -1
- metadata +113 -93
- data/benchmark/gen-rb/benchmark_constants.rb +0 -11
- data/benchmark/gen-rb/benchmark_service.rb +0 -80
- data/benchmark/gen-rb/benchmark_types.rb +0 -10
- data/spec/gen-rb/nonblocking_service.rb +0 -272
- data/spec/gen-rb/thrift_spec_constants.rb +0 -11
- data/spec/gen-rb/thrift_spec_types.rb +0 -538
- data/spec/mongrel_http_server_spec.rb +0 -114
- data/test/debug_proto/gen-rb/debug_proto_test_constants.rb +0 -274
- data/test/debug_proto/gen-rb/debug_proto_test_types.rb +0 -761
- data/test/debug_proto/gen-rb/empty_service.rb +0 -24
- data/test/debug_proto/gen-rb/inherited.rb +0 -79
- data/test/debug_proto/gen-rb/reverse_order_service.rb +0 -82
- data/test/debug_proto/gen-rb/service_for_exception_with_a_map.rb +0 -81
- data/test/debug_proto/gen-rb/srv.rb +0 -330
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MzRjZDcyMTAwY2Y3MTJkYTU2Mzk1MzdmYWYyOWFiMzAwOWU3NzYwZA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
N2Y2MDQ4ZjBhYWM1N2IyOGI2ODE5NDYzNzBjZmRmYTI0NDIxODc1MQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NWE1NzdmMDg3NjdiZGQzNjdkNzhhYzE1NTVkOGMxN2NlMzRmMmUxZDQ1NWNj
|
10
|
+
ZTUyNGM1YWRjNjM0MDViMWUzMWVjMzY5YzhiNzBhYWJmODk5OGUwODk3NjRh
|
11
|
+
NTgwNzdhZjIyYWJiZTMxZmJlODdlYzlmYjQ2MWI5ZGU2NmVmZDE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YTE1ODAyOTM5M2E4OGFlMmYyNDFjYjVkMTcyMjA4MDEzM2I1MmE3ZDg2ZmIy
|
14
|
+
MGVjYjFhM2VlOGZlM2U2YjM0YzdkZTgxYmJjNmExMDIyNTIyNDc4MGY5ZjUx
|
15
|
+
MjhiY2Y3NzM5NGIwZGE5MWMyOTY2ZmU0YWI3YzI4MTYwMzg1Nzc=
|
@@ -79,7 +79,7 @@ static void write_i64_direct(VALUE trans, int64_t value) {
|
|
79
79
|
|
80
80
|
static void write_string_direct(VALUE trans, VALUE str) {
|
81
81
|
if (TYPE(str) != T_STRING) {
|
82
|
-
rb_raise(rb_eStandardError, "Value should be a string");
|
82
|
+
rb_raise(rb_eStandardError, "Value should be a string");
|
83
83
|
}
|
84
84
|
str = convert_to_utf8_byte_buffer(str);
|
85
85
|
write_i32_direct(trans, RSTRING_LEN(str));
|
@@ -219,11 +219,21 @@ VALUE rb_thrift_binary_proto_write_string(VALUE self, VALUE str) {
|
|
219
219
|
return Qnil;
|
220
220
|
}
|
221
221
|
|
222
|
+
VALUE rb_thrift_binary_proto_write_binary(VALUE self, VALUE buf) {
|
223
|
+
CHECK_NIL(buf);
|
224
|
+
VALUE trans = GET_TRANSPORT(self);
|
225
|
+
buf = force_binary_encoding(buf);
|
226
|
+
write_i32_direct(trans, RSTRING_LEN(buf));
|
227
|
+
rb_funcall(trans, write_method_id, 1, buf);
|
228
|
+
return Qnil;
|
229
|
+
}
|
230
|
+
|
222
231
|
//---------------------------------------
|
223
232
|
// interface reading methods
|
224
233
|
//---------------------------------------
|
225
234
|
|
226
235
|
VALUE rb_thrift_binary_proto_read_string(VALUE self);
|
236
|
+
VALUE rb_thrift_binary_proto_read_binary(VALUE self);
|
227
237
|
VALUE rb_thrift_binary_proto_read_byte(VALUE self);
|
228
238
|
VALUE rb_thrift_binary_proto_read_i32(VALUE self);
|
229
239
|
VALUE rb_thrift_binary_proto_read_i16(VALUE self);
|
@@ -381,11 +391,15 @@ VALUE rb_thrift_binary_proto_read_double(VALUE self) {
|
|
381
391
|
}
|
382
392
|
|
383
393
|
VALUE rb_thrift_binary_proto_read_string(VALUE self) {
|
384
|
-
|
385
|
-
VALUE buffer = READ(self, size);
|
394
|
+
VALUE buffer = rb_thrift_binary_proto_read_binary(self);
|
386
395
|
return convert_to_string(buffer);
|
387
396
|
}
|
388
397
|
|
398
|
+
VALUE rb_thrift_binary_proto_read_binary(VALUE self) {
|
399
|
+
int size = read_i32_direct(self);
|
400
|
+
return READ(self, size);
|
401
|
+
}
|
402
|
+
|
389
403
|
void Init_binary_protocol_accelerated() {
|
390
404
|
VALUE thrift_binary_protocol_class = rb_const_get(thrift_module, rb_intern("BinaryProtocol"));
|
391
405
|
|
@@ -410,6 +424,7 @@ void Init_binary_protocol_accelerated() {
|
|
410
424
|
rb_define_method(bpa_class, "write_i64", rb_thrift_binary_proto_write_i64, 1);
|
411
425
|
rb_define_method(bpa_class, "write_double", rb_thrift_binary_proto_write_double, 1);
|
412
426
|
rb_define_method(bpa_class, "write_string", rb_thrift_binary_proto_write_string, 1);
|
427
|
+
rb_define_method(bpa_class, "write_binary", rb_thrift_binary_proto_write_binary, 1);
|
413
428
|
// unused methods
|
414
429
|
rb_define_method(bpa_class, "write_message_end", rb_thrift_binary_proto_write_message_end, 0);
|
415
430
|
rb_define_method(bpa_class, "write_struct_begin", rb_thrift_binary_proto_write_struct_begin, 1);
|
@@ -431,6 +446,7 @@ void Init_binary_protocol_accelerated() {
|
|
431
446
|
rb_define_method(bpa_class, "read_i64", rb_thrift_binary_proto_read_i64, 0);
|
432
447
|
rb_define_method(bpa_class, "read_double", rb_thrift_binary_proto_read_double, 0);
|
433
448
|
rb_define_method(bpa_class, "read_string", rb_thrift_binary_proto_read_string, 0);
|
449
|
+
rb_define_method(bpa_class, "read_binary", rb_thrift_binary_proto_read_binary, 0);
|
434
450
|
// unused methods
|
435
451
|
rb_define_method(bpa_class, "read_message_end", rb_thrift_binary_proto_read_message_end, 0);
|
436
452
|
rb_define_method(bpa_class, "read_struct_begin", rb_thift_binary_proto_read_struct_begin, 0);
|
data/ext/compact_protocol.c
CHANGED
@@ -167,6 +167,7 @@ static void write_collection_begin(VALUE transport, VALUE elem_type, VALUE size_
|
|
167
167
|
|
168
168
|
VALUE rb_thrift_compact_proto_write_i32(VALUE self, VALUE i32);
|
169
169
|
VALUE rb_thrift_compact_proto_write_string(VALUE self, VALUE str);
|
170
|
+
VALUE rb_thrift_compact_proto_write_binary(VALUE self, VALUE buf);
|
170
171
|
|
171
172
|
VALUE rb_thrift_compact_proto_write_message_end(VALUE self) {
|
172
173
|
return Qnil;
|
@@ -305,10 +306,16 @@ VALUE rb_thrift_compact_proto_write_double(VALUE self, VALUE dub) {
|
|
305
306
|
}
|
306
307
|
|
307
308
|
VALUE rb_thrift_compact_proto_write_string(VALUE self, VALUE str) {
|
308
|
-
VALUE transport = GET_TRANSPORT(self);
|
309
309
|
str = convert_to_utf8_byte_buffer(str);
|
310
|
-
|
311
|
-
|
310
|
+
rb_thrift_compact_proto_write_binary(self, str);
|
311
|
+
return Qnil;
|
312
|
+
}
|
313
|
+
|
314
|
+
VALUE rb_thrift_compact_proto_write_binary(VALUE self, VALUE buf) {
|
315
|
+
buf = force_binary_encoding(buf);
|
316
|
+
VALUE transport = GET_TRANSPORT(self);
|
317
|
+
write_varint32(transport, RSTRING_LEN(buf));
|
318
|
+
WRITE(transport, RSTRING_PTR(buf), RSTRING_LEN(buf));
|
312
319
|
return Qnil;
|
313
320
|
}
|
314
321
|
|
@@ -319,6 +326,7 @@ VALUE rb_thrift_compact_proto_write_string(VALUE self, VALUE str) {
|
|
319
326
|
#define is_bool_type(ctype) (((ctype) & 0x0F) == CTYPE_BOOLEAN_TRUE || ((ctype) & 0x0F) == CTYPE_BOOLEAN_FALSE)
|
320
327
|
|
321
328
|
VALUE rb_thrift_compact_proto_read_string(VALUE self);
|
329
|
+
VALUE rb_thrift_compact_proto_read_binary(VALUE self);
|
322
330
|
VALUE rb_thrift_compact_proto_read_byte(VALUE self);
|
323
331
|
VALUE rb_thrift_compact_proto_read_i32(VALUE self);
|
324
332
|
VALUE rb_thrift_compact_proto_read_i16(VALUE self);
|
@@ -547,20 +555,24 @@ VALUE rb_thrift_compact_proto_read_double(VALUE self) {
|
|
547
555
|
}
|
548
556
|
|
549
557
|
VALUE rb_thrift_compact_proto_read_string(VALUE self) {
|
550
|
-
|
551
|
-
VALUE buffer = READ(self, size);
|
558
|
+
VALUE buffer = rb_thrift_compact_proto_read_binary(self);
|
552
559
|
return convert_to_string(buffer);
|
553
560
|
}
|
554
561
|
|
562
|
+
VALUE rb_thrift_compact_proto_read_binary(VALUE self) {
|
563
|
+
int64_t size = read_varint64(self);
|
564
|
+
return READ(self, size);
|
565
|
+
}
|
566
|
+
|
555
567
|
static void Init_constants() {
|
556
568
|
thrift_compact_protocol_class = rb_const_get(thrift_module, rb_intern("CompactProtocol"));
|
557
|
-
|
569
|
+
|
558
570
|
VERSION = rb_num2ll(rb_const_get(thrift_compact_protocol_class, rb_intern("VERSION")));
|
559
571
|
VERSION_MASK = rb_num2ll(rb_const_get(thrift_compact_protocol_class, rb_intern("VERSION_MASK")));
|
560
572
|
TYPE_MASK = rb_num2ll(rb_const_get(thrift_compact_protocol_class, rb_intern("TYPE_MASK")));
|
561
573
|
TYPE_SHIFT_AMOUNT = FIX2INT(rb_const_get(thrift_compact_protocol_class, rb_intern("TYPE_SHIFT_AMOUNT")));
|
562
574
|
PROTOCOL_ID = FIX2INT(rb_const_get(thrift_compact_protocol_class, rb_intern("PROTOCOL_ID")));
|
563
|
-
|
575
|
+
|
564
576
|
last_field_id = rb_intern("@last_field");
|
565
577
|
boolean_field_id = rb_intern("@boolean_field");
|
566
578
|
bool_value_id = rb_intern("@bool_value");
|
@@ -583,6 +595,7 @@ static void Init_rb_methods() {
|
|
583
595
|
rb_define_method(thrift_compact_protocol_class, "write_i64", rb_thrift_compact_proto_write_i64, 1);
|
584
596
|
rb_define_method(thrift_compact_protocol_class, "write_double", rb_thrift_compact_proto_write_double, 1);
|
585
597
|
rb_define_method(thrift_compact_protocol_class, "write_string", rb_thrift_compact_proto_write_string, 1);
|
598
|
+
rb_define_method(thrift_compact_protocol_class, "write_binary", rb_thrift_compact_proto_write_binary, 1);
|
586
599
|
|
587
600
|
rb_define_method(thrift_compact_protocol_class, "write_message_end", rb_thrift_compact_proto_write_message_end, 0);
|
588
601
|
rb_define_method(thrift_compact_protocol_class, "write_struct_begin", rb_thrift_compact_proto_write_struct_begin, 1);
|
@@ -605,6 +618,7 @@ static void Init_rb_methods() {
|
|
605
618
|
rb_define_method(thrift_compact_protocol_class, "read_i64", rb_thrift_compact_proto_read_i64, 0);
|
606
619
|
rb_define_method(thrift_compact_protocol_class, "read_double", rb_thrift_compact_proto_read_double, 0);
|
607
620
|
rb_define_method(thrift_compact_protocol_class, "read_string", rb_thrift_compact_proto_read_string, 0);
|
621
|
+
rb_define_method(thrift_compact_protocol_class, "read_binary", rb_thrift_compact_proto_read_binary, 0);
|
608
622
|
|
609
623
|
rb_define_method(thrift_compact_protocol_class, "read_message_end", rb_thrift_compact_proto_read_message_end, 0);
|
610
624
|
rb_define_method(thrift_compact_protocol_class, "read_struct_begin", rb_thrift_compact_proto_read_struct_begin, 0);
|
data/ext/constants.h
CHANGED
@@ -48,7 +48,6 @@ extern ID write_list_begin_method_id;
|
|
48
48
|
extern ID write_list_end_method_id;
|
49
49
|
extern ID write_set_begin_method_id;
|
50
50
|
extern ID write_set_end_method_id;
|
51
|
-
extern ID size_method_id;
|
52
51
|
extern ID read_bool_method_id;
|
53
52
|
extern ID read_byte_method_id;
|
54
53
|
extern ID read_i16_method_id;
|
@@ -67,15 +66,12 @@ extern ID read_struct_end_method_id;
|
|
67
66
|
extern ID read_field_begin_method_id;
|
68
67
|
extern ID read_field_end_method_id;
|
69
68
|
extern ID keys_method_id;
|
70
|
-
extern ID entries_method_id;
|
71
|
-
extern ID name_method_id;
|
72
|
-
extern ID sort_method_id;
|
69
|
+
extern ID entries_method_id;
|
73
70
|
extern ID write_field_stop_method_id;
|
74
71
|
extern ID skip_method_id;
|
75
72
|
extern ID write_method_id;
|
76
73
|
extern ID read_all_method_id;
|
77
74
|
extern ID read_into_buffer_method_id;
|
78
|
-
extern ID native_qmark_method_id;
|
79
75
|
extern ID force_binary_encoding_id;
|
80
76
|
extern ID convert_to_utf8_byte_buffer_id;
|
81
77
|
extern ID convert_to_string_id;
|
data/ext/extconf.rb
CHANGED
@@ -24,7 +24,7 @@ else
|
|
24
24
|
|
25
25
|
$ARCH_FLAGS = Config::CONFIG['CFLAGS'].scan( /(-arch )(\S+)/ ).map{|x,y| x + y + ' ' }.join('')
|
26
26
|
|
27
|
-
$CFLAGS = "-g -O2 -Wall -Werror " + $ARCH_FLAGS
|
27
|
+
$CFLAGS = "-fsigned-char -g -O2 -Wall -Werror " + $ARCH_FLAGS
|
28
28
|
|
29
29
|
have_func("strlcpy", "string.h")
|
30
30
|
|
data/ext/protocol.c
CHANGED
@@ -1,185 +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
|
-
#include <ruby.h>
|
21
|
-
#include <protocol.h>
|
22
|
-
#include <stdbool.h>
|
23
|
-
#include <constants.h>
|
24
|
-
#include <struct.h>
|
25
|
-
|
26
|
-
static VALUE skip(VALUE self, int ttype) {
|
27
|
-
if (ttype == TTYPE_STOP) {
|
28
|
-
return Qnil;
|
29
|
-
} else if (ttype == TTYPE_BOOL) {
|
30
|
-
rb_funcall(self, read_bool_method_id, 0);
|
31
|
-
} else if (ttype == TTYPE_BYTE) {
|
32
|
-
rb_funcall(self, read_byte_method_id, 0);
|
33
|
-
} else if (ttype == TTYPE_I16) {
|
34
|
-
rb_funcall(self, read_i16_method_id, 0);
|
35
|
-
} else if (ttype == TTYPE_I32) {
|
36
|
-
rb_funcall(self, read_i32_method_id, 0);
|
37
|
-
} else if (ttype == TTYPE_I64) {
|
38
|
-
rb_funcall(self, read_i64_method_id, 0);
|
39
|
-
} else if (ttype == TTYPE_DOUBLE) {
|
40
|
-
rb_funcall(self, read_double_method_id, 0);
|
41
|
-
} else if (ttype == TTYPE_STRING) {
|
42
|
-
rb_funcall(self, read_string_method_id, 0);
|
43
|
-
} else if (ttype == TTYPE_STRUCT) {
|
44
|
-
rb_funcall(self, read_struct_begin_method_id, 0);
|
45
|
-
while (true) {
|
46
|
-
VALUE field_header = rb_funcall(self, read_field_begin_method_id, 0);
|
47
|
-
if (NIL_P(field_header) || FIX2INT(rb_ary_entry(field_header, 1)) == TTYPE_STOP ) {
|
48
|
-
break;
|
49
|
-
}
|
50
|
-
skip(self, FIX2INT(rb_ary_entry(field_header, 1)));
|
51
|
-
rb_funcall(self, read_field_end_method_id, 0);
|
52
|
-
}
|
53
|
-
rb_funcall(self, read_struct_end_method_id, 0);
|
54
|
-
} else if (ttype == TTYPE_MAP) {
|
55
|
-
int i;
|
56
|
-
VALUE map_header = rb_funcall(self, read_map_begin_method_id, 0);
|
57
|
-
int ktype = FIX2INT(rb_ary_entry(map_header, 0));
|
58
|
-
int vtype = FIX2INT(rb_ary_entry(map_header, 1));
|
59
|
-
int size = FIX2INT(rb_ary_entry(map_header, 2));
|
60
|
-
|
61
|
-
for (i = 0; i < size; i++) {
|
62
|
-
skip(self, ktype);
|
63
|
-
skip(self, vtype);
|
64
|
-
}
|
65
|
-
rb_funcall(self, read_map_end_method_id, 0);
|
66
|
-
} else if (ttype == TTYPE_LIST || ttype == TTYPE_SET) {
|
67
|
-
int i;
|
68
|
-
VALUE collection_header = rb_funcall(self, ttype == TTYPE_LIST ? read_list_begin_method_id : read_set_begin_method_id, 0);
|
69
|
-
int etype = FIX2INT(rb_ary_entry(collection_header, 0));
|
70
|
-
int size = FIX2INT(rb_ary_entry(collection_header, 1));
|
71
|
-
for (i = 0; i < size; i++) {
|
72
|
-
skip(self, etype);
|
73
|
-
}
|
74
|
-
rb_funcall(self, ttype == TTYPE_LIST ? read_list_end_method_id : read_set_end_method_id, 0);
|
75
|
-
} else {
|
76
|
-
rb_raise(rb_eNotImpError, "don't know how to skip type %d", ttype);
|
77
|
-
}
|
78
|
-
|
79
|
-
return Qnil;
|
80
|
-
}
|
81
|
-
|
82
|
-
VALUE rb_thrift_protocol_native_qmark(VALUE self) {
|
83
|
-
return Qfalse;
|
84
|
-
}
|
85
|
-
|
86
|
-
VALUE rb_thrift_protocol_skip(VALUE protocol, VALUE ttype) {
|
87
|
-
return skip(protocol, FIX2INT(ttype));
|
88
|
-
}
|
89
|
-
|
90
|
-
VALUE rb_thrift_write_message_end(VALUE self) {
|
91
|
-
return Qnil;
|
92
|
-
}
|
93
|
-
|
94
|
-
VALUE rb_thrift_write_struct_begin(VALUE self, VALUE name) {
|
95
|
-
return Qnil;
|
96
|
-
}
|
97
|
-
|
98
|
-
VALUE rb_thrift_write_struct_end(VALUE self) {
|
99
|
-
return Qnil;
|
100
|
-
}
|
101
|
-
|
102
|
-
VALUE rb_thrift_write_field_end(VALUE self) {
|
103
|
-
return Qnil;
|
104
|
-
}
|
105
|
-
|
106
|
-
VALUE rb_thrift_write_map_end(VALUE self) {
|
107
|
-
return Qnil;
|
108
|
-
}
|
109
|
-
|
110
|
-
VALUE rb_thrift_write_list_end(VALUE self) {
|
111
|
-
return Qnil;
|
112
|
-
}
|
113
|
-
|
114
|
-
VALUE rb_thrift_write_set_end(VALUE self) {
|
115
|
-
return Qnil;
|
116
|
-
}
|
117
|
-
|
118
|
-
VALUE rb_thrift_read_message_end(VALUE self) {
|
119
|
-
return Qnil;
|
120
|
-
}
|
121
|
-
|
122
|
-
VALUE rb_thift_read_struct_begin(VALUE self) {
|
123
|
-
return Qnil;
|
124
|
-
}
|
125
|
-
|
126
|
-
VALUE rb_thift_read_struct_end(VALUE self) {
|
127
|
-
return Qnil;
|
128
|
-
}
|
129
|
-
|
130
|
-
VALUE rb_thift_read_field_end(VALUE self) {
|
131
|
-
return Qnil;
|
132
|
-
}
|
133
|
-
|
134
|
-
VALUE rb_thift_read_map_end(VALUE self) {
|
135
|
-
return Qnil;
|
136
|
-
}
|
137
|
-
|
138
|
-
VALUE rb_thift_read_list_end(VALUE self) {
|
139
|
-
return Qnil;
|
140
|
-
}
|
141
|
-
|
142
|
-
VALUE rb_thift_read_set_end(VALUE self) {
|
143
|
-
return Qnil;
|
144
|
-
}
|
145
|
-
|
146
|
-
void Init_protocol() {
|
147
|
-
VALUE c_protocol = rb_const_get(thrift_module, rb_intern("BaseProtocol"));
|
148
|
-
|
149
|
-
rb_define_method(c_protocol, "skip", rb_thrift_protocol_skip, 1);
|
150
|
-
rb_define_method(c_protocol, "write_message_end", rb_thrift_write_message_end, 0);
|
151
|
-
rb_define_method(c_protocol, "write_struct_begin", rb_thrift_write_struct_begin, 1);
|
152
|
-
rb_define_method(c_protocol, "write_struct_end", rb_thrift_write_struct_end, 0);
|
153
|
-
rb_define_method(c_protocol, "write_field_end", rb_thrift_write_field_end, 0);
|
154
|
-
rb_define_method(c_protocol, "write_map_end", rb_thrift_write_map_end, 0);
|
155
|
-
rb_define_method(c_protocol, "write_list_end", rb_thrift_write_list_end, 0);
|
156
|
-
rb_define_method(c_protocol, "write_set_end", rb_thrift_write_set_end, 0);
|
157
|
-
rb_define_method(c_protocol, "read_message_end", rb_thrift_read_message_end, 0);
|
158
|
-
rb_define_method(c_protocol, "read_struct_begin", rb_thift_read_struct_begin, 0);
|
159
|
-
rb_define_method(c_protocol, "read_struct_end", rb_thift_read_struct_end, 0);
|
160
|
-
rb_define_method(c_protocol, "read_field_end", rb_thift_read_field_end, 0);
|
161
|
-
rb_define_method(c_protocol, "read_map_end", rb_thift_read_map_end, 0);
|
162
|
-
rb_define_method(c_protocol, "read_list_end", rb_thift_read_list_end, 0);
|
163
|
-
rb_define_method(c_protocol, "read_set_end", rb_thift_read_set_end, 0);
|
164
|
-
rb_define_method(c_protocol, "native?", rb_thrift_protocol_native_qmark, 0);
|
165
|
-
|
166
|
-
// native_proto_method_table *npmt;
|
167
|
-
// npmt = ALLOC(native_proto_method_table);
|
168
|
-
// npmt->write_message_end = rb_thrift_write_message_end;
|
169
|
-
// npmt->write_struct_begin = rb_thrift_write_struct_begin;
|
170
|
-
// npmt->write_struct_end = rb_thrift_write_struct_end;
|
171
|
-
// npmt->write_field_end = rb_thrift_write_field_end;
|
172
|
-
// npmt->write_map_end = rb_thrift_write_map_end;
|
173
|
-
// npmt->write_list_end = rb_thrift_write_list_end;
|
174
|
-
// npmt->write_set_end = rb_thrift_write_set_end;
|
175
|
-
// npmt->read_message_end = rb_thrift_read_message_end;
|
176
|
-
// npmt->read_struct_begin = rb_thift_read_struct_begin;
|
177
|
-
// npmt->read_struct_end = rb_thift_read_struct_end;
|
178
|
-
// npmt->read_field_end = rb_thift_read_field_end;
|
179
|
-
// npmt->read_map_end = rb_thift_read_map_end;
|
180
|
-
// npmt->read_list_end = rb_thift_read_list_end;
|
181
|
-
// npmt->read_set_end = rb_thift_read_set_end;
|
182
|
-
//
|
183
|
-
// VALUE method_table_object = Data_Wrap_Struct(rb_cObject, 0, free, npmt);
|
184
|
-
// rb_const_set(c_protocol, rb_intern("@native_method_table"), method_table_object);
|
185
|
-
}
|
data/ext/protocol.h
CHANGED
@@ -1,20 +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
|
-
void Init_protocol();
|
data/ext/struct.c
CHANGED
@@ -627,9 +627,6 @@ static VALUE rb_thrift_union_read(VALUE self, VALUE protocol) {
|
|
627
627
|
rb_raise(rb_eRuntimeError, "too many fields in union!");
|
628
628
|
}
|
629
629
|
|
630
|
-
// read field end
|
631
|
-
default_read_field_end(protocol);
|
632
|
-
|
633
630
|
// read struct end
|
634
631
|
default_read_struct_end(protocol);
|
635
632
|
|
data/ext/thrift_native.c
CHANGED
@@ -22,7 +22,6 @@
|
|
22
22
|
#include <struct.h>
|
23
23
|
#include <binary_protocol_accelerated.h>
|
24
24
|
#include <compact_protocol.h>
|
25
|
-
#include <protocol.h>
|
26
25
|
#include <memory_buffer.h>
|
27
26
|
|
28
27
|
// cached classes/modules
|
@@ -64,7 +63,6 @@ ID write_list_begin_method_id;
|
|
64
63
|
ID write_list_end_method_id;
|
65
64
|
ID write_set_begin_method_id;
|
66
65
|
ID write_set_end_method_id;
|
67
|
-
ID size_method_id;
|
68
66
|
ID read_bool_method_id;
|
69
67
|
ID read_byte_method_id;
|
70
68
|
ID read_i16_method_id;
|
@@ -83,15 +81,12 @@ ID read_struct_end_method_id;
|
|
83
81
|
ID read_field_begin_method_id;
|
84
82
|
ID read_field_end_method_id;
|
85
83
|
ID keys_method_id;
|
86
|
-
ID entries_method_id;
|
87
|
-
ID name_method_id;
|
88
|
-
ID sort_method_id;
|
84
|
+
ID entries_method_id;
|
89
85
|
ID write_field_stop_method_id;
|
90
86
|
ID skip_method_id;
|
91
87
|
ID write_method_id;
|
92
88
|
ID read_all_method_id;
|
93
89
|
ID read_into_buffer_method_id;
|
94
|
-
ID native_qmark_method_id;
|
95
90
|
ID force_binary_encoding_id;
|
96
91
|
ID convert_to_utf8_byte_buffer_id;
|
97
92
|
ID convert_to_string_id;
|
@@ -151,7 +146,6 @@ void Init_thrift_native() {
|
|
151
146
|
write_list_end_method_id = rb_intern("write_list_end");
|
152
147
|
write_set_begin_method_id = rb_intern("write_set_begin");
|
153
148
|
write_set_end_method_id = rb_intern("write_set_end");
|
154
|
-
size_method_id = rb_intern("size");
|
155
149
|
read_bool_method_id = rb_intern("read_bool");
|
156
150
|
read_byte_method_id = rb_intern("read_byte");
|
157
151
|
read_i16_method_id = rb_intern("read_i16");
|
@@ -171,14 +165,11 @@ void Init_thrift_native() {
|
|
171
165
|
read_field_end_method_id = rb_intern("read_field_end");
|
172
166
|
keys_method_id = rb_intern("keys");
|
173
167
|
entries_method_id = rb_intern("entries");
|
174
|
-
name_method_id = rb_intern("name");
|
175
|
-
sort_method_id = rb_intern("sort");
|
176
168
|
write_field_stop_method_id = rb_intern("write_field_stop");
|
177
169
|
skip_method_id = rb_intern("skip");
|
178
170
|
write_method_id = rb_intern("write");
|
179
171
|
read_all_method_id = rb_intern("read_all");
|
180
172
|
read_into_buffer_method_id = rb_intern("read_into_buffer");
|
181
|
-
native_qmark_method_id = rb_intern("native?");
|
182
173
|
force_binary_encoding_id = rb_intern("force_binary_encoding");
|
183
174
|
convert_to_utf8_byte_buffer_id = rb_intern("convert_to_utf8_byte_buffer");
|
184
175
|
convert_to_string_id = rb_intern("convert_to_string");
|
@@ -197,7 +188,6 @@ void Init_thrift_native() {
|
|
197
188
|
element_sym = ID2SYM(rb_intern("element"));
|
198
189
|
class_sym = ID2SYM(rb_intern("class"));
|
199
190
|
|
200
|
-
Init_protocol();
|
201
191
|
Init_struct();
|
202
192
|
Init_binary_protocol_accelerated();
|
203
193
|
Init_compact_protocol();
|