Class: GrpcKit::Session::Stream

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/grpc_kit/session/stream.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stream_id:) ⇒ Stream


22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/grpc_kit/session/stream.rb', line 22

def initialize(stream_id:)
  @stream_id = stream_id
  @end_read_stream = false
  @headers = GrpcKit::Session::Headers.new
  @pending_send_data = GrpcKit::Session::SendBuffer.new
  @pending_recv_data = GrpcKit::Session::RecvBuffer.new

  @inflight = false
  @trailer_data = {}
  @status = GrpcKit::Session::StreamStatus.new
  @draining = false
end

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers


18
19
20
# File 'lib/grpc_kit/session/stream.rb', line 18

def headers
  @headers
end

#inflightObject

Returns the value of attribute inflight


19
20
21
# File 'lib/grpc_kit/session/stream.rb', line 19

def inflight
  @inflight
end

#pending_recv_dataObject (readonly)

Returns the value of attribute pending_recv_data


18
19
20
# File 'lib/grpc_kit/session/stream.rb', line 18

def pending_recv_data
  @pending_recv_data
end

#pending_send_dataObject (readonly)

Returns the value of attribute pending_send_data


18
19
20
# File 'lib/grpc_kit/session/stream.rb', line 18

def pending_send_data
  @pending_send_data
end

#statusObject (readonly)

Returns the value of attribute status


18
19
20
# File 'lib/grpc_kit/session/stream.rb', line 18

def status
  @status
end

#stream_idObject

Returns the value of attribute stream_id


19
20
21
# File 'lib/grpc_kit/session/stream.rb', line 19

def stream_id
  @stream_id
end

#trailer_dataObject (readonly)

Returns the value of attribute trailer_data


18
19
20
# File 'lib/grpc_kit/session/stream.rb', line 18

def trailer_data
  @trailer_data
end

Instance Method Details

#add_header(name, value) ⇒ void


62
63
64
# File 'lib/grpc_kit/session/stream.rb', line 62

def add_header(name, value)
  @headers.add(name, value)
end

#drainvoid


36
37
38
# File 'lib/grpc_kit/session/stream.rb', line 36

def drain
  @draining = true
end

#read_recv_data(last: false) ⇒ void


55
56
57
# File 'lib/grpc_kit/session/stream.rb', line 55

def read_recv_data(last: false)
  @pending_recv_data.read(last: last)
end

#write_send_data(data, last: false) ⇒ void


49
50
51
# File 'lib/grpc_kit/session/stream.rb', line 49

def write_send_data(data, last: false)
  @pending_send_data.write(data, last: last)
end

#write_trailers_data(tarilers) ⇒ void


42
43
44
# File 'lib/grpc_kit/session/stream.rb', line 42

def write_trailers_data(tarilers)
  @trailer_data = tarilers
end