grpc 1.27.0-x86-mingw32 → 1.30.0-x86-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/grpc_c.32.ruby +0 -0
- data/grpc_c.64.ruby +0 -0
- data/src/ruby/ext/grpc/rb_call.c +9 -1
- 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/2.5/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.6/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.7/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/errors.rb +103 -42
- data/src/ruby/lib/grpc/generic/active_call.rb +2 -3
- data/src/ruby/lib/grpc/generic/interceptors.rb +4 -4
- data/src/ruby/lib/grpc/generic/rpc_server.rb +9 -10
- data/src/ruby/lib/grpc/generic/service.rb +5 -4
- data/src/ruby/lib/grpc/structs.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/generate_proto_ruby.sh +5 -3
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +11 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +16 -0
- data/src/ruby/pb/test/xds_client.rb +213 -0
- data/src/ruby/spec/debug_message_spec.rb +134 -0
- data/src/ruby/spec/generic/service_spec.rb +2 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +5 -0
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +2 -0
- data/src/ruby/spec/testdata/ca.pem +18 -13
- data/src/ruby/spec/testdata/client.key +26 -14
- data/src/ruby/spec/testdata/client.pem +18 -12
- data/src/ruby/spec/testdata/server1.key +26 -14
- data/src/ruby/spec/testdata/server1.pem +20 -14
- metadata +41 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9742639810045456272933c2a0dc49aec0f687ad6d5dc0c2392877cf036dc0de
|
4
|
+
data.tar.gz: 6a96030a421957ac2c0bdfcae6b7057ce1d2717a86835842dd6951b1e2a49671
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69450d75600cd716e986d70229bd235bc06178f4d8319f17b152b7a725f2ba8ad4f79a743bd5b9bd2b06e290df5cb0cfc8412c910f1da453933c7926e97c3950
|
7
|
+
data.tar.gz: 20af71e55c1e8cf1c2822a70fa195b537c3ecafb0139d832c81827ff1cf4113ee21eb4ee952b36578f8f357e4403286418ca2918fd18aae3166d3b7624338ac0
|
data/grpc_c.32.ruby
CHANGED
Binary file
|
data/grpc_c.64.ruby
CHANGED
Binary file
|
data/src/ruby/ext/grpc/rb_call.c
CHANGED
@@ -620,6 +620,7 @@ typedef struct run_batch_stack {
|
|
620
620
|
int recv_cancelled;
|
621
621
|
grpc_status_code recv_status;
|
622
622
|
grpc_slice recv_status_details;
|
623
|
+
const char* recv_status_debug_error_string;
|
623
624
|
unsigned write_flag;
|
624
625
|
grpc_slice send_status_details;
|
625
626
|
} run_batch_stack;
|
@@ -729,6 +730,8 @@ static void grpc_run_batch_stack_fill_ops(run_batch_stack* st, VALUE ops_hash) {
|
|
729
730
|
&st->recv_status;
|
730
731
|
st->ops[st->op_num].data.recv_status_on_client.status_details =
|
731
732
|
&st->recv_status_details;
|
733
|
+
st->ops[st->op_num].data.recv_status_on_client.error_string =
|
734
|
+
&st->recv_status_debug_error_string;
|
732
735
|
break;
|
733
736
|
case GRPC_OP_RECV_CLOSE_ON_SERVER:
|
734
737
|
st->ops[st->op_num].data.recv_close_on_server.cancelled =
|
@@ -780,7 +783,12 @@ static VALUE grpc_run_batch_stack_build_result(run_batch_stack* st) {
|
|
780
783
|
(GRPC_SLICE_START_PTR(st->recv_status_details) == NULL
|
781
784
|
? Qnil
|
782
785
|
: grpc_rb_slice_to_ruby_string(st->recv_status_details)),
|
783
|
-
grpc_rb_md_ary_to_h(&st->recv_trailing_metadata),
|
786
|
+
grpc_rb_md_ary_to_h(&st->recv_trailing_metadata),
|
787
|
+
st->recv_status_debug_error_string == NULL
|
788
|
+
? Qnil
|
789
|
+
: rb_str_new_cstr(st->recv_status_debug_error_string),
|
790
|
+
NULL));
|
791
|
+
gpr_free((void*)st->recv_status_debug_error_string);
|
784
792
|
break;
|
785
793
|
case GRPC_OP_RECV_CLOSE_ON_SERVER:
|
786
794
|
rb_struct_aset(result, sym_send_close, Qtrue);
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/src/ruby/lib/grpc/errors.rb
CHANGED
@@ -30,18 +30,26 @@ module GRPC
|
|
30
30
|
# https://github.com/grpc/grpc/blob/master/include/grpc/impl/codegen/status.h
|
31
31
|
# for detailed descriptions of each status code.
|
32
32
|
class BadStatus < StandardError
|
33
|
-
attr_reader :code, :details, :metadata
|
33
|
+
attr_reader :code, :details, :metadata, :debug_error_string
|
34
34
|
|
35
35
|
include GRPC::Core::StatusCodes
|
36
36
|
|
37
37
|
# @param code [Numeric] the status code
|
38
38
|
# @param details [String] the details of the exception
|
39
39
|
# @param metadata [Hash] the error's metadata
|
40
|
-
def initialize(code,
|
41
|
-
|
40
|
+
def initialize(code,
|
41
|
+
details = 'unknown cause',
|
42
|
+
metadata = {},
|
43
|
+
debug_error_string = nil)
|
44
|
+
exception_message = "#{code}:#{details}"
|
45
|
+
if debug_error_string
|
46
|
+
exception_message += ". debug_error_string:#{debug_error_string}"
|
47
|
+
end
|
48
|
+
super(exception_message)
|
42
49
|
@code = code
|
43
50
|
@details = details
|
44
51
|
@metadata = metadata
|
52
|
+
@debug_error_string = debug_error_string
|
45
53
|
end
|
46
54
|
|
47
55
|
# Converts the exception to a {Struct::Status} for use in the networking
|
@@ -49,7 +57,7 @@ module GRPC
|
|
49
57
|
#
|
50
58
|
# @return [Struct::Status] with the same code and details
|
51
59
|
def to_status
|
52
|
-
Struct::Status.new(code, details, metadata)
|
60
|
+
Struct::Status.new(code, details, metadata, debug_error_string)
|
53
61
|
end
|
54
62
|
|
55
63
|
# Converts the exception to a deserialized {Google::Rpc::Status} object.
|
@@ -66,8 +74,10 @@ module GRPC
|
|
66
74
|
nil
|
67
75
|
end
|
68
76
|
|
69
|
-
def self.new_status_exception(code,
|
70
|
-
|
77
|
+
def self.new_status_exception(code,
|
78
|
+
details = 'unknown cause',
|
79
|
+
metadata = {},
|
80
|
+
debug_error_string = nil)
|
71
81
|
codes = {}
|
72
82
|
codes[OK] = Ok
|
73
83
|
codes[CANCELLED] = Cancelled
|
@@ -88,129 +98,180 @@ module GRPC
|
|
88
98
|
codes[DATA_LOSS] = DataLoss
|
89
99
|
|
90
100
|
if codes[code].nil?
|
91
|
-
BadStatus.new(code, details, metadata)
|
101
|
+
BadStatus.new(code, details, metadata, debug_error_string)
|
92
102
|
else
|
93
|
-
codes[code].new(details, metadata)
|
103
|
+
codes[code].new(details, metadata, debug_error_string)
|
94
104
|
end
|
95
105
|
end
|
96
106
|
end
|
97
107
|
|
98
108
|
# GRPC status code corresponding to status OK
|
99
109
|
class Ok < BadStatus
|
100
|
-
def initialize(details = 'unknown cause',
|
101
|
-
|
110
|
+
def initialize(details = 'unknown cause',
|
111
|
+
metadata = {},
|
112
|
+
debug_error_string = nil)
|
113
|
+
super(Core::StatusCodes::OK,
|
114
|
+
details, metadata, debug_error_string)
|
102
115
|
end
|
103
116
|
end
|
104
117
|
|
105
118
|
# GRPC status code corresponding to status CANCELLED
|
106
119
|
class Cancelled < BadStatus
|
107
|
-
def initialize(details = 'unknown cause',
|
108
|
-
|
120
|
+
def initialize(details = 'unknown cause',
|
121
|
+
metadata = {},
|
122
|
+
debug_error_string = nil)
|
123
|
+
super(Core::StatusCodes::CANCELLED,
|
124
|
+
details, metadata, debug_error_string)
|
109
125
|
end
|
110
126
|
end
|
111
127
|
|
112
128
|
# GRPC status code corresponding to status UNKNOWN
|
113
129
|
class Unknown < BadStatus
|
114
|
-
def initialize(details = 'unknown cause',
|
115
|
-
|
130
|
+
def initialize(details = 'unknown cause',
|
131
|
+
metadata = {},
|
132
|
+
debug_error_string = nil)
|
133
|
+
super(Core::StatusCodes::UNKNOWN,
|
134
|
+
details, metadata, debug_error_string)
|
116
135
|
end
|
117
136
|
end
|
118
137
|
|
119
138
|
# GRPC status code corresponding to status INVALID_ARGUMENT
|
120
139
|
class InvalidArgument < BadStatus
|
121
|
-
def initialize(details = 'unknown cause',
|
122
|
-
|
140
|
+
def initialize(details = 'unknown cause',
|
141
|
+
metadata = {},
|
142
|
+
debug_error_string = nil)
|
143
|
+
super(Core::StatusCodes::INVALID_ARGUMENT,
|
144
|
+
details, metadata, debug_error_string)
|
123
145
|
end
|
124
146
|
end
|
125
147
|
|
126
148
|
# GRPC status code corresponding to status DEADLINE_EXCEEDED
|
127
149
|
class DeadlineExceeded < BadStatus
|
128
|
-
def initialize(details = 'unknown cause',
|
129
|
-
|
150
|
+
def initialize(details = 'unknown cause',
|
151
|
+
metadata = {},
|
152
|
+
debug_error_string = nil)
|
153
|
+
super(Core::StatusCodes::DEADLINE_EXCEEDED,
|
154
|
+
details, metadata, debug_error_string)
|
130
155
|
end
|
131
156
|
end
|
132
157
|
|
133
158
|
# GRPC status code corresponding to status NOT_FOUND
|
134
159
|
class NotFound < BadStatus
|
135
|
-
def initialize(details = 'unknown cause',
|
136
|
-
|
160
|
+
def initialize(details = 'unknown cause',
|
161
|
+
metadata = {},
|
162
|
+
debug_error_string = nil)
|
163
|
+
super(Core::StatusCodes::NOT_FOUND,
|
164
|
+
details, metadata, debug_error_string)
|
137
165
|
end
|
138
166
|
end
|
139
167
|
|
140
168
|
# GRPC status code corresponding to status ALREADY_EXISTS
|
141
169
|
class AlreadyExists < BadStatus
|
142
|
-
def initialize(details = 'unknown cause',
|
143
|
-
|
170
|
+
def initialize(details = 'unknown cause',
|
171
|
+
metadata = {},
|
172
|
+
debug_error_string = nil)
|
173
|
+
super(Core::StatusCodes::ALREADY_EXISTS,
|
174
|
+
details, metadata, debug_error_string)
|
144
175
|
end
|
145
176
|
end
|
146
177
|
|
147
178
|
# GRPC status code corresponding to status PERMISSION_DENIED
|
148
179
|
class PermissionDenied < BadStatus
|
149
|
-
def initialize(details = 'unknown cause',
|
150
|
-
|
180
|
+
def initialize(details = 'unknown cause',
|
181
|
+
metadata = {},
|
182
|
+
debug_error_string = nil)
|
183
|
+
super(Core::StatusCodes::PERMISSION_DENIED,
|
184
|
+
details, metadata, debug_error_string)
|
151
185
|
end
|
152
186
|
end
|
153
187
|
|
154
188
|
# GRPC status code corresponding to status UNAUTHENTICATED
|
155
189
|
class Unauthenticated < BadStatus
|
156
|
-
def initialize(details = 'unknown cause',
|
157
|
-
|
190
|
+
def initialize(details = 'unknown cause',
|
191
|
+
metadata = {},
|
192
|
+
debug_error_string = nil)
|
193
|
+
super(Core::StatusCodes::UNAUTHENTICATED,
|
194
|
+
details, metadata, debug_error_string)
|
158
195
|
end
|
159
196
|
end
|
160
197
|
|
161
198
|
# GRPC status code corresponding to status RESOURCE_EXHAUSTED
|
162
199
|
class ResourceExhausted < BadStatus
|
163
|
-
def initialize(details = 'unknown cause',
|
164
|
-
|
200
|
+
def initialize(details = 'unknown cause',
|
201
|
+
metadata = {},
|
202
|
+
debug_error_string = nil)
|
203
|
+
super(Core::StatusCodes::RESOURCE_EXHAUSTED,
|
204
|
+
details, metadata, debug_error_string)
|
165
205
|
end
|
166
206
|
end
|
167
207
|
|
168
208
|
# GRPC status code corresponding to status FAILED_PRECONDITION
|
169
209
|
class FailedPrecondition < BadStatus
|
170
|
-
def initialize(details = 'unknown cause',
|
171
|
-
|
210
|
+
def initialize(details = 'unknown cause',
|
211
|
+
metadata = {},
|
212
|
+
debug_error_string = nil)
|
213
|
+
super(Core::StatusCodes::FAILED_PRECONDITION,
|
214
|
+
details, metadata, debug_error_string)
|
172
215
|
end
|
173
216
|
end
|
174
217
|
|
175
218
|
# GRPC status code corresponding to status ABORTED
|
176
219
|
class Aborted < BadStatus
|
177
|
-
def initialize(details = 'unknown cause',
|
178
|
-
|
220
|
+
def initialize(details = 'unknown cause',
|
221
|
+
metadata = {},
|
222
|
+
debug_error_string = nil)
|
223
|
+
super(Core::StatusCodes::ABORTED,
|
224
|
+
details, metadata, debug_error_string)
|
179
225
|
end
|
180
226
|
end
|
181
227
|
|
182
228
|
# GRPC status code corresponding to status OUT_OF_RANGE
|
183
229
|
class OutOfRange < BadStatus
|
184
|
-
def initialize(details = 'unknown cause',
|
185
|
-
|
230
|
+
def initialize(details = 'unknown cause',
|
231
|
+
metadata = {},
|
232
|
+
debug_error_string = nil)
|
233
|
+
super(Core::StatusCodes::OUT_OF_RANGE,
|
234
|
+
details, metadata, debug_error_string)
|
186
235
|
end
|
187
236
|
end
|
188
237
|
|
189
238
|
# GRPC status code corresponding to status UNIMPLEMENTED
|
190
239
|
class Unimplemented < BadStatus
|
191
|
-
def initialize(details = 'unknown cause',
|
192
|
-
|
240
|
+
def initialize(details = 'unknown cause',
|
241
|
+
metadata = {},
|
242
|
+
debug_error_string = nil)
|
243
|
+
super(Core::StatusCodes::UNIMPLEMENTED,
|
244
|
+
details, metadata, debug_error_string)
|
193
245
|
end
|
194
246
|
end
|
195
247
|
|
196
248
|
# GRPC status code corresponding to status INTERNAL
|
197
249
|
class Internal < BadStatus
|
198
|
-
def initialize(details = 'unknown cause',
|
199
|
-
|
250
|
+
def initialize(details = 'unknown cause',
|
251
|
+
metadata = {},
|
252
|
+
debug_error_string = nil)
|
253
|
+
super(Core::StatusCodes::INTERNAL,
|
254
|
+
details, metadata, debug_error_string)
|
200
255
|
end
|
201
256
|
end
|
202
257
|
|
203
258
|
# GRPC status code corresponding to status UNAVAILABLE
|
204
259
|
class Unavailable < BadStatus
|
205
|
-
def initialize(details = 'unknown cause',
|
206
|
-
|
260
|
+
def initialize(details = 'unknown cause',
|
261
|
+
metadata = {},
|
262
|
+
debug_error_string = nil)
|
263
|
+
super(Core::StatusCodes::UNAVAILABLE,
|
264
|
+
details, metadata, debug_error_string)
|
207
265
|
end
|
208
266
|
end
|
209
267
|
|
210
268
|
# GRPC status code corresponding to status DATA_LOSS
|
211
269
|
class DataLoss < BadStatus
|
212
|
-
def initialize(details = 'unknown cause',
|
213
|
-
|
270
|
+
def initialize(details = 'unknown cause',
|
271
|
+
metadata = {},
|
272
|
+
debug_error_string = nil)
|
273
|
+
super(Core::StatusCodes::DATA_LOSS,
|
274
|
+
details, metadata, debug_error_string)
|
214
275
|
end
|
215
276
|
end
|
216
277
|
end
|
@@ -23,13 +23,12 @@ class Struct
|
|
23
23
|
# is non-nil and not OK.
|
24
24
|
def check_status
|
25
25
|
return nil if status.nil?
|
26
|
-
fail GRPC::Cancelled if status.code == GRPC::Core::StatusCodes::CANCELLED
|
27
26
|
if status.code != GRPC::Core::StatusCodes::OK
|
28
27
|
GRPC.logger.debug("Failing with status #{status}")
|
29
28
|
# raise BadStatus, propagating the metadata if present.
|
30
|
-
md = status.metadata
|
31
29
|
fail GRPC::BadStatus.new_status_exception(
|
32
|
-
status.code, status.details,
|
30
|
+
status.code, status.details, status.metadata,
|
31
|
+
status.debug_error_string)
|
33
32
|
end
|
34
33
|
status
|
35
34
|
end
|
@@ -38,7 +38,7 @@ module GRPC
|
|
38
38
|
#
|
39
39
|
# @param [Object] request
|
40
40
|
# @param [GRPC::ActiveCall] call
|
41
|
-
# @param [
|
41
|
+
# @param [String] method
|
42
42
|
# @param [Hash] metadata
|
43
43
|
#
|
44
44
|
def request_response(request: nil, call: nil, method: nil, metadata: nil)
|
@@ -52,7 +52,7 @@ module GRPC
|
|
52
52
|
#
|
53
53
|
# @param [Enumerable] requests
|
54
54
|
# @param [GRPC::ActiveCall] call
|
55
|
-
# @param [
|
55
|
+
# @param [String] method
|
56
56
|
# @param [Hash] metadata
|
57
57
|
#
|
58
58
|
def client_streamer(requests: nil, call: nil, method: nil, metadata: nil)
|
@@ -66,7 +66,7 @@ module GRPC
|
|
66
66
|
#
|
67
67
|
# @param [Object] request
|
68
68
|
# @param [GRPC::ActiveCall] call
|
69
|
-
# @param [
|
69
|
+
# @param [String] method
|
70
70
|
# @param [Hash] metadata
|
71
71
|
#
|
72
72
|
def server_streamer(request: nil, call: nil, method: nil, metadata: nil)
|
@@ -80,7 +80,7 @@ module GRPC
|
|
80
80
|
#
|
81
81
|
# @param [Enumerable] requests
|
82
82
|
# @param [GRPC::ActiveCall] call
|
83
|
-
# @param [
|
83
|
+
# @param [String] method
|
84
84
|
# @param [Hash] metadata
|
85
85
|
#
|
86
86
|
def bidi_streamer(requests: nil, call: nil, method: nil, metadata: nil)
|
@@ -391,22 +391,21 @@ module GRPC
|
|
391
391
|
# register signal handlers
|
392
392
|
signals.each do |sig|
|
393
393
|
# input validation
|
394
|
-
if sig.class == String
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
end
|
394
|
+
target_sig = if sig.class == String
|
395
|
+
# cut out the SIG prefix to see if valid signal
|
396
|
+
sig.upcase.start_with?('SIG') ? sig.upcase[3..-1] : sig.upcase
|
397
|
+
else
|
398
|
+
sig
|
399
|
+
end
|
401
400
|
|
402
401
|
# register signal traps for all valid signals
|
403
|
-
if valid_signals.value?(
|
404
|
-
Signal.trap(
|
402
|
+
if valid_signals.value?(target_sig) || valid_signals.key?(target_sig)
|
403
|
+
Signal.trap(target_sig) do
|
405
404
|
@stop_server = true
|
406
405
|
@stop_server_cv.broadcast
|
407
406
|
end
|
408
407
|
else
|
409
|
-
fail "#{
|
408
|
+
fail "#{target_sig} not a valid signal"
|
410
409
|
end
|
411
410
|
end
|
412
411
|
|
@@ -31,6 +31,7 @@ module GRPC
|
|
31
31
|
#
|
32
32
|
# @param s [String] the string to be converted.
|
33
33
|
def self.underscore(s)
|
34
|
+
s = +s # Avoid mutating the argument, as it might be frozen.
|
34
35
|
s.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
35
36
|
s.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
|
36
37
|
s.tr!('-', '_')
|
@@ -167,22 +168,22 @@ module GRPC
|
|
167
168
|
if desc.request_response?
|
168
169
|
define_method(mth_name) do |req, metadata = {}|
|
169
170
|
GRPC.logger.debug("calling #{@host}:#{route}")
|
170
|
-
request_response(route, req, marshal, unmarshal, metadata)
|
171
|
+
request_response(route, req, marshal, unmarshal, **metadata)
|
171
172
|
end
|
172
173
|
elsif desc.client_streamer?
|
173
174
|
define_method(mth_name) do |reqs, metadata = {}|
|
174
175
|
GRPC.logger.debug("calling #{@host}:#{route}")
|
175
|
-
client_streamer(route, reqs, marshal, unmarshal, metadata)
|
176
|
+
client_streamer(route, reqs, marshal, unmarshal, **metadata)
|
176
177
|
end
|
177
178
|
elsif desc.server_streamer?
|
178
179
|
define_method(mth_name) do |req, metadata = {}, &blk|
|
179
180
|
GRPC.logger.debug("calling #{@host}:#{route}")
|
180
|
-
server_streamer(route, req, marshal, unmarshal, metadata, &blk)
|
181
|
+
server_streamer(route, req, marshal, unmarshal, **metadata, &blk)
|
181
182
|
end
|
182
183
|
else # is a bidi_stream
|
183
184
|
define_method(mth_name) do |reqs, metadata = {}, &blk|
|
184
185
|
GRPC.logger.debug("calling #{@host}:#{route}")
|
185
|
-
bidi_streamer(route, reqs, marshal, unmarshal, metadata, &blk)
|
186
|
+
bidi_streamer(route, reqs, marshal, unmarshal, **metadata, &blk)
|
186
187
|
end
|
187
188
|
end
|
188
189
|
end
|