Package com.github.ambry.clustermap
Interface PartitionId
-
- All Superinterfaces:
java.lang.Comparable<PartitionId>
,Resource
public interface PartitionId extends Resource, java.lang.Comparable<PartitionId>
A PartitionId consists of one or moreReplicaId
s. A PartitionId is uniquely identified by an ID.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description byte[]
getBytes()
Serializes the ID of this PartitionId to bytes.java.lang.String
getPartitionClass()
PartitionState
getPartitionState()
Gets the state of this PartitionId.java.util.List<? extends ReplicaId>
getReplicaIds()
Gets Replicas that comprise this PartitionId.java.util.List<? extends ReplicaId>
getReplicaIdsByState(ReplicaState state, java.lang.String dcName)
Gets Replicas from specified datacenter that are in required state.default java.lang.String
getResourceName()
boolean
isEqual(java.lang.String partitionId)
Compares the PartitionId to a string representation of another PartitionIdjava.lang.String
toPathString()
Returns a strictly numericalString
that uniquely represents thePartitionId
.java.lang.String
toString()
Returns aString
that uniquely represents thePartitionId
.-
Methods inherited from interface com.github.ambry.clustermap.Resource
getSnapshot
-
-
-
-
Method Detail
-
getBytes
byte[] getBytes()
Serializes the ID of this PartitionId to bytes.- Returns:
- byte-serialized ID of this PartitionId.
-
getReplicaIds
java.util.List<? extends ReplicaId> getReplicaIds()
Gets Replicas that comprise this PartitionId.- Returns:
- list of the Replicas that comprise this PartitionId.
-
getReplicaIdsByState
java.util.List<? extends ReplicaId> getReplicaIdsByState(ReplicaState state, java.lang.String dcName)
Gets Replicas from specified datacenter that are in required state.- Parameters:
state
- theReplicaState
dcName
- the name of datacenter from which the replica should come. If null, choose replicas from all datacenters.- Returns:
- list of Replicas that satisfy requirement.
-
getPartitionState
PartitionState getPartitionState()
Gets the state of this PartitionId.- Returns:
- state of this PartitionId.
-
isEqual
boolean isEqual(java.lang.String partitionId)
Compares the PartitionId to a string representation of another PartitionId- Parameters:
partitionId
- The string form of the partition that needs to be compared against- Returns:
- True, if the partitions match, false otherwise
-
toString
java.lang.String toString()
Returns aString
that uniquely represents thePartitionId
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- String representation of the
PartitionId
.
-
toPathString
java.lang.String toPathString()
Returns a strictly numericalString
that uniquely represents thePartitionId
.- Returns:
- Strictly numerical string representation of the
PartitionId
.
-
getPartitionClass
java.lang.String getPartitionClass()
- Returns:
- the partition class that this partition belongs to
-
getResourceName
default java.lang.String getResourceName()
- Returns:
- the resource name which this partition belongs to. Can be null if resource is not defined or applicable.
-
-