Package io.grpc.netty
Class NettyClientStream.TransportState
java.lang.Object
io.grpc.internal.AbstractStream.TransportState
io.grpc.internal.AbstractClientStream.TransportState
io.grpc.internal.Http2ClientStreamTransportState
io.grpc.netty.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 Summary
FieldsModifier and TypeFieldDescriptionprivate final io.netty.channel.EventLoopprivate final NettyClientHandlerprivate io.netty.handler.codec.http2.Http2Streamprivate intprivate final Stringprivate static final intprivate io.perfmark.TagFields inherited from class io.grpc.internal.AbstractStream.TransportState
DEFAULT_ONREADY_THRESHOLD -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTransportState(NettyClientHandler handler, io.netty.channel.EventLoop eventLoop, int maxMessageSize, StatsTraceContext statsTraceCtx, TransportTracer transportTracer, String methodName, CallOptions options) -
Method Summary
Modifier and TypeMethodDescriptionvoidbytesRead(int processedBytes) Called when the given number of bytes has been read from the input source of the deframer.voiddeframeFailed(Throwable cause) Called when aMessageDeframer.deframe(ReadableBuffer)operation failed.protected voidhttp2ProcessingFailed(Status status, boolean stopDelivery, Metadata trailers) Called to process a failure in HTTP/2 processing.io.netty.handler.codec.http2.Http2StreamGets the underlying NettyHttp2Streamfor this stream.intid()Returns the id.(package private) booleanprivate voidonWriteFrameData(io.netty.channel.ChannelFuture future, int numMessages, int numBytes) voidvoidsetHttp2Stream(io.netty.handler.codec.http2.Http2Stream http2Stream) Sets the underlying NettyHttp2Streamfor this stream.voidsetId(int id) (package private) voidMarks the stream state as if it had never existed.protected abstract StatusstatusFromFailedFuture(io.netty.channel.ChannelFuture f) Intended to be overridden by NettyClientTransport, which has more information about failures.final io.perfmark.Tagtag()(package private) voidtransportDataReceived(io.netty.buffer.ByteBuf frame, boolean endOfStream) (package private) voidtransportHeadersReceived(io.netty.handler.codec.http2.Http2Headers headers, boolean endOfStream) Methods inherited from class io.grpc.internal.Http2ClientStreamTransportState
transportDataReceived, transportHeadersReceived, transportTrailersReceivedMethods inherited from class io.grpc.internal.AbstractClientStream.TransportState
deframerClosed, inboundDataReceived, inboundHeadersReceived, inboundTrailersReceived, isOutboundClosed, listener, setListener, transportReportStatus, transportReportStatusMethods inherited from class io.grpc.internal.AbstractStream.TransportState
closeDeframer, deframe, getStatsTraceContext, getTransportTracer, isStreamDeallocated, messagesAvailable, onSentBytes, onStreamAllocated, onStreamDeallocated, requestMessagesFromDeframerForTesting, setDecompressor, setFullStreamDecompressor
-
Field Details
-
NON_EXISTENT_ID
private static final int NON_EXISTENT_ID- See Also:
-
methodName
-
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
-
TransportState
protected TransportState(NettyClientHandler handler, io.netty.channel.EventLoop eventLoop, int maxMessageSize, StatsTraceContext statsTraceCtx, TransportTracer transportTracer, String methodName, CallOptions options)
-
-
Method Details
-
id
public int id()Description copied from interface:StreamIdHolderReturns the id.- Specified by:
idin interfaceStreamIdHolder
-
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 NettyHttp2Streamfor this stream. This must be called in the context of the transport thread. -
http2Stream
Gets the underlying NettyHttp2Streamfor this stream. -
statusFromFailedFuture
Intended to be overridden by NettyClientTransport, which has more information about failures. May only be called from event loop. -
http2ProcessingFailed
Description copied from class:Http2ClientStreamTransportStateCalled to process a failure in HTTP/2 processing. It should notify the transport to cancel the stream and calltransportReportStatus().- Specified by:
http2ProcessingFailedin classHttp2ClientStreamTransportState
-
onWriteFrameData
private void onWriteFrameData(io.netty.channel.ChannelFuture future, int numMessages, int numBytes) -
runOnTransportThread
- Specified by:
runOnTransportThreadin interfaceApplicationThreadDeframerListener.TransportExecutor
-
bytesRead
public void bytesRead(int processedBytes) Description copied from interface:MessageDeframer.ListenerCalled 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:
bytesReadin interfaceMessageDeframer.Listener- Parameters:
processedBytes- the number of bytes read from the deframer's input source.
-
deframeFailed
Description copied from interface:MessageDeframer.ListenerCalled when aMessageDeframer.deframe(ReadableBuffer)operation failed.- Specified by:
deframeFailedin interfaceMessageDeframer.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:
tagin interfaceStreamIdHolder
-