Package com.linkedin.venice.meta
Class Partition
- java.lang.Object
-
- com.linkedin.venice.meta.Partition
-
public class Partition extends java.lang.Object
Class defines the partition in Venice.Partition is a logic unit to distribute the data in Venice cluster. Each resource(Store Version) will be assigned to a set of partition so that data in this resource will be distributed averagely in ideal. Each partition contains 1 or multiple replica which hold the same data in ideal.
In Helix Full-auto model, Helix manager is responsible to assign partitions to nodes. So here partition is read-only. In the future, if Venice need more flexibility to manage cluster, some update/delete methods could be added here.
-
-
Constructor Summary
Constructors Constructor Description Partition(int id, java.util.EnumMap<HelixState,java.util.List<Instance>> helixStateToInstancesMap, java.util.EnumMap<ExecutionStatus,java.util.List<Instance>> executionStatusToInstancesMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
java.util.EnumMap<ExecutionStatus,java.util.List<Instance>>
getAllInstancesByExecutionStatus()
java.util.Map<HelixState,java.util.List<Instance>>
getAllInstancesByHelixState()
java.util.Set<Instance>
getAllInstancesSet()
java.util.List<Instance>
getErrorInstances()
ExecutionStatus
getExecutionStatusByInstanceId(java.lang.String instanceId)
HelixState
getHelixStateByInstanceId(java.lang.String instanceId)
Find the status of given instance in this partition.int
getId()
java.util.List<Instance>
getInstancesInState(HelixState state)
java.util.List<Instance>
getInstancesInState(ExecutionStatus state)
java.util.Map<Instance,HelixState>
getInstanceToHelixStateMap()
Instance
getLeaderInstance()
int
getNumOfTotalInstances()
java.util.List<Instance>
getReadyToServeInstances()
java.util.List<Instance>
getWorkingInstances()
int
hashCode()
java.lang.String
toString()
Partition
withRemovedInstance(java.lang.String instanceId)
Remove the given instance from this partition.
-
-
-
Constructor Detail
-
Partition
public Partition(int id, java.util.EnumMap<HelixState,java.util.List<Instance>> helixStateToInstancesMap, java.util.EnumMap<ExecutionStatus,java.util.List<Instance>> executionStatusToInstancesMap)
-
-
Method Detail
-
getInstancesInState
public java.util.List<Instance> getInstancesInState(ExecutionStatus state)
-
getInstancesInState
public java.util.List<Instance> getInstancesInState(HelixState state)
-
getReadyToServeInstances
public java.util.List<Instance> getReadyToServeInstances()
-
getWorkingInstances
public java.util.List<Instance> getWorkingInstances()
-
getErrorInstances
public java.util.List<Instance> getErrorInstances()
-
getLeaderInstance
public Instance getLeaderInstance()
-
getAllInstancesSet
public java.util.Set<Instance> getAllInstancesSet()
-
getAllInstancesByHelixState
public java.util.Map<HelixState,java.util.List<Instance>> getAllInstancesByHelixState()
-
getAllInstancesByExecutionStatus
public java.util.EnumMap<ExecutionStatus,java.util.List<Instance>> getAllInstancesByExecutionStatus()
-
getInstanceToHelixStateMap
public java.util.Map<Instance,HelixState> getInstanceToHelixStateMap()
-
getHelixStateByInstanceId
public HelixState getHelixStateByInstanceId(java.lang.String instanceId)
Find the status of given instance in this partition.
-
getExecutionStatusByInstanceId
public ExecutionStatus getExecutionStatusByInstanceId(java.lang.String instanceId)
-
getNumOfTotalInstances
public int getNumOfTotalInstances()
-
withRemovedInstance
public Partition withRemovedInstance(java.lang.String instanceId)
Remove the given instance from this partition. As partition is an immutable object, so we return a new partition after removing.
-
getId
public int getId()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-