Class HelixGroupSelector
- java.lang.Object
-
- com.linkedin.venice.router.api.routing.helix.HelixGroupSelector
-
- All Implemented Interfaces:
HelixGroupSelectionStrategy
public class HelixGroupSelector extends java.lang.Object implements HelixGroupSelectionStrategy
This class is a thin wrapper ofHelixInstanceConfigRepository
andHelixGroupSelectionStrategy
, and it will delegate all the related API calls to the corresponding objects. Besides that, this class is also in charge of emitting metrics for each Helix Group.
-
-
Constructor Summary
Constructors Constructor Description HelixGroupSelector(io.tehuti.metrics.MetricsRepository metricsRepository, HelixInstanceConfigRepository instanceConfigRepository, HelixGroupSelectionStrategyEnum strategyEnum, TimeoutProcessor timeoutProcessor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finishRequest(long requestId, int groupId)
Notify the corresponding Helix Group that the request is completed, and the implementation will decide whether any cleanup is required or not.int
getAvgGroupPendingRequest()
Get the average of the pending requests among all the groupsint
getGroupCount()
int
getInstanceGroupId(java.lang.String instanceId)
int
getMaxGroupPendingRequest()
Get the maximum of the pending requests among all the groupsint
getMinGroupPendingRequest()
Get the minimum of the pending requests among all the groupsint
selectGroup(long requestId, int groupNum)
Select a Helix Group for the current request.
-
-
-
Constructor Detail
-
HelixGroupSelector
public HelixGroupSelector(io.tehuti.metrics.MetricsRepository metricsRepository, HelixInstanceConfigRepository instanceConfigRepository, HelixGroupSelectionStrategyEnum strategyEnum, TimeoutProcessor timeoutProcessor)
-
-
Method Detail
-
getInstanceGroupId
public int getInstanceGroupId(java.lang.String instanceId)
-
getGroupCount
public int getGroupCount()
-
selectGroup
public int selectGroup(long requestId, int groupNum)
Description copied from interface:HelixGroupSelectionStrategy
Select a Helix Group for the current request.- Specified by:
selectGroup
in interfaceHelixGroupSelectionStrategy
-
finishRequest
public void finishRequest(long requestId, int groupId)
Description copied from interface:HelixGroupSelectionStrategy
Notify the corresponding Helix Group that the request is completed, and the implementation will decide whether any cleanup is required or not.- Specified by:
finishRequest
in interfaceHelixGroupSelectionStrategy
-
getMaxGroupPendingRequest
public int getMaxGroupPendingRequest()
Description copied from interface:HelixGroupSelectionStrategy
Get the maximum of the pending requests among all the groups- Specified by:
getMaxGroupPendingRequest
in interfaceHelixGroupSelectionStrategy
-
getMinGroupPendingRequest
public int getMinGroupPendingRequest()
Description copied from interface:HelixGroupSelectionStrategy
Get the minimum of the pending requests among all the groups- Specified by:
getMinGroupPendingRequest
in interfaceHelixGroupSelectionStrategy
-
getAvgGroupPendingRequest
public int getAvgGroupPendingRequest()
Description copied from interface:HelixGroupSelectionStrategy
Get the average of the pending requests among all the groups- Specified by:
getAvgGroupPendingRequest
in interfaceHelixGroupSelectionStrategy
-
-