grpc 1.30.2-x86-linux

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.

Files changed (121) hide show
  1. checksums.yaml +7 -0
  2. data/etc/roots.pem +4644 -0
  3. data/grpc_c.32.ruby +0 -0
  4. data/grpc_c.64.ruby +0 -0
  5. data/src/ruby/bin/math_client.rb +140 -0
  6. data/src/ruby/bin/math_pb.rb +34 -0
  7. data/src/ruby/bin/math_server.rb +191 -0
  8. data/src/ruby/bin/math_services_pb.rb +51 -0
  9. data/src/ruby/bin/noproto_client.rb +93 -0
  10. data/src/ruby/bin/noproto_server.rb +97 -0
  11. data/src/ruby/ext/grpc/ext-export.clang +1 -0
  12. data/src/ruby/ext/grpc/ext-export.gcc +6 -0
  13. data/src/ruby/ext/grpc/extconf.rb +107 -0
  14. data/src/ruby/ext/grpc/rb_byte_buffer.c +64 -0
  15. data/src/ruby/ext/grpc/rb_byte_buffer.h +35 -0
  16. data/src/ruby/ext/grpc/rb_call.c +1050 -0
  17. data/src/ruby/ext/grpc/rb_call.h +53 -0
  18. data/src/ruby/ext/grpc/rb_call_credentials.c +297 -0
  19. data/src/ruby/ext/grpc/rb_call_credentials.h +31 -0
  20. data/src/ruby/ext/grpc/rb_channel.c +835 -0
  21. data/src/ruby/ext/grpc/rb_channel.h +34 -0
  22. data/src/ruby/ext/grpc/rb_channel_args.c +155 -0
  23. data/src/ruby/ext/grpc/rb_channel_args.h +38 -0
  24. data/src/ruby/ext/grpc/rb_channel_credentials.c +267 -0
  25. data/src/ruby/ext/grpc/rb_channel_credentials.h +32 -0
  26. data/src/ruby/ext/grpc/rb_completion_queue.c +100 -0
  27. data/src/ruby/ext/grpc/rb_completion_queue.h +36 -0
  28. data/src/ruby/ext/grpc/rb_compression_options.c +470 -0
  29. data/src/ruby/ext/grpc/rb_compression_options.h +29 -0
  30. data/src/ruby/ext/grpc/rb_enable_cpp.cc +22 -0
  31. data/src/ruby/ext/grpc/rb_event_thread.c +143 -0
  32. data/src/ruby/ext/grpc/rb_event_thread.h +21 -0
  33. data/src/ruby/ext/grpc/rb_grpc.c +328 -0
  34. data/src/ruby/ext/grpc/rb_grpc.h +76 -0
  35. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +573 -0
  36. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +865 -0
  37. data/src/ruby/ext/grpc/rb_loader.c +57 -0
  38. data/src/ruby/ext/grpc/rb_loader.h +25 -0
  39. data/src/ruby/ext/grpc/rb_server.c +372 -0
  40. data/src/ruby/ext/grpc/rb_server.h +32 -0
  41. data/src/ruby/ext/grpc/rb_server_credentials.c +243 -0
  42. data/src/ruby/ext/grpc/rb_server_credentials.h +32 -0
  43. data/src/ruby/lib/grpc.rb +37 -0
  44. data/src/ruby/lib/grpc/2.3/grpc_c.so +0 -0
  45. data/src/ruby/lib/grpc/2.4/grpc_c.so +0 -0
  46. data/src/ruby/lib/grpc/2.5/grpc_c.so +0 -0
  47. data/src/ruby/lib/grpc/2.6/grpc_c.so +0 -0
  48. data/src/ruby/lib/grpc/2.7/grpc_c.so +0 -0
  49. data/src/ruby/lib/grpc/core/status_codes.rb +135 -0
  50. data/src/ruby/lib/grpc/core/time_consts.rb +56 -0
  51. data/src/ruby/lib/grpc/errors.rb +277 -0
  52. data/src/ruby/lib/grpc/generic/active_call.rb +669 -0
  53. data/src/ruby/lib/grpc/generic/bidi_call.rb +233 -0
  54. data/src/ruby/lib/grpc/generic/client_stub.rb +501 -0
  55. data/src/ruby/lib/grpc/generic/interceptor_registry.rb +53 -0
  56. data/src/ruby/lib/grpc/generic/interceptors.rb +186 -0
  57. data/src/ruby/lib/grpc/generic/rpc_desc.rb +204 -0
  58. data/src/ruby/lib/grpc/generic/rpc_server.rb +551 -0
  59. data/src/ruby/lib/grpc/generic/service.rb +211 -0
  60. data/src/ruby/lib/grpc/google_rpc_status_utils.rb +40 -0
  61. data/src/ruby/lib/grpc/grpc.rb +24 -0
  62. data/src/ruby/lib/grpc/logconfig.rb +44 -0
  63. data/src/ruby/lib/grpc/notifier.rb +45 -0
  64. data/src/ruby/lib/grpc/structs.rb +15 -0
  65. data/src/ruby/lib/grpc/version.rb +18 -0
  66. data/src/ruby/pb/README.md +42 -0
  67. data/src/ruby/pb/generate_proto_ruby.sh +51 -0
  68. data/src/ruby/pb/grpc/health/checker.rb +75 -0
  69. data/src/ruby/pb/grpc/health/v1/health_pb.rb +31 -0
  70. data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +62 -0
  71. data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb +44 -0
  72. data/src/ruby/pb/grpc/testing/metrics_pb.rb +28 -0
  73. data/src/ruby/pb/grpc/testing/metrics_services_pb.rb +49 -0
  74. data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +17 -0
  75. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +105 -0
  76. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +16 -0
  77. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +118 -0
  78. data/src/ruby/pb/test/client.rb +769 -0
  79. data/src/ruby/pb/test/server.rb +252 -0
  80. data/src/ruby/pb/test/xds_client.rb +213 -0
  81. data/src/ruby/spec/call_credentials_spec.rb +42 -0
  82. data/src/ruby/spec/call_spec.rb +180 -0
  83. data/src/ruby/spec/channel_connection_spec.rb +126 -0
  84. data/src/ruby/spec/channel_credentials_spec.rb +82 -0
  85. data/src/ruby/spec/channel_spec.rb +234 -0
  86. data/src/ruby/spec/client_auth_spec.rb +126 -0
  87. data/src/ruby/spec/client_server_spec.rb +664 -0
  88. data/src/ruby/spec/compression_options_spec.rb +149 -0
  89. data/src/ruby/spec/debug_message_spec.rb +134 -0
  90. data/src/ruby/spec/error_sanity_spec.rb +49 -0
  91. data/src/ruby/spec/errors_spec.rb +142 -0
  92. data/src/ruby/spec/generic/active_call_spec.rb +672 -0
  93. data/src/ruby/spec/generic/client_interceptors_spec.rb +153 -0
  94. data/src/ruby/spec/generic/client_stub_spec.rb +1083 -0
  95. data/src/ruby/spec/generic/interceptor_registry_spec.rb +65 -0
  96. data/src/ruby/spec/generic/rpc_desc_spec.rb +374 -0
  97. data/src/ruby/spec/generic/rpc_server_pool_spec.rb +127 -0
  98. data/src/ruby/spec/generic/rpc_server_spec.rb +748 -0
  99. data/src/ruby/spec/generic/server_interceptors_spec.rb +218 -0
  100. data/src/ruby/spec/generic/service_spec.rb +263 -0
  101. data/src/ruby/spec/google_rpc_status_utils_spec.rb +282 -0
  102. data/src/ruby/spec/pb/codegen/grpc/testing/package_options.proto +28 -0
  103. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto +22 -0
  104. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import2.proto +23 -0
  105. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +41 -0
  106. data/src/ruby/spec/pb/codegen/package_option_spec.rb +82 -0
  107. data/src/ruby/spec/pb/duplicate/codegen_spec.rb +57 -0
  108. data/src/ruby/spec/pb/health/checker_spec.rb +236 -0
  109. data/src/ruby/spec/server_credentials_spec.rb +79 -0
  110. data/src/ruby/spec/server_spec.rb +209 -0
  111. data/src/ruby/spec/spec_helper.rb +61 -0
  112. data/src/ruby/spec/support/helpers.rb +107 -0
  113. data/src/ruby/spec/support/services.rb +160 -0
  114. data/src/ruby/spec/testdata/README +1 -0
  115. data/src/ruby/spec/testdata/ca.pem +20 -0
  116. data/src/ruby/spec/testdata/client.key +28 -0
  117. data/src/ruby/spec/testdata/client.pem +20 -0
  118. data/src/ruby/spec/testdata/server1.key +28 -0
  119. data/src/ruby/spec/testdata/server1.pem +22 -0
  120. data/src/ruby/spec/time_consts_spec.rb +74 -0
  121. metadata +394 -0
@@ -0,0 +1,32 @@
1
+ /*
2
+ *
3
+ * Copyright 2015 gRPC authors.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ */
18
+
19
+ #ifndef GRPC_RB_SERVER_H_
20
+ #define GRPC_RB_SERVER_H_
21
+
22
+ #include <ruby/ruby.h>
23
+
24
+ #include <grpc/grpc.h>
25
+
26
+ /* Initializes the Server class. */
27
+ void Init_grpc_server();
28
+
29
+ /* Gets the wrapped server from the ruby wrapper */
30
+ grpc_server* grpc_rb_get_wrapped_server(VALUE v);
31
+
32
+ #endif /* GRPC_RB_SERVER_H_ */
@@ -0,0 +1,243 @@
1
+ /*
2
+ *
3
+ * Copyright 2015 gRPC authors.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ */
18
+
19
+ #include <ruby/ruby.h>
20
+
21
+ #include "rb_grpc_imports.generated.h"
22
+ #include "rb_server_credentials.h"
23
+
24
+ #include <grpc/grpc.h>
25
+ #include <grpc/grpc_security.h>
26
+ #include <grpc/support/log.h>
27
+
28
+ #include "rb_grpc.h"
29
+
30
+ /* grpc_rb_cServerCredentials is the ruby class that proxies
31
+ grpc_server_credentials. */
32
+ static VALUE grpc_rb_cServerCredentials = Qnil;
33
+
34
+ /* grpc_rb_server_credentials wraps a grpc_server_credentials. It provides a
35
+ peer ruby object, 'mark' to hold references to objects involved in
36
+ constructing the server credentials. */
37
+ typedef struct grpc_rb_server_credentials {
38
+ /* Holder of ruby objects involved in constructing the server credentials */
39
+ VALUE mark;
40
+ /* The actual server credentials */
41
+ grpc_server_credentials* wrapped;
42
+ } grpc_rb_server_credentials;
43
+
44
+ /* Destroys the server credentials instances. */
45
+ static void grpc_rb_server_credentials_free(void* p) {
46
+ grpc_rb_server_credentials* wrapper = NULL;
47
+ if (p == NULL) {
48
+ return;
49
+ };
50
+ wrapper = (grpc_rb_server_credentials*)p;
51
+
52
+ /* Delete the wrapped object if the mark object is Qnil, which indicates that
53
+ no other object is the actual owner. */
54
+ if (wrapper->wrapped != NULL && wrapper->mark == Qnil) {
55
+ grpc_server_credentials_release(wrapper->wrapped);
56
+ wrapper->wrapped = NULL;
57
+ }
58
+
59
+ xfree(p);
60
+ }
61
+
62
+ /* Protects the mark object from GC */
63
+ static void grpc_rb_server_credentials_mark(void* p) {
64
+ grpc_rb_server_credentials* wrapper = NULL;
65
+ if (p == NULL) {
66
+ return;
67
+ }
68
+ wrapper = (grpc_rb_server_credentials*)p;
69
+
70
+ /* If it's not already cleaned up, mark the mark object */
71
+ if (wrapper->mark != Qnil) {
72
+ rb_gc_mark(wrapper->mark);
73
+ }
74
+ }
75
+
76
+ static const rb_data_type_t grpc_rb_server_credentials_data_type = {
77
+ "grpc_server_credentials",
78
+ {grpc_rb_server_credentials_mark,
79
+ grpc_rb_server_credentials_free,
80
+ GRPC_RB_MEMSIZE_UNAVAILABLE,
81
+ {NULL, NULL}},
82
+ NULL,
83
+ NULL,
84
+ #ifdef RUBY_TYPED_FREE_IMMEDIATELY
85
+ RUBY_TYPED_FREE_IMMEDIATELY
86
+ #endif
87
+ };
88
+
89
+ /* Allocates ServerCredential instances.
90
+
91
+ Provides safe initial defaults for the instance fields. */
92
+ static VALUE grpc_rb_server_credentials_alloc(VALUE cls) {
93
+ grpc_rb_server_credentials* wrapper = ALLOC(grpc_rb_server_credentials);
94
+ wrapper->wrapped = NULL;
95
+ wrapper->mark = Qnil;
96
+ return TypedData_Wrap_Struct(cls, &grpc_rb_server_credentials_data_type,
97
+ wrapper);
98
+ }
99
+
100
+ /* The attribute used on the mark object to preserve the pem_root_certs. */
101
+ static ID id_pem_root_certs;
102
+
103
+ /* The attribute used on the mark object to preserve the pem_key_certs */
104
+ static ID id_pem_key_certs;
105
+
106
+ /* The key used to access the pem cert in a key_cert pair hash */
107
+ static VALUE sym_cert_chain;
108
+
109
+ /* The key used to access the pem private key in a key_cert pair hash */
110
+ static VALUE sym_private_key;
111
+
112
+ /*
113
+ call-seq:
114
+ creds = ServerCredentials.new(nil,
115
+ [{private_key: <pem_private_key1>,
116
+ {cert_chain: <pem_cert_chain1>}],
117
+ force_client_auth)
118
+ creds = ServerCredentials.new(pem_root_certs,
119
+ [{private_key: <pem_private_key1>,
120
+ {cert_chain: <pem_cert_chain1>}],
121
+ force_client_auth)
122
+
123
+ pem_root_certs: (optional) PEM encoding of the server root certificate
124
+ pem_private_key: (required) PEM encoding of the server's private keys
125
+ force_client_auth: indicatees
126
+
127
+ Initializes ServerCredential instances. */
128
+ static VALUE grpc_rb_server_credentials_init(VALUE self, VALUE pem_root_certs,
129
+ VALUE pem_key_certs,
130
+ VALUE force_client_auth) {
131
+ grpc_rb_server_credentials* wrapper = NULL;
132
+ grpc_server_credentials* creds = NULL;
133
+ grpc_ssl_pem_key_cert_pair* key_cert_pairs = NULL;
134
+ VALUE cert = Qnil;
135
+ VALUE key = Qnil;
136
+ VALUE key_cert = Qnil;
137
+ int auth_client = 0;
138
+ long num_key_certs = 0;
139
+ int i;
140
+
141
+ if (NIL_P(force_client_auth) ||
142
+ !(force_client_auth == Qfalse || force_client_auth == Qtrue)) {
143
+ rb_raise(rb_eTypeError,
144
+ "bad force_client_auth: got:<%s> want: <True|False|nil>",
145
+ rb_obj_classname(force_client_auth));
146
+ return Qnil;
147
+ }
148
+ if (NIL_P(pem_key_certs) || TYPE(pem_key_certs) != T_ARRAY) {
149
+ rb_raise(rb_eTypeError, "bad pem_key_certs: got:<%s> want: <Array>",
150
+ rb_obj_classname(pem_key_certs));
151
+ return Qnil;
152
+ }
153
+ num_key_certs = RARRAY_LEN(pem_key_certs);
154
+ if (num_key_certs == 0) {
155
+ rb_raise(rb_eTypeError, "bad pem_key_certs: it had no elements");
156
+ return Qnil;
157
+ }
158
+ for (i = 0; i < num_key_certs; i++) {
159
+ key_cert = rb_ary_entry(pem_key_certs, i);
160
+ if (key_cert == Qnil) {
161
+ rb_raise(rb_eTypeError,
162
+ "could not create a server credential: nil key_cert");
163
+ return Qnil;
164
+ } else if (TYPE(key_cert) != T_HASH) {
165
+ rb_raise(rb_eTypeError,
166
+ "could not create a server credential: want <Hash>, got <%s>",
167
+ rb_obj_classname(key_cert));
168
+ return Qnil;
169
+ } else if (rb_hash_aref(key_cert, sym_private_key) == Qnil) {
170
+ rb_raise(rb_eTypeError,
171
+ "could not create a server credential: want nil private key");
172
+ return Qnil;
173
+ } else if (rb_hash_aref(key_cert, sym_cert_chain) == Qnil) {
174
+ rb_raise(rb_eTypeError,
175
+ "could not create a server credential: want nil cert chain");
176
+ return Qnil;
177
+ }
178
+ }
179
+
180
+ auth_client = TYPE(force_client_auth) == T_TRUE
181
+ ? GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
182
+ : GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE;
183
+ key_cert_pairs = ALLOC_N(grpc_ssl_pem_key_cert_pair, num_key_certs);
184
+ for (i = 0; i < num_key_certs; i++) {
185
+ key_cert = rb_ary_entry(pem_key_certs, i);
186
+ key = rb_hash_aref(key_cert, sym_private_key);
187
+ cert = rb_hash_aref(key_cert, sym_cert_chain);
188
+ key_cert_pairs[i].private_key = RSTRING_PTR(key);
189
+ key_cert_pairs[i].cert_chain = RSTRING_PTR(cert);
190
+ }
191
+
192
+ TypedData_Get_Struct(self, grpc_rb_server_credentials,
193
+ &grpc_rb_server_credentials_data_type, wrapper);
194
+
195
+ if (pem_root_certs == Qnil) {
196
+ creds = grpc_ssl_server_credentials_create_ex(
197
+ NULL, key_cert_pairs, num_key_certs, auth_client, NULL);
198
+ } else {
199
+ creds = grpc_ssl_server_credentials_create_ex(RSTRING_PTR(pem_root_certs),
200
+ key_cert_pairs, num_key_certs,
201
+ auth_client, NULL);
202
+ }
203
+ xfree(key_cert_pairs);
204
+ if (creds == NULL) {
205
+ rb_raise(rb_eRuntimeError, "could not create a credentials, not sure why");
206
+ return Qnil;
207
+ }
208
+ wrapper->wrapped = creds;
209
+
210
+ /* Add the input objects as hidden fields to preserve them. */
211
+ rb_ivar_set(self, id_pem_key_certs, pem_key_certs);
212
+ rb_ivar_set(self, id_pem_root_certs, pem_root_certs);
213
+
214
+ return self;
215
+ }
216
+
217
+ void Init_grpc_server_credentials() {
218
+ grpc_rb_cServerCredentials =
219
+ rb_define_class_under(grpc_rb_mGrpcCore, "ServerCredentials", rb_cObject);
220
+
221
+ /* Allocates an object managed by the ruby runtime */
222
+ rb_define_alloc_func(grpc_rb_cServerCredentials,
223
+ grpc_rb_server_credentials_alloc);
224
+
225
+ /* Provides a ruby constructor and support for dup/clone. */
226
+ rb_define_method(grpc_rb_cServerCredentials, "initialize",
227
+ grpc_rb_server_credentials_init, 3);
228
+ rb_define_method(grpc_rb_cServerCredentials, "initialize_copy",
229
+ grpc_rb_cannot_init_copy, 1);
230
+
231
+ id_pem_key_certs = rb_intern("__pem_key_certs");
232
+ id_pem_root_certs = rb_intern("__pem_root_certs");
233
+ sym_private_key = ID2SYM(rb_intern("private_key"));
234
+ sym_cert_chain = ID2SYM(rb_intern("cert_chain"));
235
+ }
236
+
237
+ /* Gets the wrapped grpc_server_credentials from the ruby wrapper */
238
+ grpc_server_credentials* grpc_rb_get_wrapped_server_credentials(VALUE v) {
239
+ grpc_rb_server_credentials* wrapper = NULL;
240
+ TypedData_Get_Struct(v, grpc_rb_server_credentials,
241
+ &grpc_rb_server_credentials_data_type, wrapper);
242
+ return wrapper->wrapped;
243
+ }
@@ -0,0 +1,32 @@
1
+ /*
2
+ *
3
+ * Copyright 2015 gRPC authors.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ */
18
+
19
+ #ifndef GRPC_RB_SERVER_CREDENTIALS_H_
20
+ #define GRPC_RB_SERVER_CREDENTIALS_H_
21
+
22
+ #include <ruby/ruby.h>
23
+
24
+ #include <grpc/grpc_security.h>
25
+
26
+ /* Initializes the ruby ServerCredentials class. */
27
+ void Init_grpc_server_credentials();
28
+
29
+ /* Gets the wrapped server_credentials from the ruby wrapper */
30
+ grpc_server_credentials* grpc_rb_get_wrapped_server_credentials(VALUE v);
31
+
32
+ #endif /* GRPC_RB_SERVER_CREDENTIALS_H_ */
@@ -0,0 +1,37 @@
1
+ # Copyright 2015 gRPC authors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ ssl_roots_path = File.expand_path('../../../../etc/roots.pem', __FILE__)
16
+
17
+ require_relative 'grpc/errors'
18
+ require_relative 'grpc/structs'
19
+ require_relative 'grpc/grpc'
20
+ require_relative 'grpc/logconfig'
21
+ require_relative 'grpc/notifier'
22
+ require_relative 'grpc/version'
23
+ require_relative 'grpc/core/status_codes'
24
+ require_relative 'grpc/core/time_consts'
25
+ require_relative 'grpc/generic/active_call'
26
+ require_relative 'grpc/generic/client_stub'
27
+ require_relative 'grpc/generic/service'
28
+ require_relative 'grpc/generic/rpc_server'
29
+ require_relative 'grpc/generic/interceptors'
30
+
31
+ begin
32
+ file = File.open(ssl_roots_path)
33
+ roots = file.read
34
+ GRPC::Core::ChannelCredentials.set_default_roots_pem roots
35
+ ensure
36
+ file.close
37
+ end
@@ -0,0 +1,135 @@
1
+ # Copyright 2015 gRPC authors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # GRPC contains the General RPC module.
16
+ module GRPC
17
+ module Core
18
+ # StatusCodes defines the canonical error codes used by gRPC for the RPC
19
+ # API.
20
+ module StatusCodes
21
+ # OK is returned on success.
22
+ OK = 0
23
+
24
+ # Canceled indicates the operation was canceled (typically by the caller).
25
+ CANCELLED = 1
26
+
27
+ # Unknown error. An example of where this error may be returned is if a
28
+ # Status value received from another address space belongs to an
29
+ # error-space that is not known in this address space. Also errors raised
30
+ # by APIs that do not return enough error information may be converted to
31
+ # this error.
32
+ UNKNOWN = 2
33
+
34
+ # InvalidArgument indicates client specified an invalid argument. Note
35
+ # that this differs from FailedPrecondition. It indicates arguments that
36
+ # are problematic regardless of the state of the system (e.g., a malformed
37
+ # file name).
38
+ INVALID_ARGUMENT = 3
39
+
40
+ # DeadlineExceeded means operation expired before completion. For
41
+ # operations that change the state of the system, this error may be
42
+ # returned even if the operation has completed successfully. For example,
43
+ # a successful response from a server could have been delayed long enough
44
+ # for the deadline to expire.
45
+ DEADLINE_EXCEEDED = 4
46
+
47
+ # NotFound means some requested entity (e.g., file or directory) was not
48
+ # found.
49
+ NOT_FOUND = 5
50
+
51
+ # AlreadyExists means an attempt to create an entity failed because one
52
+ # already exists.
53
+ ALREADY_EXISTS = 6
54
+
55
+ # PermissionDenied indicates the caller does not have permission to
56
+ # execute the specified operation. It must not be used for rejections
57
+ # caused by exhausting some resource (use ResourceExhausted instead for
58
+ # those errors). It must not be used if the caller cannot be identified
59
+ # (use Unauthenticated instead for those errors).
60
+ PERMISSION_DENIED = 7
61
+
62
+ # ResourceExhausted indicates some resource has been exhausted, perhaps a
63
+ # per-user quota, or perhaps the entire file system is out of space.
64
+ RESOURCE_EXHAUSTED = 8
65
+
66
+ # FailedPrecondition indicates operation was rejected because the system
67
+ # is not in a state required for the operation's execution. For example,
68
+ # directory to be deleted may be non-empty, an rmdir operation is applied
69
+ # to a non-directory, etc.
70
+ #
71
+ # A litmus test that may help a service implementor in deciding between
72
+ # FailedPrecondition, Aborted, and Unavailable:
73
+ # (a) Use Unavailable if the client can retry just the failing call.
74
+ # (b) Use Aborted if the client should retry at a higher-level (e.g.,
75
+ # restarting a read-modify-write sequence).
76
+ # (c) Use FailedPrecondition if the client should not retry until the
77
+ # system state has been explicitly fixed. E.g., if an "rmdir" fails
78
+ # because the directory is non-empty, FailedPrecondition should be
79
+ # returned since the client should not retry unless they have first
80
+ # fixed up the directory by deleting files from it.
81
+ # (d) Use FailedPrecondition if the client performs conditional REST
82
+ # Get/Update/Delete on a resource and the resource on the server does
83
+ # not match the condition. E.g., conflicting read-modify-write on the
84
+ # same resource.
85
+ FAILED_PRECONDITION = 9
86
+
87
+ # Aborted indicates the operation was aborted, typically due to a
88
+ # concurrency issue like sequencer check failures, transaction aborts,
89
+ # etc.
90
+ #
91
+ # See litmus test above for deciding between FailedPrecondition, Aborted,
92
+ # and Unavailable.
93
+ ABORTED = 10
94
+
95
+ # OutOfRange means operation was attempted past the valid range. E.g.,
96
+ # seeking or reading past end of file.
97
+ #
98
+ # Unlike InvalidArgument, this error indicates a problem that may be fixed
99
+ # if the system state changes. For example, a 32-bit file system will
100
+ # generate InvalidArgument if asked to read at an offset that is not in
101
+ # the range [0,2^32-1], but it will generate OutOfRange if asked to read
102
+ # from an offset past the current file size.
103
+ #
104
+ # There is a fair bit of overlap between FailedPrecondition and
105
+ # OutOfRange. We recommend using OutOfRange (the more specific error) when
106
+ # it applies so that callers who are iterating through a space can easily
107
+ # look for an OutOfRange error to detect when they are done.
108
+ OUT_OF_RANGE = 11
109
+
110
+ # Unimplemented indicates operation is not implemented or not
111
+ # supported/enabled in this service.
112
+ UNIMPLEMENTED = 12
113
+
114
+ # Internal errors. Means some invariants expected by underlying system has
115
+ # been broken. If you see one of these errors, something is very broken.
116
+ INTERNAL = 13
117
+
118
+ # Unavailable indicates the service is currently unavailable. This is a
119
+ # most likely a transient condition and may be corrected by retrying with
120
+ # a backoff. Note that it is not always safe to retry non-idempotent
121
+ # operations.
122
+ #
123
+ # See litmus test above for deciding between FailedPrecondition, Aborted,
124
+ # and Unavailable.
125
+ UNAVAILABLE = 14
126
+
127
+ # DataLoss indicates unrecoverable data loss or corruption.
128
+ DATA_LOSS = 15
129
+
130
+ # Unauthenticated indicates the request does not have valid authentication
131
+ # credentials for the operation.
132
+ UNAUTHENTICATED = 16
133
+ end
134
+ end
135
+ end