Class: GrpcKit::Session::Stream
- Inherits:
-
Object
- Object
- GrpcKit::Session::Stream
- Extended by:
- Forwardable
- Defined in:
- lib/grpc_kit/session/stream.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#inflight ⇒ Object
Returns the value of attribute inflight.
-
#pending_recv_data ⇒ Object
readonly
Returns the value of attribute pending_recv_data.
-
#pending_send_data ⇒ Object
readonly
Returns the value of attribute pending_send_data.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#stream_id ⇒ Object
Returns the value of attribute stream_id.
-
#trailer_data ⇒ Object
readonly
Returns the value of attribute trailer_data.
Instance Method Summary collapse
- #add_header(name, value) ⇒ Object
-
#initialize(stream_id:, send_data: nil, recv_data: nil) ⇒ Stream
constructor
A new instance of Stream.
- #read_recv_data(last: false) ⇒ Object
- #write_send_data(data, last: false) ⇒ Object
- #write_trailers_data(tariler) ⇒ Object
Constructor Details
#initialize(stream_id:, send_data: nil, recv_data: nil) ⇒ Stream
Returns a new instance of Stream.
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/grpc_kit/session/stream.rb', line 20 def initialize(stream_id:, send_data: nil, recv_data: nil) @stream_id = stream_id @end_read_stream = false @headers = GrpcKit::Session::Headers.new @pending_send_data = send_data || GrpcKit::Session::Buffer.new @pending_recv_data = recv_data || GrpcKit::Session::Buffer.new @inflight = false @trailer_data = {} @status = GrpcKit::Session::StreamStatus.new end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
17 18 19 |
# File 'lib/grpc_kit/session/stream.rb', line 17 def headers @headers end |
#inflight ⇒ Object
Returns the value of attribute inflight.
18 19 20 |
# File 'lib/grpc_kit/session/stream.rb', line 18 def inflight @inflight end |
#pending_recv_data ⇒ Object (readonly)
Returns the value of attribute pending_recv_data.
17 18 19 |
# File 'lib/grpc_kit/session/stream.rb', line 17 def pending_recv_data @pending_recv_data end |
#pending_send_data ⇒ Object (readonly)
Returns the value of attribute pending_send_data.
17 18 19 |
# File 'lib/grpc_kit/session/stream.rb', line 17 def pending_send_data @pending_send_data end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
17 18 19 |
# File 'lib/grpc_kit/session/stream.rb', line 17 def status @status end |
#stream_id ⇒ Object
Returns the value of attribute stream_id.
18 19 20 |
# File 'lib/grpc_kit/session/stream.rb', line 18 def stream_id @stream_id end |
#trailer_data ⇒ Object (readonly)
Returns the value of attribute trailer_data.
17 18 19 |
# File 'lib/grpc_kit/session/stream.rb', line 17 def trailer_data @trailer_data end |
Instance Method Details
#add_header(name, value) ⇒ Object
44 45 46 |
# File 'lib/grpc_kit/session/stream.rb', line 44 def add_header(name, value) @headers.add(name, value) end |
#read_recv_data(last: false) ⇒ Object
40 41 42 |
# File 'lib/grpc_kit/session/stream.rb', line 40 def read_recv_data(last: false) @pending_recv_data.read(last: last) end |
#write_send_data(data, last: false) ⇒ Object
36 37 38 |
# File 'lib/grpc_kit/session/stream.rb', line 36 def write_send_data(data, last: false) @pending_send_data.write(data, last: last) end |
#write_trailers_data(tariler) ⇒ Object
32 33 34 |
# File 'lib/grpc_kit/session/stream.rb', line 32 def write_trailers_data(tariler) @trailer_data = tariler end |