grpc 1.27.0.pre1-universal-darwin → 1.30.0.pre1-universal-darwin

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4f4232bcaa213aae2c70efbdc6f31d2bdb9d4725909d8412dfbc544dd23c9f3
4
- data.tar.gz: f1a61c194ff783e29b46fac2906ac53cd3a6a23c8f8f811b32f845a6ef75f5a6
3
+ metadata.gz: 5eba0b2e80122fe383c0238b485d0944c7a0803b5a70b6af58882bc475347463
4
+ data.tar.gz: f4e6faae39b45e5eafde46f6338a6ddbe3f7957e1f9f2b17f459f840e2d359e8
5
5
  SHA512:
6
- metadata.gz: b74ead153c1fa7498a0f5707306e1eaa6f4da01c93c92fe83108d78e9fcbafa184ec94c4a60668a044e2c10b96a53b6fb17824b06efddefd852542591040d8a3
7
- data.tar.gz: e53e4677235ff22c11173ae9ea909fc2d7a040b0fae5248bccb1d20e07675026219ae93eabe71d2941226b86b02aa7a341d0594d04201ecaddb49cb7c4592e58
6
+ metadata.gz: 815b0b9c427776584013d4ae56e1518198fbc731965e452a320fbfb202bb64ac6bf3d4c776ab6923d8aa46592d79229a85f1e83c52e049daf23c68bda08fe189
7
+ data.tar.gz: a6d4bc3abac9f1cadf62b579cf11155d99a97dd009c5bbbc323d00e91b27d7c6158c13cc250512dc2a7f6761888d08219490e07b4eba7de368d57362b560fd66
@@ -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), NULL));
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);
@@ -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, details = 'unknown cause', metadata = {})
41
- super("#{code}:#{details}")
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, details = 'unknown cause',
70
- metadata = {})
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', metadata = {})
101
- super(Core::StatusCodes::OK, details, metadata)
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', metadata = {})
108
- super(Core::StatusCodes::CANCELLED, details, metadata)
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', metadata = {})
115
- super(Core::StatusCodes::UNKNOWN, details, metadata)
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', metadata = {})
122
- super(Core::StatusCodes::INVALID_ARGUMENT, details, metadata)
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', metadata = {})
129
- super(Core::StatusCodes::DEADLINE_EXCEEDED, details, metadata)
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', metadata = {})
136
- super(Core::StatusCodes::NOT_FOUND, details, metadata)
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', metadata = {})
143
- super(Core::StatusCodes::ALREADY_EXISTS, details, metadata)
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', metadata = {})
150
- super(Core::StatusCodes::PERMISSION_DENIED, details, metadata)
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', metadata = {})
157
- super(Core::StatusCodes::UNAUTHENTICATED, details, metadata)
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', metadata = {})
164
- super(Core::StatusCodes::RESOURCE_EXHAUSTED, details, metadata)
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', metadata = {})
171
- super(Core::StatusCodes::FAILED_PRECONDITION, details, metadata)
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', metadata = {})
178
- super(Core::StatusCodes::ABORTED, details, metadata)
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', metadata = {})
185
- super(Core::StatusCodes::OUT_OF_RANGE, details, metadata)
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', metadata = {})
192
- super(Core::StatusCodes::UNIMPLEMENTED, details, metadata)
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', metadata = {})
199
- super(Core::StatusCodes::INTERNAL, details, metadata)
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', metadata = {})
206
- super(Core::StatusCodes::UNAVAILABLE, details, metadata)
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', metadata = {})
213
- super(Core::StatusCodes::DATA_LOSS, details, metadata)
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, md)
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 [Method] method
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 [Method] method
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 [Method] method
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 [Method] method
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
- sig.upcase!
396
- if sig.start_with?('SIG')
397
- # cut out the SIG prefix to see if valid signal
398
- sig = sig[3..-1]
399
- end
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?(sig) || valid_signals.key?(sig)
404
- Signal.trap(sig) do
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 "#{sig} not a valid signal"
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
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- Struct.new('Status', :code, :details, :metadata)
15
+ Struct.new('Status', :code, :details, :metadata, :debug_error_string)
@@ -14,5 +14,5 @@
14
14
 
15
15
  # GRPC contains the General RPC module.
16
16
  module GRPC
17
- VERSION = '1.27.0.pre1'
17
+ VERSION = '1.30.0.pre1'
18
18
  end