Class VeniceChunkedResponse
- java.lang.Object
-
- com.linkedin.venice.router.streaming.VeniceChunkedResponse
-
public class VeniceChunkedResponse extends java.lang.Object
This is the class to talk toVeniceChunkedWriteHandler
to send back partial response. Here is the high-level idea about how Streaming works in Venice: 1. WhenVenicePathParser
recognizes the incoming request support streaming by looking at the streaming header:HttpConstants.VENICE_STREAMING
, it will create aVeniceChunkedResponse
associated withVenicePath
; 2. After scattering,VeniceDispatcher
will send the response received from Venice SN towrite(ByteBuf)
to Venice Client; 3. In the meantime,VeniceDispatcher
will also return an empty response to the following processing logic; 4. WhenVeniceResponseAggregator
gathers all the response, it will send aSuccessfulStreamingResponse
to the following Netty handler, which isVeniceChunkedWriteHandler
, which will delegateVeniceChunkedResponse
to decide how to process every response; 5. ForSuccessfulStreamingResponse
,VeniceChunkedResponse
will just skip this response, but send backLastHttpContent
to indicate the end of the response, and for other error response,VeniceChunkedResponse
will send back aLastHttpContent
containing aStreamingFooterRecordV1
to include all the details about the error;
-
-
Field Summary
Fields Modifier and Type Field Description static io.netty.buffer.ByteBuf
EMPTY_BYTE_BUF
protected static RedundantExceptionFilter
REDUNDANT_LOGGING_FILTER
-
Constructor Summary
Constructors Constructor Description VeniceChunkedResponse(java.lang.String storeName, RequestType requestType, io.netty.channel.ChannelHandlerContext ctx, VeniceChunkedWriteHandler handler, RouterStats<AggRouterHttpRequestStats> routerStats, java.util.Optional<java.util.Map<java.lang.CharSequence,java.lang.String>> optionalHeaders)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Long>
write(io.netty.buffer.ByteBuf buffer)
java.util.concurrent.CompletableFuture<java.lang.Long>
write(io.netty.buffer.ByteBuf buffer, CompressionStrategy compression)
This function is used to send a data chunk to Venice Client.java.util.concurrent.CompletableFuture<java.lang.Long>
write(io.netty.buffer.ByteBuf byteBuf, CompressionStrategy compression, StreamingCallback<java.lang.Long> callback)
This function is used to send a data chunk to Venice Client, and when it is completed, 'callback' will be invoked.
-
-
-
Field Detail
-
EMPTY_BYTE_BUF
public static final io.netty.buffer.ByteBuf EMPTY_BYTE_BUF
-
REDUNDANT_LOGGING_FILTER
protected static final RedundantExceptionFilter REDUNDANT_LOGGING_FILTER
-
-
Constructor Detail
-
VeniceChunkedResponse
public VeniceChunkedResponse(java.lang.String storeName, RequestType requestType, io.netty.channel.ChannelHandlerContext ctx, VeniceChunkedWriteHandler handler, RouterStats<AggRouterHttpRequestStats> routerStats, java.util.Optional<java.util.Map<java.lang.CharSequence,java.lang.String>> optionalHeaders)
-
-
Method Detail
-
write
public java.util.concurrent.CompletableFuture<java.lang.Long> write(io.netty.buffer.ByteBuf buffer)
-
write
public java.util.concurrent.CompletableFuture<java.lang.Long> write(io.netty.buffer.ByteBuf buffer, CompressionStrategy compression)
This function is used to send a data chunk to Venice Client.- Parameters:
buffer
-compression
-
-
write
public java.util.concurrent.CompletableFuture<java.lang.Long> write(io.netty.buffer.ByteBuf byteBuf, CompressionStrategy compression, StreamingCallback<java.lang.Long> callback)
This function is used to send a data chunk to Venice Client, and when it is completed, 'callback' will be invoked.- Parameters:
byteBuf
-compression
-callback
-- Returns:
-
-