Package com.linkedin.venice.router.api
Class VeniceDispatcher
- java.lang.Object
-
- com.linkedin.venice.router.api.VeniceDispatcher
-
- All Implemented Interfaces:
PartitionDispatchHandler<Instance,VenicePath,RouterKey,BasicHttpRequest,io.netty.handler.codec.http.FullHttpResponse,io.netty.handler.codec.http.HttpResponseStatus>
,PartitionDispatchHandler4<Instance,VenicePath,RouterKey>
public final class VeniceDispatcher extends java.lang.Object implements PartitionDispatchHandler4<Instance,VenicePath,RouterKey>
-
-
Constructor Summary
Constructors Constructor Description VeniceDispatcher(VeniceRouterConfig config, ReadOnlyStoreRepository storeRepository, RouterStats<AggRouterHttpRequestStats> perStoreStatsByType, io.tehuti.metrics.MetricsRepository metricsRepository, StorageNodeClient storageNodeClient, RouteHttpRequestStats routeHttpRequestStats, AggHostHealthStats aggHostHealthStats, RouterStats<AggRouterHttpRequestStats> routerStats)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected VeniceFullHttpResponse
buildPlainTextResponse(io.netty.handler.codec.http.HttpResponseStatus status, io.netty.buffer.ByteBuf content)
protected VeniceFullHttpResponse
buildResponse(VenicePath path, PortableHttpResponse serverResponse)
void
dispatch(Scatter<Instance,VenicePath,RouterKey> scatter, ScatterGatherRequest<Instance,RouterKey> part, VenicePath path, BasicHttpRequest request, AsyncPromise<Instance> hostSelected, AsyncPromise<java.util.List<io.netty.handler.codec.http.FullHttpResponse>> responseFuture, AsyncPromise<io.netty.handler.codec.http.HttpResponseStatus> retryFuture, AsyncFuture<java.lang.Void> timeoutFuture, java.util.concurrent.Executor executor)
Performs the work.PendingRequestThrottler
getPendingRequestThrottler()
For TEST ONLYRouteHttpRequestStats
getRouteHttpRequestStats()
For TEST ONLYprotected java.util.concurrent.CompletableFuture<PortableHttpResponse>
sendRequest(Instance storageNode, VenicePath path, AsyncPromise<io.netty.handler.codec.http.HttpResponseStatus> retryFuture)
void
stop()
-
-
-
Constructor Detail
-
VeniceDispatcher
public VeniceDispatcher(VeniceRouterConfig config, ReadOnlyStoreRepository storeRepository, RouterStats<AggRouterHttpRequestStats> perStoreStatsByType, io.tehuti.metrics.MetricsRepository metricsRepository, StorageNodeClient storageNodeClient, RouteHttpRequestStats routeHttpRequestStats, AggHostHealthStats aggHostHealthStats, RouterStats<AggRouterHttpRequestStats> routerStats)
-
-
Method Detail
-
dispatch
public void dispatch(@Nonnull Scatter<Instance,VenicePath,RouterKey> scatter, @Nonnull ScatterGatherRequest<Instance,RouterKey> part, @Nonnull VenicePath path, @Nonnull BasicHttpRequest request, @Nonnull AsyncPromise<Instance> hostSelected, @Nonnull AsyncPromise<java.util.List<io.netty.handler.codec.http.FullHttpResponse>> responseFuture, @Nonnull AsyncPromise<io.netty.handler.codec.http.HttpResponseStatus> retryFuture, @Nonnull AsyncFuture<java.lang.Void> timeoutFuture, @Nonnull java.util.concurrent.Executor executor) throws RouterException
Description copied from interface:PartitionDispatchHandler
Performs the work.- Specified by:
dispatch
in interfacePartitionDispatchHandler<Instance,VenicePath,RouterKey,BasicHttpRequest,io.netty.handler.codec.http.FullHttpResponse,io.netty.handler.codec.http.HttpResponseStatus>
- Parameters:
scatter
- The scatter-gather request.part
- The part of the scatter-gather request to be executed.path
- The derived path of this part of the request.request
- The original HttpRequest object.hostSelected
- To be completed with the actual host selected.responseFuture
- To be completed with HttpResponse parts.retryFuture
- To be completed with the HttpResponseStatus.timeoutFuture
- Listen for timeout.executor
- For executing work on context executor. A single thread is available for each request. For efficiency, the AsyncPromises should be completed on the context executor thread.- Throws:
RouterException
-
sendRequest
protected java.util.concurrent.CompletableFuture<PortableHttpResponse> sendRequest(Instance storageNode, VenicePath path, AsyncPromise<io.netty.handler.codec.http.HttpResponseStatus> retryFuture) throws RouterException
- Throws:
RouterException
-
buildResponse
protected VeniceFullHttpResponse buildResponse(VenicePath path, PortableHttpResponse serverResponse) throws java.io.IOException
- Throws:
java.io.IOException
-
getRouteHttpRequestStats
public RouteHttpRequestStats getRouteHttpRequestStats()
For TEST ONLY
-
getPendingRequestThrottler
public PendingRequestThrottler getPendingRequestThrottler()
For TEST ONLY
-
buildPlainTextResponse
protected VeniceFullHttpResponse buildPlainTextResponse(io.netty.handler.codec.http.HttpResponseStatus status, io.netty.buffer.ByteBuf content)
-
stop
public void stop()
-
-