Class: GrpcKit::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/grpc_kit/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(sock, authority: nil, interceptors: [], timeout: nil) ⇒ Client


15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/grpc_kit/client.rb', line 15

def initialize(sock, authority: nil, interceptors: [], timeout: nil)
  @sock = sock
  @authority =
    if authority
      authority
    else
      addr = sock.addr
      "#{addr[3]}:#{addr[1]}"
    end

  @timeout = timeout && GrpcKit::GrpcTime.new(timeout)

  build_rpcs(interceptors)
end

Instance Method Details

#bidi_streamer(rpc, _requests, opts = {}) ⇒ Object


56
57
58
59
# File 'lib/grpc_kit/client.rb', line 56

def bidi_streamer(rpc, _requests, opts = {})
  GrpcKit.logger.debug('Calling bidi_streamer')
  do_request(rpc, nil, opts)
end

#client_streamer(rpc, opts = {}) ⇒ Object


40
41
42
43
# File 'lib/grpc_kit/client.rb', line 40

def client_streamer(rpc, opts = {})
  GrpcKit.logger.debug('Calling client_streamer')
  do_request(rpc, nil, opts)
end

#request_response(rpc, request, opts = {}) ⇒ Object


33
34
35
36
# File 'lib/grpc_kit/client.rb', line 33

def request_response(rpc, request, opts = {})
  GrpcKit.logger.debug('Calling request_respose')
  do_request(rpc, request, opts)
end

#server_streamer(rpc, request, opts = {}) ⇒ Object


48
49
50
51
# File 'lib/grpc_kit/client.rb', line 48

def server_streamer(rpc, request, opts = {})
  GrpcKit.logger.debug('Calling server_streamer')
  do_request(rpc, request, opts)
end