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.
-
#local_end_stream ⇒ Object
Returns the value of attribute local_end_stream.
-
#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.
-
#remote_end_stream ⇒ Object
Returns the value of attribute remote_end_stream.
-
#stream_id ⇒ Object
Returns the value of attribute stream_id.
Instance Method Summary collapse
- #add_header(name, value) ⇒ Object
- #end_read? ⇒ Boolean
- #end_stream ⇒ Object
- #end_stream? ⇒ Boolean
- #end_write? ⇒ Boolean
-
#initialize(stream_id:, send_data: GrpcKit::Session::Buffer.new) ⇒ Stream
constructor
A new instance of Stream.
- #read_recv_data(last: false) ⇒ Object
- #write_send_data(data, last: false) ⇒ Object
Constructor Details
#initialize(stream_id:, send_data: GrpcKit::Session::Buffer.new) ⇒ Stream
Returns a new instance of Stream.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/grpc_kit/session/stream.rb', line 18 def initialize(stream_id:, send_data: GrpcKit::Session::Buffer.new) @stream_id = stream_id @end_read_stream = false @headers = GrpcKit::Session::Headers.new @pending_send_data = send_data @pending_recv_data = GrpcKit::Session::Buffer.new @local_end_stream = false @remote_end_stream = false @inflight = false end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
15 16 17 |
# File 'lib/grpc_kit/session/stream.rb', line 15 def headers @headers end |
#inflight ⇒ Object
Returns the value of attribute inflight.
16 17 18 |
# File 'lib/grpc_kit/session/stream.rb', line 16 def inflight @inflight end |
#local_end_stream ⇒ Object
Returns the value of attribute local_end_stream.
16 17 18 |
# File 'lib/grpc_kit/session/stream.rb', line 16 def local_end_stream @local_end_stream end |
#pending_recv_data ⇒ Object (readonly)
Returns the value of attribute pending_recv_data.
15 16 17 |
# File 'lib/grpc_kit/session/stream.rb', line 15 def pending_recv_data @pending_recv_data end |
#pending_send_data ⇒ Object (readonly)
Returns the value of attribute pending_send_data.
15 16 17 |
# File 'lib/grpc_kit/session/stream.rb', line 15 def pending_send_data @pending_send_data end |
#remote_end_stream ⇒ Object
Returns the value of attribute remote_end_stream.
16 17 18 |
# File 'lib/grpc_kit/session/stream.rb', line 16 def remote_end_stream @remote_end_stream end |
#stream_id ⇒ Object
Returns the value of attribute stream_id.
16 17 18 |
# File 'lib/grpc_kit/session/stream.rb', line 16 def stream_id @stream_id end |
Instance Method Details
#add_header(name, value) ⇒ Object
55 56 57 |
# File 'lib/grpc_kit/session/stream.rb', line 55 def add_header(name, value) @headers.add(name, value) end |
#end_read? ⇒ Boolean
42 43 44 |
# File 'lib/grpc_kit/session/stream.rb', line 42 def end_read? @remote_end_stream || @pending_recv_data.end_read? end |
#end_stream ⇒ Object
50 51 52 53 |
# File 'lib/grpc_kit/session/stream.rb', line 50 def end_stream end_read end_write end |
#end_stream? ⇒ Boolean
46 47 48 |
# File 'lib/grpc_kit/session/stream.rb', line 46 def end_stream? end_read? && end_write? end |
#end_write? ⇒ Boolean
38 39 40 |
# File 'lib/grpc_kit/session/stream.rb', line 38 def end_write? @local_end_stream || @pending_send_data.end_write? end |
#read_recv_data(last: false) ⇒ Object
34 35 36 |
# File 'lib/grpc_kit/session/stream.rb', line 34 def read_recv_data(last: false) @pending_recv_data.read(last: last) end |
#write_send_data(data, last: false) ⇒ Object
30 31 32 |
# File 'lib/grpc_kit/session/stream.rb', line 30 def write_send_data(data, last: false) @pending_send_data.write(data, last: last) end |