Package io.hekate.partition
Interface Partition
-
- All Superinterfaces:
Comparable<Partition>
- All Known Implementing Classes:
DefaultPartition
public interface Partition extends Comparable<Partition>
Data partition.This interface provides an information about a
primary
node and itsbackup
nodes that were selected by apartition mapper
based on its cluster topology view.Note that all instances of this interface must be immutable and must not change once obtained from a
PartitionMapper
.- See Also:
PartitionMapper.map(Object)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description List<ClusterNode>
backupNodes()
Returns the backup node set of this partition.default int
compareTo(Partition o)
Compares this partition with the specified one based onid()
value.default boolean
hasBackupNodes()
Returnstrue
if this partition hasbackupNodes()
.int
id()
Returns the partition identifier.default boolean
isPrimary(ClusterNode node)
Returnstrue
if the specified node is primary for this partition (seeprimaryNode()
).default boolean
isPrimary(ClusterNodeId node)
Returnstrue
if the specified node is primary for this partition (seeprimaryNode()
).List<ClusterNode>
nodes()
ClusterNode
primaryNode()
Returns the primary node that is assigned to this partition.ClusterTopology
topology()
Returns the cluster topology that this partition is mapped to.
-
-
-
Method Detail
-
id
int id()
Returns the partition identifier.- Returns:
- Partition identifier.
-
primaryNode
ClusterNode primaryNode()
Returns the primary node that is assigned to this partition.- Returns:
- Primary node.
-
backupNodes
List<ClusterNode> backupNodes()
Returns the backup node set of this partition.- Returns:
- Set of backup nodes or an empty set if there are no backup nodes.
-
nodes
List<ClusterNode> nodes()
- Returns:
- The set of all nodes that are mapped to this partition.
-
topology
ClusterTopology topology()
Returns the cluster topology that this partition is mapped to.- Returns:
- Cluster topology that this partition is mapped to.
-
isPrimary
default boolean isPrimary(ClusterNodeId node)
Returnstrue
if the specified node is primary for this partition (seeprimaryNode()
).- Parameters:
node
- Node identifier.- Returns:
true
if the specified node is primary for this partition (seeprimaryNode()
).
-
isPrimary
default boolean isPrimary(ClusterNode node)
Returnstrue
if the specified node is primary for this partition (seeprimaryNode()
).- Parameters:
node
- Node.- Returns:
true
if the specified node is primary for this partition (seeprimaryNode()
).
-
hasBackupNodes
default boolean hasBackupNodes()
Returnstrue
if this partition hasbackupNodes()
.- Returns:
true
if this partition hasbackupNodes()
.
-
-