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.EventLoop
private final NettyClientHandler
private io.netty.handler.codec.http2.Http2Stream
private int
private final String
private static final int
private io.perfmark.Tag
Fields inherited from class io.grpc.internal.AbstractStream.TransportState
DEFAULT_ONREADY_THRESHOLD
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
TransportState
(NettyClientHandler handler, io.netty.channel.EventLoop eventLoop, int maxMessageSize, StatsTraceContext statsTraceCtx, TransportTracer transportTracer, String methodName, CallOptions options) -
Method Summary
Modifier and TypeMethodDescriptionvoid
bytesRead
(int processedBytes) Called when the given number of bytes has been read from the input source of the deframer.void
deframeFailed
(Throwable cause) Called when aMessageDeframer.deframe(ReadableBuffer)
operation failed.protected void
http2ProcessingFailed
(Status status, boolean stopDelivery, Metadata trailers) Called to process a failure in HTTP/2 processing.io.netty.handler.codec.http2.Http2Stream
Gets the underlying NettyHttp2Stream
for this stream.int
id()
Returns the id.(package private) boolean
private void
onWriteFrameData
(io.netty.channel.ChannelFuture future, int numMessages, int numBytes) void
void
setHttp2Stream
(io.netty.handler.codec.http2.Http2Stream http2Stream) Sets the underlying NettyHttp2Stream
for this stream.void
setId
(int id) (package private) void
Marks the stream state as if it had never existed.protected abstract Status
statusFromFailedFuture
(io.netty.channel.ChannelFuture f) Intended to be overridden by NettyClientTransport, which has more information about failures.final io.perfmark.Tag
tag()
(package private) void
transportDataReceived
(io.netty.buffer.ByteBuf frame, boolean endOfStream) (package private) void
transportHeadersReceived
(io.netty.handler.codec.http2.Http2Headers headers, boolean endOfStream) Methods inherited from class io.grpc.internal.Http2ClientStreamTransportState
transportDataReceived, transportHeadersReceived, transportTrailersReceived
Methods inherited from class io.grpc.internal.AbstractClientStream.TransportState
deframerClosed, inboundDataReceived, inboundHeadersReceived, inboundTrailersReceived, isOutboundClosed, listener, setListener, transportReportStatus, transportReportStatus
Methods 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:StreamIdHolder
Returns the id.- Specified by:
id
in 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 NettyHttp2Stream
for this stream. This must be called in the context of the transport thread. -
http2Stream
Gets the underlying NettyHttp2Stream
for 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:Http2ClientStreamTransportState
Called to process a failure in HTTP/2 processing. It should notify the transport to cancel the stream and calltransportReportStatus()
.- Specified by:
http2ProcessingFailed
in classHttp2ClientStreamTransportState
-
onWriteFrameData
private void onWriteFrameData(io.netty.channel.ChannelFuture future, int numMessages, int numBytes) -
runOnTransportThread
- Specified by:
runOnTransportThread
in interfaceApplicationThreadDeframerListener.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 interfaceMessageDeframer.Listener
- Parameters:
processedBytes
- the number of bytes read from the deframer's input source.
-
deframeFailed
Description copied from interface:MessageDeframer.Listener
Called when aMessageDeframer.deframe(ReadableBuffer)
operation failed.- Specified by:
deframeFailed
in 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:
tag
in interfaceStreamIdHolder
-