Package com.linkedin.venice.router.api
Class VeniceResponseAggregator
- java.lang.Object
-
- com.linkedin.venice.router.api.VeniceResponseAggregator
-
- All Implemented Interfaces:
ResponseAggregatorFactory<BasicFullHttpRequest,io.netty.handler.codec.http.FullHttpResponse>
public class VeniceResponseAggregator extends java.lang.Object implements ResponseAggregatorFactory<BasicFullHttpRequest,io.netty.handler.codec.http.FullHttpResponse>
VeniceResponseAggregator
aggregates the sub-responses returned by storage node for a multi-get request.
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Map<java.lang.CharSequence,java.lang.String>
COMPUTE_VALID_HEADER_MAP
static java.util.Map<java.lang.CharSequence,java.lang.String>
MULTI_GET_VALID_HEADER_MAP
-
Constructor Summary
Constructors Constructor Description VeniceResponseAggregator(RouterStats<AggRouterHttpRequestStats> routerStats, java.util.Optional<MetaStoreShadowReader> metaStoreShadowReaderOptional)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.netty.handler.codec.http.FullHttpResponse
buildResponse(BasicFullHttpRequest request, Metrics metrics, java.util.List<io.netty.handler.codec.http.FullHttpResponse> gatheredResponses)
void
initHelixGroupSelector(HelixGroupSelector helixGroupSelector)
protected io.netty.handler.codec.http.FullHttpResponse
processComputeResponses(java.util.List<io.netty.handler.codec.http.FullHttpResponse> responses, java.lang.String storeName, java.util.Optional<java.util.Map<java.lang.CharSequence,java.lang.String>> optionalHeaders)
protected io.netty.handler.codec.http.FullHttpResponse
processMultiGetResponses(java.util.List<io.netty.handler.codec.http.FullHttpResponse> responses, java.lang.String storeName, int version, java.util.Optional<java.util.Map<java.lang.CharSequence,java.lang.String>> optionalHeaders)
If a part of a multi-get request fails, the entire request should fail from the client's perspective.VeniceResponseAggregator
withComputeTardyThreshold(long timeout, java.util.concurrent.TimeUnit unit)
VeniceResponseAggregator
withMultiGetTardyThreshold(long timeout, java.util.concurrent.TimeUnit unit)
VeniceResponseAggregator
withSingleGetTardyThreshold(long timeout, java.util.concurrent.TimeUnit unit)
-
-
-
Constructor Detail
-
VeniceResponseAggregator
public VeniceResponseAggregator(RouterStats<AggRouterHttpRequestStats> routerStats, java.util.Optional<MetaStoreShadowReader> metaStoreShadowReaderOptional)
-
-
Method Detail
-
withSingleGetTardyThreshold
public VeniceResponseAggregator withSingleGetTardyThreshold(long timeout, java.util.concurrent.TimeUnit unit)
-
withMultiGetTardyThreshold
public VeniceResponseAggregator withMultiGetTardyThreshold(long timeout, java.util.concurrent.TimeUnit unit)
-
withComputeTardyThreshold
public VeniceResponseAggregator withComputeTardyThreshold(long timeout, java.util.concurrent.TimeUnit unit)
-
initHelixGroupSelector
public void initHelixGroupSelector(HelixGroupSelector helixGroupSelector)
-
buildResponse
@Nonnull public io.netty.handler.codec.http.FullHttpResponse buildResponse(@Nonnull BasicFullHttpRequest request, Metrics metrics, @Nonnull java.util.List<io.netty.handler.codec.http.FullHttpResponse> gatheredResponses)
- Specified by:
buildResponse
in interfaceResponseAggregatorFactory<BasicFullHttpRequest,io.netty.handler.codec.http.FullHttpResponse>
-
processComputeResponses
protected io.netty.handler.codec.http.FullHttpResponse processComputeResponses(java.util.List<io.netty.handler.codec.http.FullHttpResponse> responses, java.lang.String storeName, java.util.Optional<java.util.Map<java.lang.CharSequence,java.lang.String>> optionalHeaders)
-
processMultiGetResponses
protected io.netty.handler.codec.http.FullHttpResponse processMultiGetResponses(java.util.List<io.netty.handler.codec.http.FullHttpResponse> responses, java.lang.String storeName, int version, java.util.Optional<java.util.Map<java.lang.CharSequence,java.lang.String>> optionalHeaders)
If a part of a multi-get request fails, the entire request should fail from the client's perspective.- Parameters:
responses
- Subset of responses from the SN to be concatenated to form the response to the client (guaranteed not empty).- Returns:
- The concatenated response that should be sent to the client along with some content-related headers.
-
-