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) ⇒ void
- #close ⇒ Object
- #close_remote ⇒ Object
- #drain ⇒ void
- #end_read ⇒ Object
- #end_write ⇒ Object
-
#initialize(stream_id:) ⇒ Stream
constructor
A new instance of Stream.
- #read_recv_data(last: false, blocking:) ⇒ void
- #write_send_data(data, last: false) ⇒ void
- #write_trailers_data(tarilers) ⇒ void
Constructor Details
#initialize(stream_id:) ⇒ Stream
Returns a new instance of Stream.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/grpc_kit/session/stream.rb', line 21 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
#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) ⇒ void
This method returns an undefined value.
70 71 72 |
# File 'lib/grpc_kit/session/stream.rb', line 70 def add_header(name, value) @headers.add(name, value) end |
#close ⇒ Object
76 77 78 79 |
# File 'lib/grpc_kit/session/stream.rb', line 76 def close status.close pending_recv_data.close end |
#close_remote ⇒ Object
81 82 83 84 |
# File 'lib/grpc_kit/session/stream.rb', line 81 def close_remote status.close_remote pending_recv_data.close end |
#drain ⇒ void
This method returns an undefined value.
43 44 45 |
# File 'lib/grpc_kit/session/stream.rb', line 43 def drain @draining = true end |
#end_read ⇒ Object
38 39 40 |
# File 'lib/grpc_kit/session/stream.rb', line 38 def end_read @pending_recv_data.end_read end |
#end_write ⇒ Object
34 35 36 |
# File 'lib/grpc_kit/session/stream.rb', line 34 def end_write @pending_send_data.end_write end |
#read_recv_data(last: false, blocking:) ⇒ void
This method returns an undefined value.
63 64 65 |
# File 'lib/grpc_kit/session/stream.rb', line 63 def read_recv_data(last: false, blocking:) @pending_recv_data.read(last: last, blocking: blocking) end |
#write_send_data(data, last: false) ⇒ void
This method returns an undefined value.
56 57 58 |
# File 'lib/grpc_kit/session/stream.rb', line 56 def write_send_data(data, last: false) @pending_send_data.write(data, last: last) end |
#write_trailers_data(tarilers) ⇒ void
This method returns an undefined value.
49 50 51 |
# File 'lib/grpc_kit/session/stream.rb', line 49 def write_trailers_data(tarilers) @trailer_data = tarilers end |