Package io.grpc.internal
Interface ClientStream
- All Superinterfaces:
Stream
- All Known Implementing Classes:
AbstractClientStream
,FailingClientStream
,NoopClientStream
Extension of
Stream
to support client-side termination semantics.
An implementation doesn't need to be thread-safe. All methods are expected to execute quickly.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
appendTimeoutInsight
(InsightBuilder insight) Append information that will be included in the locally generated DEADLINE_EXCEEDED errors to the givenInsightBuilder
, in order to tell the user about the state of the stream so that they can better diagnose the cause of the error.void
Abnormally terminates the stream.Attributes that the stream holds at the current moment.void
Closes the local side of this stream and flushes any remaining messages.void
setAuthority
(String authority) Override the default authority withauthority
.void
setDeadline
(Deadline deadline) Sets the effective deadline of the RPC.void
setDecompressorRegistry
(DecompressorRegistry decompressorRegistry) Sets the registry to find a decompressor for the framer.void
setFullStreamDecompression
(boolean fullStreamDecompression) Enables full-stream decompression, allowing the client stream to useGzipInflatingBuffer
to decode inbound GZIP compressed streams.void
setMaxInboundMessageSize
(int maxSize) Sets the max size accepted from the remote endpoint.void
setMaxOutboundMessageSize
(int maxSize) Sets the max size sent to the remote endpoint.void
start
(ClientStreamListener listener) Starts stream.Methods inherited from interface io.grpc.internal.Stream
flush, isReady, optimizeForDirectExecutor, request, setCompressor, setMessageCompression, writeMessage
-
Method Details
-
cancel
Abnormally terminates the stream. After calling this method, no further messages will be sent or received, however it may still be possible to receive buffered messages for a brief period untilClientStreamListener.closed(io.grpc.Status, io.grpc.internal.ClientStreamListener.RpcProgress, io.grpc.Metadata)
is called. This method may only be called afterstart(io.grpc.internal.ClientStreamListener)
, but else is safe to be called at any time and multiple times and from any thread.- Parameters:
reason
- must be non-OK
-
halfClose
void halfClose()Closes the local side of this stream and flushes any remaining messages. After this is called, no further messages may be sent on this stream, but additional messages may be received until the remote end-point is closed. This method may only be called once, and only afterstart(io.grpc.internal.ClientStreamListener)
. -
setAuthority
Override the default authority withauthority
. May only be called beforestart(io.grpc.internal.ClientStreamListener)
. -
setFullStreamDecompression
void setFullStreamDecompression(boolean fullStreamDecompression) Enables full-stream decompression, allowing the client stream to useGzipInflatingBuffer
to decode inbound GZIP compressed streams. -
setDecompressorRegistry
Sets the registry to find a decompressor for the framer. May only be called beforestart(io.grpc.internal.ClientStreamListener)
. If the transport does not support compression, this may do nothing.- Parameters:
decompressorRegistry
- the registry of decompressors for decoding responses
-
start
Starts stream. This method may only be called once. It is safe to do latent initialization of the stream up untilstart(io.grpc.internal.ClientStreamListener)
is called.This method should not throw any exceptions.
- Parameters:
listener
- non-null
listener of stream events
-
setMaxInboundMessageSize
void setMaxInboundMessageSize(int maxSize) Sets the max size accepted from the remote endpoint. -
setMaxOutboundMessageSize
void setMaxOutboundMessageSize(int maxSize) Sets the max size sent to the remote endpoint. -
setDeadline
Sets the effective deadline of the RPC. -
getAttributes
Attributes getAttributes()Attributes that the stream holds at the current moment. Thread-safe and can be called at any time, although some attributes are there only after a certain point. -
appendTimeoutInsight
Append information that will be included in the locally generated DEADLINE_EXCEEDED errors to the givenInsightBuilder
, in order to tell the user about the state of the stream so that they can better diagnose the cause of the error.
-