Class: GrpcKit::Transport::ClientTransport
  
  
  
  
  
    - Inherits:
- 
      Object
      
        
          - Object
- GrpcKit::Transport::ClientTransport
 show all
      - Includes:
- Packable
    - Defined in:
- lib/grpc_kit/transport/client_transport.rb
 
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  Methods included from Packable
  #pack, #unpack, #unpacker
  Constructor Details
  
    
  
  
    
Returns a new instance of ClientTransport.
   
 
  
    | 
11
12
13
14 | # File 'lib/grpc_kit/transport/client_transport.rb', line 11
def initialize(session)
  @session = session
  @stream = nil end | 
 
  
 
  
    Instance Method Details
    
      
  
  
    #close_and_flush  ⇒ void 
  
  
  
  
    This method returns an undefined value.
   
 
  
  
    | 
26
27
28
29
30
31
32
33 | # File 'lib/grpc_kit/transport/client_transport.rb', line 26
def close_and_flush
  @stream.end_write
  send_data
  @session.start(@stream.stream_id)
  @stream.end_read
  @deferred = false
end | 
 
    
      
  
  
    #read_data(last: false)  ⇒ nil, String 
  
  
  
  
    | 
45
46
47 | # File 'lib/grpc_kit/transport/client_transport.rb', line 45
def read_data(last: false)
  unpack(recv_data(last: last))
end | 
 
    
      
  
  
    #read_data_nonblock(last: false)  ⇒ nil, String 
  
  
  
  
    | 
51
52
53
54
55
56
57
58
59 | # File 'lib/grpc_kit/transport/client_transport.rb', line 51
def read_data_nonblock(last: false)
  data = nonblock_recv_data(last: last)
  if data == :wait_readable
    unpack(nil)     :wait_readable
  else
    unpack(data)
  end
end | 
 
    
      
  
  
    | 
62
63
64
65 | # File 'lib/grpc_kit/transport/client_transport.rb', line 62
def 
  wait_close
  @stream.
end | 
 
    
      
  
  
    #start_request(data, headers, last: false)  ⇒ void 
  
  
  
  
    This method returns an undefined value.
   
 
  
    | 
20
21
22
23 | # File 'lib/grpc_kit/transport/client_transport.rb', line 20
def start_request(data, , last: false)
  @stream = @session.send_request()
  write_data(data, last: last)
end | 
 
    
      
  
  
    #write_data(buf, last: false)  ⇒ void 
  
  
  
  
    This method returns an undefined value.
   
 
  
    | 
38
39
40
41 | # File 'lib/grpc_kit/transport/client_transport.rb', line 38
def write_data(buf, last: false)
  write(@stream.pending_send_data, pack(buf), last: last)
  send_data
end |