Package com.linkedin.venice.helix
Class HelixInstanceConfigRepository
- java.lang.Object
-
- com.linkedin.venice.helix.HelixInstanceConfigRepository
-
- All Implemented Interfaces:
VeniceResource
,org.apache.helix.api.listeners.InstanceConfigChangeListener
public class HelixInstanceConfigRepository extends java.lang.Object implements VeniceResource, org.apache.helix.api.listeners.InstanceConfigChangeListener
This repository is used to store the instance config per instance. So far it only stores group/zone info, and we could add more if necessary in the future.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_INSTANCE_GROUP_ID
static java.lang.String
GROUP_FIELD_NAME_IN_DOMAIN
static java.lang.String
ZONE_FIELD_NAME_IN_DOMAIN
-
Constructor Summary
Constructors Constructor Description HelixInstanceConfigRepository(SafeHelixManager manager, boolean useGroupFieldInDomain)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
int
getGroupCount()
int
getInstanceGroupId(java.lang.String instanceId)
java.util.Map<java.lang.String,java.lang.Integer>
getInstanceGroupIdMapping()
void
onInstanceConfigChange(java.util.List<org.apache.helix.model.InstanceConfig> instanceConfigs, org.apache.helix.NotificationContext context)
This function will assign a unique group id per group.void
refresh()
-
-
-
Field Detail
-
DEFAULT_INSTANCE_GROUP_ID
public static final int DEFAULT_INSTANCE_GROUP_ID
- See Also:
- Constant Field Values
-
GROUP_FIELD_NAME_IN_DOMAIN
public static final java.lang.String GROUP_FIELD_NAME_IN_DOMAIN
- See Also:
- Constant Field Values
-
ZONE_FIELD_NAME_IN_DOMAIN
public static final java.lang.String ZONE_FIELD_NAME_IN_DOMAIN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HelixInstanceConfigRepository
public HelixInstanceConfigRepository(SafeHelixManager manager, boolean useGroupFieldInDomain)
-
-
Method Detail
-
refresh
public void refresh()
- Specified by:
refresh
in interfaceVeniceResource
-
clear
public void clear()
- Specified by:
clear
in interfaceVeniceResource
-
getInstanceGroupId
public int getInstanceGroupId(java.lang.String instanceId)
-
getInstanceGroupIdMapping
public java.util.Map<java.lang.String,java.lang.Integer> getInstanceGroupIdMapping()
-
getGroupCount
public int getGroupCount()
-
onInstanceConfigChange
public void onInstanceConfigChange(java.util.List<org.apache.helix.model.InstanceConfig> instanceConfigs, org.apache.helix.NotificationContext context)
This function will assign a unique group id per group. If there is no group defined for some instances, this function will use empty string as the default.- Specified by:
onInstanceConfigChange
in interfaceorg.apache.helix.api.listeners.InstanceConfigChangeListener
-
-