Class VeniceChunkedResponse
java.lang.Object
com.linkedin.venice.router.streaming.VeniceChunkedResponse
This is the class to talk to
VeniceChunkedWriteHandler to send back partial response.
Here is the high-level idea about how Streaming works in Venice:
1. When VenicePathParser recognizes the incoming request
support streaming by looking at the streaming header: HttpConstants.VENICE_STREAMING, it
will create a VeniceChunkedResponse associated with VenicePath;
2. After scattering, VeniceDispatcher will send the response
received from Venice SN to write(ByteBuf) to Venice Client;
3. In the meantime, VeniceDispatcher will also return an
empty response to the following processing logic;
4. When VeniceResponseAggregator gathers all the response, it will send a SuccessfulStreamingResponse
to the following Netty handler, which is VeniceChunkedWriteHandler, which will delegate
VeniceChunkedResponse to decide how to process every response;
5. For SuccessfulStreamingResponse, VeniceChunkedResponse will just skip this response,
but send back LastHttpContent to indicate the end of the response, and for other error response,
VeniceChunkedResponse will send back a LastHttpContent containing a StreamingFooterRecordV1
to include all the details about the error;-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final io.netty.buffer.ByteBufprotected static final RedundantExceptionFilter -
Constructor Summary
ConstructorsConstructorDescriptionVeniceChunkedResponse(String storeName, RequestType requestType, io.netty.channel.ChannelHandlerContext ctx, VeniceChunkedWriteHandler handler, RouterStats<AggRouterHttpRequestStats> routerStats, String clientComputeHeader) -
Method Summary
Modifier and TypeMethodDescriptionwrite(io.netty.buffer.ByteBuf buffer) write(io.netty.buffer.ByteBuf buffer, CompressionStrategy compression) This function is used to send a data chunk to Venice Client.write(io.netty.buffer.ByteBuf byteBuf, CompressionStrategy compression, StreamingCallback<Long> callback) This function is used to send a data chunk to Venice Client, and when it is completed, 'callback' will be invoked.
-
Field Details
-
EMPTY_BYTE_BUF
public static final io.netty.buffer.ByteBuf EMPTY_BYTE_BUF -
REDUNDANT_LOGGING_FILTER
-
-
Constructor Details
-
VeniceChunkedResponse
public VeniceChunkedResponse(String storeName, RequestType requestType, io.netty.channel.ChannelHandlerContext ctx, VeniceChunkedWriteHandler handler, RouterStats<AggRouterHttpRequestStats> routerStats, String clientComputeHeader)
-
-
Method Details
-
write
-
write
public CompletableFuture<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 CompletableFuture<Long> write(io.netty.buffer.ByteBuf byteBuf, CompressionStrategy compression, StreamingCallback<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:
-