Module: Google::Gax::Grpc
- Defined in:
- lib/google/gax/grpc.rb
Overview
Grpc adapts the gRPC surface
Constant Summary collapse
- STATUS_CODE_NAMES =
Hash[ GRPC::Core::StatusCodes.constants.map do |sym| [sym.to_s, GRPC::Core::StatusCodes.const_get(sym)] end ].freeze
- API_ERRORS =
[GRPC::BadStatus, GRPC::Cancelled].freeze
Class Method Summary collapse
-
.create_stub(service_path, port, chan_creds: nil, channel: nil, updater_proc: nil, scopes: nil) {|address, creds| ... } ⇒ Object
Creates a gRPC client stub.
Class Method Details
.create_stub(service_path, port, chan_creds: nil, channel: nil, updater_proc: nil, scopes: nil) {|address, creds| ... } ⇒ Object
Creates a gRPC client stub.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/google/gax/grpc.rb', line 73 def create_stub(service_path, port, chan_creds: nil, channel: nil, updater_proc: nil, scopes: nil) address = "#{service_path}:#{port}" if channel.nil? chan_creds = GRPC::Core::ChannelCredentials.new if chan_creds.nil? if updater_proc.nil? auth_creds = Google::Auth.get_application_default(scopes) updater_proc = auth_creds.updater_proc end call_creds = GRPC::Core::CallCredentials.new(updater_proc) chan_creds = chan_creds.compose(call_creds) yield(address, chan_creds) else yield(address, nil, channel_override: channel) end end |