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
It's perfectly valid for an implementation to ignore some members, as long as the above guarantees are met.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
  • 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 partitions
      sortedPartitionIds - a sorted list of partition IDs
      replicationFactor - the replication factor for each partition
      Returns:
      a set of distributed partitions, each specifying which members they belong to