Package io.atomix.raft.partition
Interface PartitionDistributor
- All Known Implementing Classes:
RoundRobinPartitionDistributor
public interface PartitionDistributor
Maps a list of partitions to a set of members, based on the given replication factor.
Implementations of this class must guarantee that the distribution is complete, that is:
- The number of members a partition belongs to is equal to the replication factor
- All partitions are replicated
-
Method Summary
Modifier and TypeMethodDescriptiondistributePartitions(Set<MemberId> clusterMembers, List<PartitionId> sortedPartitionIds, int replicationFactor) Provides the partition distribution based on the given list of partition IDs, cluster members, and the replication factor.
-
Method Details
-
distributePartitions
Set<PartitionMetadata> distributePartitions(Set<MemberId> clusterMembers, List<PartitionId> sortedPartitionIds, int replicationFactor) Provides the partition distribution based on the given list of partition IDs, cluster members, and the replication factor. The set of partitions returned is guaranteed to be correctly replicated.- Parameters:
clusterMembers- the set of members that can own partitionssortedPartitionIds- a sorted list of partition IDsreplicationFactor- the replication factor for each partition- Returns:
- a set of distributed partitions, each specifying which members they belong to
-