Package io.grpc.netty

Class NettyClientStream.TransportState

All Implemented Interfaces:
ApplicationThreadDeframer.TransportExecutor, ApplicationThreadDeframerListener.TransportExecutor, MessageDeframer.Listener, StreamIdHolder
Enclosing class:
NettyClientStream

public abstract static class NettyClientStream.TransportState extends Http2ClientStreamTransportState implements StreamIdHolder
This should only be called from the transport thread.
  • Field Details

    • NON_EXISTENT_ID

      private static final int NON_EXISTENT_ID
      See Also:
    • methodName

      private final String methodName
    • handler

      private final NettyClientHandler handler
    • eventLoop

      private final io.netty.channel.EventLoop eventLoop
    • id

      private int id
    • http2Stream

      private io.netty.handler.codec.http2.Http2Stream http2Stream
    • tag

      private io.perfmark.Tag tag
  • Constructor Details

  • Method Details

    • id

      public int id()
      Description copied from interface: StreamIdHolder
      Returns the id.
      Specified by:
      id in interface StreamIdHolder
    • setId

      public void setId(int id)
    • setNonExistent

      void setNonExistent()
      Marks the stream state as if it had never existed. This can happen if the stream is cancelled after it is created, but before it has been started.
    • isNonExistent

      boolean isNonExistent()
    • setHttp2Stream

      public void setHttp2Stream(io.netty.handler.codec.http2.Http2Stream http2Stream)
      Sets the underlying Netty Http2Stream for this stream. This must be called in the context of the transport thread.
    • http2Stream

      @Nullable public io.netty.handler.codec.http2.Http2Stream http2Stream()
      Gets the underlying Netty Http2Stream for this stream.
    • statusFromFailedFuture

      protected abstract Status statusFromFailedFuture(io.netty.channel.ChannelFuture f)
      Intended to be overridden by NettyClientTransport, which has more information about failures. May only be called from event loop.
    • http2ProcessingFailed

      protected void http2ProcessingFailed(Status status, boolean stopDelivery, Metadata trailers)
      Description copied from class: Http2ClientStreamTransportState
      Called to process a failure in HTTP/2 processing. It should notify the transport to cancel the stream and call transportReportStatus().
      Specified by:
      http2ProcessingFailed in class Http2ClientStreamTransportState
    • onWriteFrameData

      private void onWriteFrameData(io.netty.channel.ChannelFuture future, int numMessages, int numBytes)
    • runOnTransportThread

      public void runOnTransportThread(Runnable r)
      Specified by:
      runOnTransportThread in interface ApplicationThreadDeframerListener.TransportExecutor
    • bytesRead

      public void bytesRead(int processedBytes)
      Description copied from interface: MessageDeframer.Listener
      Called when the given number of bytes has been read from the input source of the deframer. This is typically used to indicate to the underlying transport that more data can be accepted.
      Specified by:
      bytesRead in interface MessageDeframer.Listener
      Parameters:
      processedBytes - the number of bytes read from the deframer's input source.
    • deframeFailed

      public void deframeFailed(Throwable cause)
      Description copied from interface: MessageDeframer.Listener
      Called when a MessageDeframer.deframe(ReadableBuffer) operation failed.
      Specified by:
      deframeFailed in interface MessageDeframer.Listener
      Parameters:
      cause - the actual failure
    • transportHeadersReceived

      void transportHeadersReceived(io.netty.handler.codec.http2.Http2Headers headers, boolean endOfStream)
    • transportDataReceived

      void transportDataReceived(io.netty.buffer.ByteBuf frame, boolean endOfStream)
    • tag

      public final io.perfmark.Tag tag()
      Specified by:
      tag in interface StreamIdHolder