grpc 1.0.1-x64-mingw32 → 1.1.2-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/etc/roots.pem +39 -111
- data/grpc_c.32.ruby +0 -0
- data/grpc_c.64.ruby +0 -0
- data/src/ruby/ext/grpc/extconf.rb +0 -1
- data/src/ruby/ext/grpc/rb_byte_buffer.c +8 -7
- data/src/ruby/ext/grpc/rb_call.c +15 -5
- data/src/ruby/ext/grpc/rb_channel.c +1 -1
- data/src/ruby/ext/grpc/rb_compression_options.c +466 -0
- data/src/ruby/ext/grpc/rb_compression_options.h +44 -0
- data/src/ruby/ext/grpc/rb_grpc.c +3 -1
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +198 -190
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +306 -294
- data/src/ruby/ext/grpc/rb_server.c +18 -12
- data/src/ruby/lib/grpc/2.0/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.1/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.2/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.3/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.4/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/errors.rb +154 -2
- data/src/ruby/lib/grpc/generic/active_call.rb +144 -63
- data/src/ruby/lib/grpc/generic/bidi_call.rb +18 -2
- data/src/ruby/lib/grpc/generic/client_stub.rb +7 -5
- data/src/ruby/lib/grpc/generic/rpc_desc.rb +39 -13
- data/src/ruby/lib/grpc/generic/rpc_server.rb +51 -24
- data/src/ruby/lib/grpc/generic/service.rb +3 -2
- data/src/ruby/lib/grpc/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/health/checker.rb +3 -1
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +7 -0
- data/src/ruby/pb/test/client.rb +307 -7
- data/src/ruby/pb/test/server.rb +26 -1
- data/src/ruby/spec/compression_options_spec.rb +164 -0
- data/src/ruby/spec/error_sanity_spec.rb +64 -0
- data/src/ruby/spec/generic/active_call_spec.rb +290 -12
- data/src/ruby/spec/generic/client_stub_spec.rb +91 -41
- data/src/ruby/spec/generic/rpc_desc_spec.rb +36 -16
- data/src/ruby/spec/generic/rpc_server_pool_spec.rb +22 -28
- data/src/ruby/spec/generic/rpc_server_spec.rb +6 -6
- data/src/ruby/spec/pb/health/checker_spec.rb +27 -19
- data/src/ruby/spec/spec_helper.rb +2 -0
- metadata +18 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e760276f56f9f4bde72e8a8ead99d62b22434ab
|
4
|
+
data.tar.gz: '082e83c336706a927de94bd35c7eb570aab059d5'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8780ee56a4f1954139267b4a0d140cdb3994afa9d61001d2a3434e11064aafb48a61a8193c39ff8dfa0d1992716ae3ee86ecbd8317010b4ce3dfbb712cd7ac2e
|
7
|
+
data.tar.gz: c87e6794edbb6f75169ce1bc561034eeacd767e50af6f0a12f17b1c382eb91c5b02a345fabb45c0639a6b6939069b4df45931cd7e1b9b42f854a21aa51696c1c
|
data/etc/roots.pem
CHANGED
@@ -1706,38 +1706,6 @@ fQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdv
|
|
1706
1706
|
GDeAU/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
|
1707
1707
|
-----END CERTIFICATE-----
|
1708
1708
|
|
1709
|
-
# Issuer: CN=IGC/A O=PM/SGDN OU=DCSSI
|
1710
|
-
# Subject: CN=IGC/A O=PM/SGDN OU=DCSSI
|
1711
|
-
# Label: "IGC/A"
|
1712
|
-
# Serial: 245102874772
|
1713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fRNWk68gq5rv9GQkaiv6GFGvm/5P9JhfejcIYyHF2fYPepraX/z9E0+X1b
|
1728
|
-
F8bc1g4oa8Ld8fUzaJ1O/Id8NhLWo4DoQw1VYZTqZDdH6nfK0LJYBcNdfrGoRpAx
|
1729
|
-
Vs5wKpayMLh35nnAvSk7/ZR3TL0gzUEl4C7HG7vupARB0l2tEmqKm0f7yd1GQOGd
|
1730
|
-
PDPQtQIDAQABo3cwdTAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBRjAVBgNV
|
1731
|
-
HSAEDjAMMAoGCCqBegF5AQEBMB0GA1UdDgQWBBSjBS8YYFDCiQrdKyFP/45OqDAx
|
1732
|
-
NjAfBgNVHSMEGDAWgBSjBS8YYFDCiQrdKyFP/45OqDAxNjANBgkqhkiG9w0BAQUF
|
1733
|
-
AAOCAQEABdwm2Pp3FURo/C9mOnTgXeQp/wYHE4RKq89toB9RlPhJy3Q2FLwV3duJ
|
1734
|
-
L92PoF189RLrn544pEfMs5bZvpwlqwN+Mw+VgQ39FuCIvjfwbF3QMZsyK10XZZOY
|
1735
|
-
YLxuj7GoPB7ZHPOpJkL5ZB3C55L29B5aqhlSXa/oovdgoPaN8In1buAKBQGVyYsg
|
1736
|
-
Crpa/JosPL3Dt8ldeCUFP1YUmwza+zpI/pdpXsoQhvdOlgQITeywvl3cO45Pwf2a
|
1737
|
-
NjSaTFR+FwNIlQgRHAdvhQh+XU3Endv7rs6y0bO4g2wdsrN58dhwmX7wEwLOXt1R
|
1738
|
-
0982gaEbeC9xs/FZTEYYKKuF0mBWWg==
|
1739
|
-
-----END CERTIFICATE-----
|
1740
|
-
|
1741
1709
|
# Issuer: O=SECOM Trust Systems CO.,LTD. OU=Security Communication EV RootCA1
|
1742
1710
|
# Subject: O=SECOM Trust Systems CO.,LTD. OU=Security Communication EV RootCA1
|
1743
1711
|
# Label: "Security Communication EV RootCA1"
|
@@ -2047,48 +2015,6 @@ h7U/2k3ZIQAw3pDaDtMaSKk+hQsUi4y8QZ5q9w5wwDX3OaJdZtB7WZ+oRxKaJyOk
|
|
2047
2015
|
LY4ng5IgodcVf/EuGO70SH8vf/GhGLWhC5SgYiAynB321O+/TIho
|
2048
2016
|
-----END CERTIFICATE-----
|
2049
2017
|
|
2050
|
-
# Issuer: CN=EBG Elektronik Sertifika Hizmet Sağlayıcısı O=EBG Bilişim Teknolojileri ve Hizmetleri A.Ş.
|
2051
|
-
# Subject: CN=EBG Elektronik Sertifika Hizmet Sağlayıcısı O=EBG Bilişim Teknolojileri ve Hizmetleri A.Ş.
|
2052
|
-
# Label: "EBG Elektronik Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1"
|
2053
|
-
# Serial: 5525761995591021570
|
2054
|
-
# MD5 Fingerprint: 2c:20:26:9d:cb:1a:4a:00:85:b5:b7:5a:ae:c2:01:37
|
2055
|
-
# SHA1 Fingerprint: 8c:96:ba:eb:dd:2b:07:07:48:ee:30:32:66:a0:f3:98:6e:7c:ae:58
|
2056
|
-
# SHA256 Fingerprint: 35:ae:5b:dd:d8:f7:ae:63:5c:ff:ba:56:82:a8:f0:0b:95:f4:84:62:c7:10:8e:e9:a0:e5:29:2b:07:4a:af:b2
|
2057
|
-
-----BEGIN CERTIFICATE-----
|
2058
|
-
MIIF5zCCA8+gAwIBAgIITK9zQhyOdAIwDQYJKoZIhvcNAQEFBQAwgYAxODA2BgNV
|
2059
|
-
BAMML0VCRyBFbGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sx
|
2060
|
-
c8SxMTcwNQYDVQQKDC5FQkcgQmlsacWfaW0gVGVrbm9sb2ppbGVyaSB2ZSBIaXpt
|
2061
|
-
ZXRsZXJpIEEuxZ4uMQswCQYDVQQGEwJUUjAeFw0wNjA4MTcwMDIxMDlaFw0xNjA4
|
2062
|
-
MTQwMDMxMDlaMIGAMTgwNgYDVQQDDC9FQkcgRWxla3Ryb25payBTZXJ0aWZpa2E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4EFgQU587GT/wWZ5b6SqMHwQSny2re2kcwHwYDVR0jBBgw
|
2078
|
-
FoAU587GT/wWZ5b6SqMHwQSny2re2kcwDQYJKoZIhvcNAQEFBQADggIBAJuYml2+
|
2079
|
-
8ygjdsZs93/mQJ7ANtyVDR2tFcU22NU57/IeIl6zgrRdu0waypIN30ckHrMk2pGI
|
2080
|
-
6YNw3ZPX6bqz3xZaPt7gyPvT/Wwp+BVGoGgmzJNSroIBk5DKd8pNSe/iWtkqvTDO
|
2081
|
-
TLKBtjDOWU/aWR1qeqRFsIImgYZ29fUQALjuswnoT4cCB64kXPBfrAowzIpAoHME
|
2082
|
-
wfuJJPaaHFy3PApnNgUIMbOv2AFoKuB4j3TeuFGkjGwgPaL7s9QJ/XvCgKqTbCmY
|
2083
|
-
Iai7FvOpEl90tYeY8pUm3zTvilORiF0alKM/fCL414i6poyWqD1SNGKfAB5UVUJn
|
2084
|
-
xk1Gj7sURT0KlhaOEKGXmdXTMIXM3rRyt7yKPBgpaP3ccQfuJDlq+u2lrDgv+R4Q
|
2085
|
-
DgZxGhBM/nV+/x5XOULK1+EVoVZVWRvRo68R2E7DpSvvkL/A7IITW43WciyTTo9q
|
2086
|
-
Kd+FPNMN4KIYEsxVL0e3p5sC/kH2iExt2qkBR4NkJ2IQgtYSe14DHzSpyZH+r11t
|
2087
|
-
hie3I6p1GMog57AP14kOpmciY/SDQSsGS7tY1dHXt7kQY9iJSrSq3RZj9W6+YKH4
|
2088
|
-
7ejWkE8axsWgKdOnIaj1Wjz3x0miIZpKlVIglnKaZsv30oZDfCK+lvm9AahH3eU7
|
2089
|
-
QPl1K5srRmSGjR70j/sHd9DqSaIcjVIUpgqT
|
2090
|
-
-----END CERTIFICATE-----
|
2091
|
-
|
2092
2018
|
# Issuer: O=certSIGN OU=certSIGN ROOT CA
|
2093
2019
|
# Subject: O=certSIGN OU=certSIGN ROOT CA
|
2094
2020
|
# Label: "certSIGN ROOT CA"
|
@@ -2427,43 +2353,6 @@ Y7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoVIPVVYpbtbZNQvOSqeK3Z
|
|
2427
2353
|
ywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm66+KAQ==
|
2428
2354
|
-----END CERTIFICATE-----
|
2429
2355
|
|
2430
|
-
# Issuer: CN=Juur-SK O=AS Sertifitseerimiskeskus
|
2431
|
-
# Subject: CN=Juur-SK O=AS Sertifitseerimiskeskus
|
2432
|
-
# Label: "Juur-SK"
|
2433
|
-
# Serial: 999181308
|
2434
|
-
# MD5 Fingerprint: aa:8e:5d:d9:f8:db:0a:58:b7:8d:26:87:6c:82:35:55
|
2435
|
-
# SHA1 Fingerprint: 40:9d:4b:d9:17:b5:5c:27:b6:9b:64:cb:98:22:44:0d:cd:09:b8:89
|
2436
|
-
# SHA256 Fingerprint: ec:c3:e9:c3:40:75:03:be:e0:91:aa:95:2f:41:34:8f:f8:8b:aa:86:3b:22:64:be:fa:c8:07:90:15:74:e9:39
|
2437
|
-
-----BEGIN CERTIFICATE-----
|
2438
|
-
MIIE5jCCA86gAwIBAgIEO45L/DANBgkqhkiG9w0BAQUFADBdMRgwFgYJKoZIhvcN
|
2439
|
-
AQkBFglwa2lAc2suZWUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKExlBUyBTZXJ0aWZp
|
2440
|
-
dHNlZXJpbWlza2Vza3VzMRAwDgYDVQQDEwdKdXVyLVNLMB4XDTAxMDgzMDE0MjMw
|
2441
|
-
MVoXDTE2MDgyNjE0MjMwMVowXTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMQsw
|
2442
|
-
CQYDVQQGEwJFRTEiMCAGA1UEChMZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEQ
|
2443
|
-
MA4GA1UEAxMHSnV1ci1TSzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
|
2444
|
-
AIFxNj4zB9bjMI0TfncyRsvPGbJgM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Oi
|
2459
|
-
CfP+JmeaUOTDBS8rNXiRTHyoERF5TElZrMj3hWVcRrs7EKACr81Ptcw2Kuxd/u+g
|
2460
|
-
kcm2k298gFTsxwhwDY77guwqYHhpNjbRxZyLabVAyJRld/JXIWY7zoVAtjNjGr95
|
2461
|
-
HvxcHdMdkxuLDF2FvZkwMhgJkVLpfKG6/2SSmuz+Ne6ML678IIbsSt4beDI3poHS
|
2462
|
-
na9aEhbKmVv8b20OxaAehsmR0FyYgl9jDIpaq9iVpszLita/ZEuOyoqysOkhMp6q
|
2463
|
-
qIWYNIE5ITuoOlIyPfZrN4YGWhWY3PARZv40ILcD9EEQfTmEeZZyY7aWAuVrua0Z
|
2464
|
-
TbvGRNs2yyqcjg==
|
2465
|
-
-----END CERTIFICATE-----
|
2466
|
-
|
2467
2356
|
# Issuer: CN=Hongkong Post Root CA 1 O=Hongkong Post
|
2468
2357
|
# Subject: CN=Hongkong Post Root CA 1 O=Hongkong Post
|
2469
2358
|
# Label: "Hongkong Post Root CA 1"
|
@@ -5387,3 +5276,42 @@ BggqhkjOPQQDAwNpADBmAjEAj6jcnboMBBf6Fek9LykBl7+BFjNAk2z8+e2AcG+q
|
|
5387
5276
|
j9uEwov1NcoG3GRvaBbhj5G5AjEA2Euly8LQCGzpGPta3U1fJAuwACEl74+nBCZx
|
5388
5277
|
4nxp5V2a+EEfOzmTk51V6s2N8fvB
|
5389
5278
|
-----END CERTIFICATE-----
|
5279
|
+
|
5280
|
+
# Issuer: CN=ISRG Root X1 O=Internet Security Research Group
|
5281
|
+
# Subject: CN=ISRG Root X1 O=Internet Security Research Group
|
5282
|
+
# Label: "ISRG Root X1"
|
5283
|
+
# Serial: 172886928669790476064670243504169061120
|
5284
|
+
# MD5 Fingerprint: 0c:d2:f9:e0:da:17:73:e9:ed:86:4d:a5:e3:70:e7:4e
|
5285
|
+
# SHA1 Fingerprint: ca:bd:2a:79:a1:07:6a:31:f2:1d:25:36:35:cb:03:9d:43:29:a5:e8
|
5286
|
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2LN9d11TPA
|
5315
|
+
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
|
5316
|
+
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
|
5317
|
+
-----END CERTIFICATE-----
|
data/grpc_c.32.ruby
CHANGED
Binary file
|
data/grpc_c.64.ruby
CHANGED
Binary file
|
@@ -38,20 +38,20 @@
|
|
38
38
|
|
39
39
|
#include <grpc/grpc.h>
|
40
40
|
#include <grpc/byte_buffer_reader.h>
|
41
|
-
#include <grpc/
|
41
|
+
#include <grpc/slice.h>
|
42
42
|
#include "rb_grpc.h"
|
43
43
|
|
44
44
|
grpc_byte_buffer* grpc_rb_s_to_byte_buffer(char *string, size_t length) {
|
45
|
-
|
45
|
+
grpc_slice slice = grpc_slice_from_copied_buffer(string, length);
|
46
46
|
grpc_byte_buffer *buffer = grpc_raw_byte_buffer_create(&slice, 1);
|
47
|
-
|
47
|
+
grpc_slice_unref(slice);
|
48
48
|
return buffer;
|
49
49
|
}
|
50
50
|
|
51
51
|
VALUE grpc_rb_byte_buffer_to_s(grpc_byte_buffer *buffer) {
|
52
52
|
VALUE rb_string;
|
53
53
|
grpc_byte_buffer_reader reader;
|
54
|
-
|
54
|
+
grpc_slice next;
|
55
55
|
if (buffer == NULL) {
|
56
56
|
return Qnil;
|
57
57
|
}
|
@@ -61,9 +61,10 @@ VALUE grpc_rb_byte_buffer_to_s(grpc_byte_buffer *buffer) {
|
|
61
61
|
return Qnil;
|
62
62
|
}
|
63
63
|
while (grpc_byte_buffer_reader_next(&reader, &next) != 0) {
|
64
|
-
rb_str_cat(rb_string, (const char *)
|
65
|
-
|
66
|
-
|
64
|
+
rb_str_cat(rb_string, (const char *) GRPC_SLICE_START_PTR(next),
|
65
|
+
GRPC_SLICE_LENGTH(next));
|
66
|
+
grpc_slice_unref(next);
|
67
67
|
}
|
68
|
+
grpc_byte_buffer_reader_destroy(&reader);
|
68
69
|
return rb_string;
|
69
70
|
}
|
data/src/ruby/ext/grpc/rb_call.c
CHANGED
@@ -38,6 +38,7 @@
|
|
38
38
|
|
39
39
|
#include <grpc/grpc.h>
|
40
40
|
#include <grpc/support/alloc.h>
|
41
|
+
#include <grpc/impl/codegen/compression_types.h>
|
41
42
|
|
42
43
|
#include "rb_byte_buffer.h"
|
43
44
|
#include "rb_call_credentials.h"
|
@@ -640,7 +641,7 @@ static void grpc_run_batch_stack_cleanup(run_batch_stack *st) {
|
|
640
641
|
|
641
642
|
for (i = 0; i < st->op_num; i++) {
|
642
643
|
if (st->ops[i].op == GRPC_OP_SEND_MESSAGE) {
|
643
|
-
grpc_byte_buffer_destroy(st->ops[i].data.send_message);
|
644
|
+
grpc_byte_buffer_destroy(st->ops[i].data.send_message.send_message);
|
644
645
|
}
|
645
646
|
}
|
646
647
|
}
|
@@ -672,8 +673,9 @@ static void grpc_run_batch_stack_fill_ops(run_batch_stack *st, VALUE ops_hash) {
|
|
672
673
|
st->send_metadata.metadata;
|
673
674
|
break;
|
674
675
|
case GRPC_OP_SEND_MESSAGE:
|
675
|
-
st->ops[st->op_num].data.send_message =
|
676
|
-
RSTRING_PTR(this_value),
|
676
|
+
st->ops[st->op_num].data.send_message.send_message =
|
677
|
+
grpc_rb_s_to_byte_buffer(RSTRING_PTR(this_value),
|
678
|
+
RSTRING_LEN(this_value));
|
677
679
|
st->ops[st->op_num].flags = st->write_flag;
|
678
680
|
break;
|
679
681
|
case GRPC_OP_SEND_CLOSE_FROM_CLIENT:
|
@@ -685,10 +687,11 @@ static void grpc_run_batch_stack_fill_ops(run_batch_stack *st, VALUE ops_hash) {
|
|
685
687
|
&st->ops[st->op_num], &st->send_trailing_metadata, this_value);
|
686
688
|
break;
|
687
689
|
case GRPC_OP_RECV_INITIAL_METADATA:
|
688
|
-
st->ops[st->op_num].data.recv_initial_metadata =
|
690
|
+
st->ops[st->op_num].data.recv_initial_metadata.recv_initial_metadata =
|
691
|
+
&st->recv_metadata;
|
689
692
|
break;
|
690
693
|
case GRPC_OP_RECV_MESSAGE:
|
691
|
-
st->ops[st->op_num].data.recv_message = &st->recv_message;
|
694
|
+
st->ops[st->op_num].data.recv_message.recv_message = &st->recv_message;
|
692
695
|
break;
|
693
696
|
case GRPC_OP_RECV_STATUS_ON_CLIENT:
|
694
697
|
st->ops[st->op_num].data.recv_status_on_client.trailing_metadata =
|
@@ -910,6 +913,12 @@ static void Init_grpc_op_codes() {
|
|
910
913
|
UINT2NUM(GRPC_OP_RECV_CLOSE_ON_SERVER));
|
911
914
|
}
|
912
915
|
|
916
|
+
static void Init_grpc_metadata_keys() {
|
917
|
+
VALUE grpc_rb_mMetadataKeys = rb_define_module_under(grpc_rb_mGrpcCore, "MetadataKeys");
|
918
|
+
rb_define_const(grpc_rb_mMetadataKeys, "COMPRESSION_REQUEST_ALGORITHM",
|
919
|
+
rb_str_new2(GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY));
|
920
|
+
}
|
921
|
+
|
913
922
|
void Init_grpc_call() {
|
914
923
|
/* CallError inherits from Exception to signal that it is non-recoverable */
|
915
924
|
grpc_rb_eCallError =
|
@@ -972,6 +981,7 @@ void Init_grpc_call() {
|
|
972
981
|
Init_grpc_error_codes();
|
973
982
|
Init_grpc_op_codes();
|
974
983
|
Init_grpc_write_flags();
|
984
|
+
Init_grpc_metadata_keys();
|
975
985
|
}
|
976
986
|
|
977
987
|
/* Gets the call from the ruby object */
|
@@ -386,7 +386,7 @@ void Init_grpc_channel() {
|
|
386
386
|
rb_define_const(grpc_rb_cChannel, "MAX_CONCURRENT_STREAMS",
|
387
387
|
ID2SYM(rb_intern(GRPC_ARG_MAX_CONCURRENT_STREAMS)));
|
388
388
|
rb_define_const(grpc_rb_cChannel, "MAX_MESSAGE_LENGTH",
|
389
|
-
ID2SYM(rb_intern(
|
389
|
+
ID2SYM(rb_intern(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH)));
|
390
390
|
id_insecure_channel = rb_intern("this_channel_is_insecure");
|
391
391
|
Init_grpc_propagate_masks();
|
392
392
|
Init_grpc_connectivity_states();
|
@@ -0,0 +1,466 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright 2015, Google Inc.
|
4
|
+
* All rights reserved.
|
5
|
+
*
|
6
|
+
* Redistribution and use in source and binary forms, with or without
|
7
|
+
* modification, are permitted provided that the following conditions are
|
8
|
+
* met:
|
9
|
+
*
|
10
|
+
* * Redistributions of source code must retain the above copyright
|
11
|
+
* notice, this list of conditions and the following disclaimer.
|
12
|
+
* * Redistributions in binary form must reproduce the above
|
13
|
+
* copyright notice, this list of conditions and the following disclaimer
|
14
|
+
* in the documentation and/or other materials provided with the
|
15
|
+
* distribution.
|
16
|
+
* * Neither the name of Google Inc. nor the names of its
|
17
|
+
* contributors may be used to endorse or promote products derived from
|
18
|
+
* this software without specific prior written permission.
|
19
|
+
*
|
20
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
21
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
22
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
23
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
24
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
25
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
26
|
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
27
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
28
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
29
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
30
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
*
|
32
|
+
*/
|
33
|
+
|
34
|
+
#include <ruby/ruby.h>
|
35
|
+
|
36
|
+
#include "rb_compression_options.h"
|
37
|
+
#include "rb_grpc_imports.generated.h"
|
38
|
+
|
39
|
+
#include <grpc/compression.h>
|
40
|
+
#include <grpc/grpc.h>
|
41
|
+
#include <grpc/support/alloc.h>
|
42
|
+
#include <grpc/impl/codegen/compression_types.h>
|
43
|
+
#include <grpc/impl/codegen/grpc_types.h>
|
44
|
+
#include <string.h>
|
45
|
+
|
46
|
+
#include "rb_grpc.h"
|
47
|
+
|
48
|
+
static VALUE grpc_rb_cCompressionOptions = Qnil;
|
49
|
+
|
50
|
+
/* Ruby Ids for the names of valid compression levels. */
|
51
|
+
static VALUE id_compress_level_none = Qnil;
|
52
|
+
static VALUE id_compress_level_low = Qnil;
|
53
|
+
static VALUE id_compress_level_medium = Qnil;
|
54
|
+
static VALUE id_compress_level_high = Qnil;
|
55
|
+
|
56
|
+
/* grpc_rb_compression_options wraps a grpc_compression_options.
|
57
|
+
* It can be used to get the channel argument key-values for specific
|
58
|
+
* compression settings. */
|
59
|
+
|
60
|
+
/* Note that ruby objects of this type don't carry any state in other
|
61
|
+
* Ruby objects and don't have a mark for GC. */
|
62
|
+
typedef struct grpc_rb_compression_options {
|
63
|
+
/* The actual compression options that's being wrapped */
|
64
|
+
grpc_compression_options *wrapped;
|
65
|
+
} grpc_rb_compression_options;
|
66
|
+
|
67
|
+
/* Destroys the compression options instances and free the
|
68
|
+
* wrapped grpc compression options. */
|
69
|
+
static void grpc_rb_compression_options_free(void *p) {
|
70
|
+
grpc_rb_compression_options *wrapper = NULL;
|
71
|
+
if (p == NULL) {
|
72
|
+
return;
|
73
|
+
};
|
74
|
+
wrapper = (grpc_rb_compression_options *)p;
|
75
|
+
|
76
|
+
if (wrapper->wrapped != NULL) {
|
77
|
+
gpr_free(wrapper->wrapped);
|
78
|
+
wrapper->wrapped = NULL;
|
79
|
+
}
|
80
|
+
|
81
|
+
xfree(p);
|
82
|
+
}
|
83
|
+
|
84
|
+
/* Ruby recognized data type for the CompressionOptions class. */
|
85
|
+
static rb_data_type_t grpc_rb_compression_options_data_type = {
|
86
|
+
"grpc_compression_options",
|
87
|
+
{NULL,
|
88
|
+
grpc_rb_compression_options_free,
|
89
|
+
GRPC_RB_MEMSIZE_UNAVAILABLE,
|
90
|
+
{NULL, NULL}},
|
91
|
+
NULL,
|
92
|
+
NULL,
|
93
|
+
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
94
|
+
RUBY_TYPED_FREE_IMMEDIATELY
|
95
|
+
#endif
|
96
|
+
};
|
97
|
+
|
98
|
+
/* Allocates CompressionOptions instances.
|
99
|
+
Allocate the wrapped grpc compression options and
|
100
|
+
initialize it here too. */
|
101
|
+
static VALUE grpc_rb_compression_options_alloc(VALUE cls) {
|
102
|
+
grpc_rb_compression_options *wrapper =
|
103
|
+
gpr_malloc(sizeof(grpc_rb_compression_options));
|
104
|
+
wrapper->wrapped = NULL;
|
105
|
+
wrapper->wrapped = gpr_malloc(sizeof(grpc_compression_options));
|
106
|
+
grpc_compression_options_init(wrapper->wrapped);
|
107
|
+
|
108
|
+
return TypedData_Wrap_Struct(cls, &grpc_rb_compression_options_data_type,
|
109
|
+
wrapper);
|
110
|
+
}
|
111
|
+
|
112
|
+
/* Disables a compression algorithm, given the GRPC core internal number of a
|
113
|
+
* compression algorithm. */
|
114
|
+
VALUE grpc_rb_compression_options_disable_compression_algorithm_internal(
|
115
|
+
VALUE self, VALUE algorithm_to_disable) {
|
116
|
+
grpc_compression_algorithm compression_algorithm = 0;
|
117
|
+
grpc_rb_compression_options *wrapper = NULL;
|
118
|
+
|
119
|
+
TypedData_Get_Struct(self, grpc_rb_compression_options,
|
120
|
+
&grpc_rb_compression_options_data_type, wrapper);
|
121
|
+
compression_algorithm =
|
122
|
+
(grpc_compression_algorithm)NUM2INT(algorithm_to_disable);
|
123
|
+
|
124
|
+
grpc_compression_options_disable_algorithm(wrapper->wrapped,
|
125
|
+
compression_algorithm);
|
126
|
+
|
127
|
+
return Qnil;
|
128
|
+
}
|
129
|
+
|
130
|
+
/* Gets the compression internal enum value of a compression level given its
|
131
|
+
* name. */
|
132
|
+
grpc_compression_level grpc_rb_compression_options_level_name_to_value_internal(
|
133
|
+
VALUE level_name) {
|
134
|
+
Check_Type(level_name, T_SYMBOL);
|
135
|
+
|
136
|
+
/* Check the compression level of the name passed in, and see which macro
|
137
|
+
* from the GRPC core header files match. */
|
138
|
+
if (id_compress_level_none == SYM2ID(level_name)) {
|
139
|
+
return GRPC_COMPRESS_LEVEL_NONE;
|
140
|
+
} else if (id_compress_level_low == SYM2ID(level_name)) {
|
141
|
+
return GRPC_COMPRESS_LEVEL_LOW;
|
142
|
+
} else if (id_compress_level_medium == SYM2ID(level_name)) {
|
143
|
+
return GRPC_COMPRESS_LEVEL_MED;
|
144
|
+
} else if (id_compress_level_high == SYM2ID(level_name)) {
|
145
|
+
return GRPC_COMPRESS_LEVEL_HIGH;
|
146
|
+
}
|
147
|
+
|
148
|
+
rb_raise(rb_eArgError,
|
149
|
+
"Unrecognized compression level name."
|
150
|
+
"Valid compression level names are none, low, medium, and high.");
|
151
|
+
|
152
|
+
/* Dummy return statement. */
|
153
|
+
return GRPC_COMPRESS_LEVEL_NONE;
|
154
|
+
}
|
155
|
+
|
156
|
+
/* Sets the default compression level, given the name of a compression level.
|
157
|
+
* Throws an error if no algorithm matched. */
|
158
|
+
void grpc_rb_compression_options_set_default_level(
|
159
|
+
grpc_compression_options *options, VALUE new_level_name) {
|
160
|
+
options->default_level.level =
|
161
|
+
grpc_rb_compression_options_level_name_to_value_internal(new_level_name);
|
162
|
+
options->default_level.is_set = 1;
|
163
|
+
}
|
164
|
+
|
165
|
+
/* Gets the internal value of a compression algorithm suitable as the value
|
166
|
+
* in a GRPC core channel arguments hash.
|
167
|
+
* algorithm_value is an out parameter.
|
168
|
+
* Raises an error if the name of the algorithm passed in is invalid. */
|
169
|
+
void grpc_rb_compression_options_algorithm_name_to_value_internal(
|
170
|
+
grpc_compression_algorithm *algorithm_value, VALUE algorithm_name) {
|
171
|
+
char *name_str = NULL;
|
172
|
+
long name_len = 0;
|
173
|
+
VALUE algorithm_name_as_string = Qnil;
|
174
|
+
|
175
|
+
Check_Type(algorithm_name, T_SYMBOL);
|
176
|
+
|
177
|
+
/* Convert the algorithm symbol to a ruby string, so that we can get the
|
178
|
+
* correct C string out of it. */
|
179
|
+
algorithm_name_as_string = rb_funcall(algorithm_name, rb_intern("to_s"), 0);
|
180
|
+
|
181
|
+
name_str = RSTRING_PTR(algorithm_name_as_string);
|
182
|
+
name_len = RSTRING_LEN(algorithm_name_as_string);
|
183
|
+
|
184
|
+
/* Raise an error if the name isn't recognized as a compression algorithm by
|
185
|
+
* the algorithm parse function
|
186
|
+
* in GRPC core. */
|
187
|
+
if (!grpc_compression_algorithm_parse(name_str, name_len, algorithm_value)) {
|
188
|
+
rb_raise(rb_eNameError, "Invalid compression algorithm name: %s",
|
189
|
+
StringValueCStr(algorithm_name_as_string));
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
/* Indicates whether a given algorithm is enabled on this instance, given the
|
194
|
+
* readable algorithm name. */
|
195
|
+
VALUE grpc_rb_compression_options_is_algorithm_enabled(VALUE self,
|
196
|
+
VALUE algorithm_name) {
|
197
|
+
grpc_rb_compression_options *wrapper = NULL;
|
198
|
+
grpc_compression_algorithm internal_algorithm_value;
|
199
|
+
|
200
|
+
TypedData_Get_Struct(self, grpc_rb_compression_options,
|
201
|
+
&grpc_rb_compression_options_data_type, wrapper);
|
202
|
+
grpc_rb_compression_options_algorithm_name_to_value_internal(
|
203
|
+
&internal_algorithm_value, algorithm_name);
|
204
|
+
|
205
|
+
if (grpc_compression_options_is_algorithm_enabled(wrapper->wrapped,
|
206
|
+
internal_algorithm_value)) {
|
207
|
+
return Qtrue;
|
208
|
+
}
|
209
|
+
return Qfalse;
|
210
|
+
}
|
211
|
+
|
212
|
+
/* Sets the default algorithm to the name of the algorithm passed in.
|
213
|
+
* Raises an error if the name is not a valid compression algorithm name. */
|
214
|
+
void grpc_rb_compression_options_set_default_algorithm(
|
215
|
+
grpc_compression_options *options, VALUE algorithm_name) {
|
216
|
+
grpc_rb_compression_options_algorithm_name_to_value_internal(
|
217
|
+
&options->default_algorithm.algorithm, algorithm_name);
|
218
|
+
options->default_algorithm.is_set = 1;
|
219
|
+
}
|
220
|
+
|
221
|
+
/* Disables an algorithm on the current instance, given the name of an
|
222
|
+
* algorithm.
|
223
|
+
* Fails if the algorithm name is invalid. */
|
224
|
+
void grpc_rb_compression_options_disable_algorithm(
|
225
|
+
grpc_compression_options *compression_options, VALUE algorithm_name) {
|
226
|
+
grpc_compression_algorithm internal_algorithm_value;
|
227
|
+
|
228
|
+
grpc_rb_compression_options_algorithm_name_to_value_internal(
|
229
|
+
&internal_algorithm_value, algorithm_name);
|
230
|
+
grpc_compression_options_disable_algorithm(compression_options,
|
231
|
+
internal_algorithm_value);
|
232
|
+
}
|
233
|
+
|
234
|
+
/* Provides a ruby hash of GRPC core channel argument key-values that
|
235
|
+
* correspond to the compression settings on this instance. */
|
236
|
+
VALUE grpc_rb_compression_options_to_hash(VALUE self) {
|
237
|
+
grpc_rb_compression_options *wrapper = NULL;
|
238
|
+
grpc_compression_options *compression_options = NULL;
|
239
|
+
VALUE channel_arg_hash = rb_hash_new();
|
240
|
+
VALUE key = Qnil;
|
241
|
+
VALUE value = Qnil;
|
242
|
+
|
243
|
+
TypedData_Get_Struct(self, grpc_rb_compression_options,
|
244
|
+
&grpc_rb_compression_options_data_type, wrapper);
|
245
|
+
compression_options = wrapper->wrapped;
|
246
|
+
|
247
|
+
/* Add key-value pairs to the new Ruby hash. It can be used
|
248
|
+
* as GRPC core channel arguments. */
|
249
|
+
if (compression_options->default_level.is_set) {
|
250
|
+
key = rb_str_new2(GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL);
|
251
|
+
value = INT2NUM((int)compression_options->default_level.level);
|
252
|
+
rb_hash_aset(channel_arg_hash, key, value);
|
253
|
+
}
|
254
|
+
|
255
|
+
if (compression_options->default_algorithm.is_set) {
|
256
|
+
key = rb_str_new2(GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM);
|
257
|
+
value = INT2NUM((int)compression_options->default_algorithm.algorithm);
|
258
|
+
rb_hash_aset(channel_arg_hash, key, value);
|
259
|
+
}
|
260
|
+
|
261
|
+
key = rb_str_new2(GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET);
|
262
|
+
value = INT2NUM((int)compression_options->enabled_algorithms_bitset);
|
263
|
+
rb_hash_aset(channel_arg_hash, key, value);
|
264
|
+
|
265
|
+
return channel_arg_hash;
|
266
|
+
}
|
267
|
+
|
268
|
+
/* Converts an internal enum level value to a readable level name.
|
269
|
+
* Fails if the level value is invalid. */
|
270
|
+
VALUE grpc_rb_compression_options_level_value_to_name_internal(
|
271
|
+
grpc_compression_level compression_value) {
|
272
|
+
switch (compression_value) {
|
273
|
+
case GRPC_COMPRESS_LEVEL_NONE:
|
274
|
+
return ID2SYM(id_compress_level_none);
|
275
|
+
case GRPC_COMPRESS_LEVEL_LOW:
|
276
|
+
return ID2SYM(id_compress_level_low);
|
277
|
+
case GRPC_COMPRESS_LEVEL_MED:
|
278
|
+
return ID2SYM(id_compress_level_medium);
|
279
|
+
case GRPC_COMPRESS_LEVEL_HIGH:
|
280
|
+
return ID2SYM(id_compress_level_high);
|
281
|
+
default:
|
282
|
+
rb_raise(
|
283
|
+
rb_eArgError,
|
284
|
+
"Failed to convert compression level value to name for value: %d",
|
285
|
+
(int)compression_value);
|
286
|
+
/* return something to avoid compiler error about no return */
|
287
|
+
return Qnil;
|
288
|
+
}
|
289
|
+
}
|
290
|
+
|
291
|
+
/* Converts an algorithm internal enum value to a readable name.
|
292
|
+
* Fails if the enum value is invalid. */
|
293
|
+
VALUE grpc_rb_compression_options_algorithm_value_to_name_internal(
|
294
|
+
grpc_compression_algorithm internal_value) {
|
295
|
+
char *algorithm_name = NULL;
|
296
|
+
|
297
|
+
if (!grpc_compression_algorithm_name(internal_value, &algorithm_name)) {
|
298
|
+
rb_raise(rb_eArgError, "Failed to convert algorithm value to name");
|
299
|
+
}
|
300
|
+
|
301
|
+
return ID2SYM(rb_intern(algorithm_name));
|
302
|
+
}
|
303
|
+
|
304
|
+
/* Gets the readable name of the default algorithm if one has been set.
|
305
|
+
* Returns nil if no algorithm has been set. */
|
306
|
+
VALUE grpc_rb_compression_options_get_default_algorithm(VALUE self) {
|
307
|
+
grpc_compression_algorithm internal_value;
|
308
|
+
grpc_rb_compression_options *wrapper = NULL;
|
309
|
+
|
310
|
+
TypedData_Get_Struct(self, grpc_rb_compression_options,
|
311
|
+
&grpc_rb_compression_options_data_type, wrapper);
|
312
|
+
|
313
|
+
if (wrapper->wrapped->default_algorithm.is_set) {
|
314
|
+
internal_value = wrapper->wrapped->default_algorithm.algorithm;
|
315
|
+
return grpc_rb_compression_options_algorithm_value_to_name_internal(
|
316
|
+
internal_value);
|
317
|
+
}
|
318
|
+
|
319
|
+
return Qnil;
|
320
|
+
}
|
321
|
+
|
322
|
+
/* Gets the internal value of the default compression level that is to be passed
|
323
|
+
* to the GRPC core as a channel argument value.
|
324
|
+
* A nil return value means that it hasn't been set. */
|
325
|
+
VALUE grpc_rb_compression_options_get_default_level(VALUE self) {
|
326
|
+
grpc_compression_level internal_value;
|
327
|
+
grpc_rb_compression_options *wrapper = NULL;
|
328
|
+
|
329
|
+
TypedData_Get_Struct(self, grpc_rb_compression_options,
|
330
|
+
&grpc_rb_compression_options_data_type, wrapper);
|
331
|
+
|
332
|
+
if (wrapper->wrapped->default_level.is_set) {
|
333
|
+
internal_value = wrapper->wrapped->default_level.level;
|
334
|
+
return grpc_rb_compression_options_level_value_to_name_internal(
|
335
|
+
internal_value);
|
336
|
+
}
|
337
|
+
|
338
|
+
return Qnil;
|
339
|
+
}
|
340
|
+
|
341
|
+
/* Gets a list of the disabled algorithms as readable names.
|
342
|
+
* Returns an empty list if no algorithms have been disabled. */
|
343
|
+
VALUE grpc_rb_compression_options_get_disabled_algorithms(VALUE self) {
|
344
|
+
VALUE disabled_algorithms = rb_ary_new();
|
345
|
+
grpc_compression_algorithm internal_value;
|
346
|
+
grpc_rb_compression_options *wrapper = NULL;
|
347
|
+
|
348
|
+
TypedData_Get_Struct(self, grpc_rb_compression_options,
|
349
|
+
&grpc_rb_compression_options_data_type, wrapper);
|
350
|
+
|
351
|
+
for (internal_value = GRPC_COMPRESS_NONE;
|
352
|
+
internal_value < GRPC_COMPRESS_ALGORITHMS_COUNT; internal_value++) {
|
353
|
+
if (!grpc_compression_options_is_algorithm_enabled(wrapper->wrapped,
|
354
|
+
internal_value)) {
|
355
|
+
rb_ary_push(disabled_algorithms,
|
356
|
+
grpc_rb_compression_options_algorithm_value_to_name_internal(
|
357
|
+
internal_value));
|
358
|
+
}
|
359
|
+
}
|
360
|
+
return disabled_algorithms;
|
361
|
+
}
|
362
|
+
|
363
|
+
/* Initializes the compression options wrapper.
|
364
|
+
* Takes an optional hash parameter.
|
365
|
+
*
|
366
|
+
* Example call-seq:
|
367
|
+
* options = CompressionOptions.new(
|
368
|
+
* default_level: :none,
|
369
|
+
* disabled_algorithms: [:gzip]
|
370
|
+
* )
|
371
|
+
* channel_arg hash = Hash.new[...]
|
372
|
+
* channel_arg_hash_with_compression_options = channel_arg_hash.merge(options)
|
373
|
+
*/
|
374
|
+
VALUE grpc_rb_compression_options_init(int argc, VALUE *argv, VALUE self) {
|
375
|
+
grpc_rb_compression_options *wrapper = NULL;
|
376
|
+
VALUE default_algorithm = Qnil;
|
377
|
+
VALUE default_level = Qnil;
|
378
|
+
VALUE disabled_algorithms = Qnil;
|
379
|
+
VALUE algorithm_name = Qnil;
|
380
|
+
VALUE hash_arg = Qnil;
|
381
|
+
|
382
|
+
rb_scan_args(argc, argv, "01", &hash_arg);
|
383
|
+
|
384
|
+
/* Check if the hash parameter was passed, or if invalid arguments were
|
385
|
+
* passed. */
|
386
|
+
if (hash_arg == Qnil) {
|
387
|
+
return self;
|
388
|
+
} else if (TYPE(hash_arg) != T_HASH || argc > 1) {
|
389
|
+
rb_raise(rb_eArgError,
|
390
|
+
"Invalid arguments. Expecting optional hash parameter");
|
391
|
+
}
|
392
|
+
|
393
|
+
TypedData_Get_Struct(self, grpc_rb_compression_options,
|
394
|
+
&grpc_rb_compression_options_data_type, wrapper);
|
395
|
+
|
396
|
+
/* Set the default algorithm if one was chosen. */
|
397
|
+
default_algorithm =
|
398
|
+
rb_hash_aref(hash_arg, ID2SYM(rb_intern("default_algorithm")));
|
399
|
+
if (default_algorithm != Qnil) {
|
400
|
+
grpc_rb_compression_options_set_default_algorithm(wrapper->wrapped,
|
401
|
+
default_algorithm);
|
402
|
+
}
|
403
|
+
|
404
|
+
/* Set the default level if one was chosen. */
|
405
|
+
default_level = rb_hash_aref(hash_arg, ID2SYM(rb_intern("default_level")));
|
406
|
+
if (default_level != Qnil) {
|
407
|
+
grpc_rb_compression_options_set_default_level(wrapper->wrapped,
|
408
|
+
default_level);
|
409
|
+
}
|
410
|
+
|
411
|
+
/* Set the disabled algorithms if any were chosen. */
|
412
|
+
disabled_algorithms =
|
413
|
+
rb_hash_aref(hash_arg, ID2SYM(rb_intern("disabled_algorithms")));
|
414
|
+
if (disabled_algorithms != Qnil) {
|
415
|
+
Check_Type(disabled_algorithms, T_ARRAY);
|
416
|
+
|
417
|
+
for (int i = 0; i < RARRAY_LEN(disabled_algorithms); i++) {
|
418
|
+
algorithm_name = rb_ary_entry(disabled_algorithms, i);
|
419
|
+
grpc_rb_compression_options_disable_algorithm(wrapper->wrapped,
|
420
|
+
algorithm_name);
|
421
|
+
}
|
422
|
+
}
|
423
|
+
|
424
|
+
return self;
|
425
|
+
}
|
426
|
+
|
427
|
+
void Init_grpc_compression_options() {
|
428
|
+
grpc_rb_cCompressionOptions = rb_define_class_under(
|
429
|
+
grpc_rb_mGrpcCore, "CompressionOptions", rb_cObject);
|
430
|
+
|
431
|
+
/* Allocates an object managed by the ruby runtime. */
|
432
|
+
rb_define_alloc_func(grpc_rb_cCompressionOptions,
|
433
|
+
grpc_rb_compression_options_alloc);
|
434
|
+
|
435
|
+
/* Initializes the ruby wrapper. #new method takes an optional hash argument.
|
436
|
+
*/
|
437
|
+
rb_define_method(grpc_rb_cCompressionOptions, "initialize",
|
438
|
+
grpc_rb_compression_options_init, -1);
|
439
|
+
|
440
|
+
/* Methods for getting the default algorithm, default level, and disabled
|
441
|
+
* algorithms as readable names. */
|
442
|
+
rb_define_method(grpc_rb_cCompressionOptions, "default_algorithm",
|
443
|
+
grpc_rb_compression_options_get_default_algorithm, 0);
|
444
|
+
rb_define_method(grpc_rb_cCompressionOptions, "default_level",
|
445
|
+
grpc_rb_compression_options_get_default_level, 0);
|
446
|
+
rb_define_method(grpc_rb_cCompressionOptions, "disabled_algorithms",
|
447
|
+
grpc_rb_compression_options_get_disabled_algorithms, 0);
|
448
|
+
|
449
|
+
/* Determines whether or not an algorithm is enabled, given a readable
|
450
|
+
* algorithm name.*/
|
451
|
+
rb_define_method(grpc_rb_cCompressionOptions, "algorithm_enabled?",
|
452
|
+
grpc_rb_compression_options_is_algorithm_enabled, 1);
|
453
|
+
|
454
|
+
/* Provides a hash of the compression settings suitable
|
455
|
+
* for passing to server or channel args. */
|
456
|
+
rb_define_method(grpc_rb_cCompressionOptions, "to_hash",
|
457
|
+
grpc_rb_compression_options_to_hash, 0);
|
458
|
+
rb_define_alias(grpc_rb_cCompressionOptions, "to_channel_arg_hash",
|
459
|
+
"to_hash");
|
460
|
+
|
461
|
+
/* Ruby ids for the names of the different compression levels. */
|
462
|
+
id_compress_level_none = rb_intern("none");
|
463
|
+
id_compress_level_low = rb_intern("low");
|
464
|
+
id_compress_level_medium = rb_intern("medium");
|
465
|
+
id_compress_level_high = rb_intern("high");
|
466
|
+
}
|