Skip to content

Commit

Permalink
feat(multi): Support for channel pool configuration (googleapis#22917)
Browse files Browse the repository at this point in the history
  • Loading branch information
gcf-owl-bot[bot] authored Sep 9, 2023
1 parent 22c1aa8 commit 1e15bd4
Show file tree
Hide file tree
Showing 69 changed files with 3,209 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |gem|

gem.required_ruby_version = ">= 2.6"

gem.add_dependency "gapic-common", ">= 0.19.1", "< 2.a"
gem.add_dependency "gapic-common", ">= 0.20.0", "< 2.a"
gem.add_dependency "google-cloud-errors", "~> 1.0"

gem.add_development_dependency "google-style", "~> 1.26.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ def initialize
credentials: credentials,
endpoint: @config.endpoint,
channel_args: @config.channel_args,
interceptors: @config.interceptors
interceptors: @config.interceptors,
channel_pool_config: @config.channel_pool
)
end

Expand Down Expand Up @@ -2677,6 +2678,14 @@ def rpcs
end
end

##
# Configuration for the channel pool
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
#
def channel_pool
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
end

##
# Configuration RPC class for the AutoMl API.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def initialize
credentials: credentials,
endpoint: @config.endpoint,
channel_args: @config.channel_args,
interceptors: @config.interceptors
interceptors: @config.interceptors,
channel_pool_config: @config.channel_pool
)

# Used by an LRO wrapper for some methods of this service
Expand Down Expand Up @@ -709,6 +710,14 @@ def rpcs
end
end

##
# Configuration for the channel pool
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
#
def channel_pool
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
end

##
# Configuration RPC class for the Operations API.
#
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,26 @@ def initialize
# @return [::Gapic::Operation]
#
# @raise [::Google::Cloud::Error] if the REST call is aborted.
#
# @example Basic example
# require "google/longrunning"
#
# # Create a client object. The client can be reused for multiple calls.
# client = Google::Longrunning::Operations::Rest::Client.new
#
# # Create a request. To set request fields, pass in keyword arguments.
# request = Google::Longrunning::ListOperationsRequest.new
#
# # Call the list_operations method.
# result = client.list_operations request
#
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
# # over elements, and API calls will be issued to fetch pages as needed.
# result.each do |item|
# # Each element is of type ::Google::Longrunning::Operation.
# p item
# end
#
def list_operations request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?

Expand Down Expand Up @@ -201,6 +221,29 @@ def list_operations request, options = nil
# @return [::Gapic::Operation]
#
# @raise [::Google::Cloud::Error] if the REST call is aborted.
#
# @example Basic example
# require "google/longrunning"
#
# # Create a client object. The client can be reused for multiple calls.
# client = Google::Longrunning::Operations::Rest::Client.new
#
# # Create a request. To set request fields, pass in keyword arguments.
# request = Google::Longrunning::GetOperationRequest.new
#
# # Call the get_operation method.
# result = client.get_operation request
#
# # The returned object is of type Gapic::Operation. You can use it to
# # check the status of an operation, cancel it, or wait for results.
# # Here is how to wait for a response.
# result.wait_until_done! timeout: 60
# if result.response?
# p result.response
# else
# puts "No response received."
# end
#
def get_operation request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?

Expand Down Expand Up @@ -267,6 +310,22 @@ def get_operation request, options = nil
# @return [::Google::Protobuf::Empty]
#
# @raise [::Google::Cloud::Error] if the REST call is aborted.
#
# @example Basic example
# require "google/longrunning"
#
# # Create a client object. The client can be reused for multiple calls.
# client = Google::Longrunning::Operations::Rest::Client.new
#
# # Create a request. To set request fields, pass in keyword arguments.
# request = Google::Longrunning::DeleteOperationRequest.new
#
# # Call the delete_operation method.
# result = client.delete_operation request
#
# # The returned object is of type Google::Protobuf::Empty.
# p result
#
def delete_operation request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?

Expand Down Expand Up @@ -338,6 +397,22 @@ def delete_operation request, options = nil
# @return [::Google::Protobuf::Empty]
#
# @raise [::Google::Cloud::Error] if the REST call is aborted.
#
# @example Basic example
# require "google/longrunning"
#
# # Create a client object. The client can be reused for multiple calls.
# client = Google::Longrunning::Operations::Rest::Client.new
#
# # Create a request. To set request fields, pass in keyword arguments.
# request = Google::Longrunning::CancelOperationRequest.new
#
# # Call the cancel_operation method.
# result = client.cancel_operation request
#
# # The returned object is of type Google::Protobuf::Empty.
# p result
#
def cancel_operation request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?

Expand Down Expand Up @@ -412,6 +487,29 @@ def cancel_operation request, options = nil
# @return [::Gapic::Operation]
#
# @raise [::Google::Cloud::Error] if the REST call is aborted.
#
# @example Basic example
# require "google/longrunning"
#
# # Create a client object. The client can be reused for multiple calls.
# client = Google::Longrunning::Operations::Rest::Client.new
#
# # Create a request. To set request fields, pass in keyword arguments.
# request = Google::Longrunning::WaitOperationRequest.new
#
# # Call the wait_operation method.
# result = client.wait_operation request
#
# # The returned object is of type Gapic::Operation. You can use it to
# # check the status of an operation, cancel it, or wait for results.
# # Here is how to wait for a response.
# result.wait_until_done! timeout: 60
# if result.response?
# p result.response
# else
# puts "No response received."
# end
#
def wait_operation request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ def initialize
credentials: credentials,
endpoint: @config.endpoint,
channel_args: @config.channel_args,
interceptors: @config.interceptors
interceptors: @config.interceptors,
channel_pool_config: @config.channel_pool
)
end

Expand Down Expand Up @@ -590,6 +591,14 @@ def rpcs
end
end

##
# Configuration for the channel pool
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
#
def channel_pool
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
end

##
# Configuration RPC class for the PredictionService API.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def initialize
credentials: credentials,
endpoint: @config.endpoint,
channel_args: @config.channel_args,
interceptors: @config.interceptors
interceptors: @config.interceptors,
channel_pool_config: @config.channel_pool
)

# Used by an LRO wrapper for some methods of this service
Expand Down Expand Up @@ -709,6 +710,14 @@ def rpcs
end
end

##
# Configuration for the channel pool
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
#
def channel_pool
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
end

##
# Configuration RPC class for the Operations API.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,22 @@ def initialize
# @return [::Google::Cloud::AutoML::V1beta1::PredictResponse]
#
# @raise [::Google::Cloud::Error] if the REST call is aborted.
#
# @example Basic example
# require "google/cloud/automl/v1beta1"
#
# # Create a client object. The client can be reused for multiple calls.
# client = Google::Cloud::AutoML::V1beta1::PredictionService::Rest::Client.new
#
# # Create a request. To set request fields, pass in keyword arguments.
# request = Google::Cloud::AutoML::V1beta1::PredictRequest.new
#
# # Call the predict method.
# result = client.predict request
#
# # The returned object is of type Google::Cloud::AutoML::V1beta1::PredictResponse.
# p result
#
def predict request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?

Expand Down Expand Up @@ -373,6 +389,29 @@ def predict request, options = nil
# @return [::Gapic::Operation]
#
# @raise [::Google::Cloud::Error] if the REST call is aborted.
#
# @example Basic example
# require "google/cloud/automl/v1beta1"
#
# # Create a client object. The client can be reused for multiple calls.
# client = Google::Cloud::AutoML::V1beta1::PredictionService::Rest::Client.new
#
# # Create a request. To set request fields, pass in keyword arguments.
# request = Google::Cloud::AutoML::V1beta1::BatchPredictRequest.new
#
# # Call the batch_predict method.
# result = client.batch_predict request
#
# # The returned object is of type Gapic::Operation. You can use it to
# # check the status of an operation, cancel it, or wait for results.
# # Here is how to wait for a response.
# result.wait_until_done! timeout: 60
# if result.response?
# p result.response
# else
# puts "No response received."
# end
#
def batch_predict request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?

Expand Down
Loading

0 comments on commit 1e15bd4

Please sign in to comment.