google-gax 0.8.6 → 0.8.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/lib/google/gax.rb +0 -0
- data/lib/google/gax/api_callable.rb +20 -41
- data/lib/google/gax/bundling.rb +0 -0
- data/lib/google/gax/constants.rb +0 -0
- data/lib/google/gax/credentials.rb +0 -0
- data/lib/google/gax/errors.rb +0 -0
- data/lib/google/gax/grpc.rb +0 -0
- data/lib/google/gax/operation.rb +0 -0
- data/lib/google/gax/path_template.rb +0 -0
- data/lib/google/gax/settings.rb +0 -0
- data/lib/google/gax/util.rb +0 -0
- data/lib/google/gax/version.rb +1 -1
- data/lib/google/longrunning/operations_client.rb +2 -1
- data/lib/google/longrunning/operations_client_config.json +0 -0
- data/spec/fixtures/fixture.proto +0 -0
- data/spec/fixtures/fixture_pb.rb +0 -0
- data/spec/google/gax/api_callable_spec.rb +0 -0
- data/spec/google/gax/bundling_spec.rb +0 -0
- data/spec/google/gax/credentials_spec.rb +0 -0
- data/spec/google/gax/grpc_spec.rb +0 -0
- data/spec/google/gax/operation_spec.rb +0 -0
- data/spec/google/gax/path_template_spec.rb +0 -0
- data/spec/google/gax/settings_spec.rb +0 -0
- data/spec/google/gax/util_spec.rb +0 -0
- data/spec/spec_helper.rb +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 716e8277e7cc5439a3f53c73c6cde2a8299ece01
|
4
|
+
data.tar.gz: ddb28ab9299ec05325ca30cdd40d13b5791d03f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b39b230f9fe8cd4eb4ce9a37f1b5290a2f616e05fa0a646b56287ae9a56f0543687a987db3fa1ec0996cbece43f67cb0cd957d68167c80e8f7b3faa1b035550
|
7
|
+
data.tar.gz: b74ca9b64dcf91794360de8b7055f10f4a70cce756629298fb75273b2e73004c362609b07067e30eeab5765365dde23ddded22775898d4f70d8fe8da68f9ede8
|
data/README.md
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/lib/google/gax.rb
CHANGED
File without changes
|
@@ -32,8 +32,6 @@ require 'time'
|
|
32
32
|
require 'google/gax/errors'
|
33
33
|
require 'google/gax/bundling'
|
34
34
|
|
35
|
-
# rubocop:disable Metrics/ModuleLength
|
36
|
-
|
37
35
|
module Google
|
38
36
|
module Gax
|
39
37
|
# A class to provide the Enumerable interface for page-streaming method.
|
@@ -246,21 +244,9 @@ module Google
|
|
246
244
|
add_timeout_arg(func, this_settings.timeout,
|
247
245
|
this_settings.kwargs)
|
248
246
|
end
|
249
|
-
api_call = catch_errors(api_call, settings.errors)
|
250
|
-
api_caller.call(api_call, request, this_settings)
|
251
|
-
end
|
252
|
-
end
|
253
|
-
|
254
|
-
# Updates a_func to wrap exceptions with GaxError
|
255
|
-
#
|
256
|
-
# @param a_func [Proc]
|
257
|
-
# @param errors [Array<Exception>] Configures the exceptions to wrap.
|
258
|
-
# @return [Proc] A proc that will wrap certain exceptions with GaxError.
|
259
|
-
def catch_errors(a_func, errors)
|
260
|
-
proc do |request|
|
261
247
|
begin
|
262
|
-
|
263
|
-
rescue *errors
|
248
|
+
api_caller.call(api_call, request, this_settings)
|
249
|
+
rescue *settings.errors
|
264
250
|
raise GaxError, 'RPC failed'
|
265
251
|
end
|
266
252
|
end
|
@@ -312,8 +298,6 @@ module Google
|
|
312
298
|
enumerable.method(:start)
|
313
299
|
end
|
314
300
|
|
315
|
-
# rubocop:disable Metrics/MethodLength
|
316
|
-
|
317
301
|
# Creates a proc equivalent to a_func, but that retries on certain
|
318
302
|
# exceptions.
|
319
303
|
#
|
@@ -336,29 +320,24 @@ module Google
|
|
336
320
|
delay = retry_options.backoff_settings.initial_retry_delay_millis
|
337
321
|
timeout = (retry_options.backoff_settings.initial_rpc_timeout_millis /
|
338
322
|
MILLIS_PER_SECOND)
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
delay = [delay * delay_mult, max_delay].min
|
355
|
-
timeout = [timeout * timeout_mult, max_timeout, deadline - now].min
|
356
|
-
if now >= deadline
|
357
|
-
raise RetryError, 'Retry total timeout exceeded with exception'
|
358
|
-
end
|
323
|
+
deadline = Time.now + total_timeout
|
324
|
+
begin
|
325
|
+
a_func.call(request, deadline: Time.now + timeout, metadata: kwargs)
|
326
|
+
rescue => exception
|
327
|
+
unless exception.respond_to?(:code) &&
|
328
|
+
retry_options.retry_codes.include?(exception.code)
|
329
|
+
raise RetryError, 'Exception occurred in retry method that ' \
|
330
|
+
'was not classified as transient'
|
331
|
+
end
|
332
|
+
sleep(rand(delay) / MILLIS_PER_SECOND)
|
333
|
+
now = Time.now
|
334
|
+
delay = [delay * delay_mult, max_delay].min
|
335
|
+
timeout = [timeout * timeout_mult, max_timeout, deadline - now].min
|
336
|
+
if now >= deadline
|
337
|
+
raise RetryError, 'Retry total timeout exceeded with exception'
|
359
338
|
end
|
339
|
+
retry
|
360
340
|
end
|
361
|
-
result
|
362
341
|
end
|
363
342
|
end
|
364
343
|
|
@@ -377,9 +356,9 @@ module Google
|
|
377
356
|
end
|
378
357
|
end
|
379
358
|
|
380
|
-
module_function :create_api_call, :
|
359
|
+
module_function :create_api_call, :bundleable,
|
381
360
|
:page_streamable, :retryable, :add_timeout_arg
|
382
|
-
private_class_method :
|
361
|
+
private_class_method :bundleable, :page_streamable,
|
383
362
|
:retryable, :add_timeout_arg
|
384
363
|
end
|
385
364
|
end
|
data/lib/google/gax/bundling.rb
CHANGED
File without changes
|
data/lib/google/gax/constants.rb
CHANGED
File without changes
|
File without changes
|
data/lib/google/gax/errors.rb
CHANGED
File without changes
|
data/lib/google/gax/grpc.rb
CHANGED
File without changes
|
data/lib/google/gax/operation.rb
CHANGED
File without changes
|
File without changes
|
data/lib/google/gax/settings.rb
CHANGED
File without changes
|
data/lib/google/gax/util.rb
CHANGED
File without changes
|
data/lib/google/gax/version.rb
CHANGED
@@ -80,6 +80,7 @@ module Google
|
|
80
80
|
# The scopes needed to make gRPC calls to all of the methods defined in
|
81
81
|
# this service.
|
82
82
|
ALL_SCOPES = [
|
83
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
83
84
|
].freeze
|
84
85
|
|
85
86
|
# @param service_path [String]
|
@@ -142,7 +143,7 @@ module Google
|
|
142
143
|
warn "`app_name` and `app_version` are no longer being used in the request headers."
|
143
144
|
end
|
144
145
|
|
145
|
-
credentials ||= Google::Gax::Credentials.default
|
146
|
+
credentials ||= Google::Gax::Credentials.default(scope: scopes)
|
146
147
|
|
147
148
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
148
149
|
updater_proc = Google::Gax::Credentials.new(credentials).updater_proc
|
File without changes
|
data/spec/fixtures/fixture.proto
CHANGED
File without changes
|
data/spec/fixtures/fixture_pb.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-gax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google API Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: googleauth
|