Class FixedPartitionDistributor
java.lang.Object
io.camunda.zeebe.broker.partitioning.distribution.FixedPartitionDistributor
- All Implemented Interfaces:
PartitionDistributor
A
PartitionDistributor implementation which takes in a provided, fixed mapping which
already describes which member maps to which partitions, and returns the appropriate set of
distributed partitions on demand.
See FixedPartitionDistributorBuilder to build a new instance. The class is
intentionally not publicly instantiable to reduce the risk of configuration errors.
-
Method Summary
Modifier and TypeMethodDescriptiondistributePartitions(Set<MemberId> clusterMembers, List<PartitionId> sortedPartitionIds, int replicationFactor) Generates a partition distribution based on the initial configuration, using the input here mostly for validation.
-
Method Details
-
distributePartitions
public Set<PartitionMetadata> distributePartitions(Set<MemberId> clusterMembers, List<PartitionId> sortedPartitionIds, int replicationFactor) Generates a partition distribution based on the initial configuration, using the input here mostly for validation.- Specified by:
distributePartitionsin interfacePartitionDistributor- 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, containing the set of members to which they belong to
- Throws:
IllegalStateException- if any of the configured members are not found in the set ofclusterMembers; this implies that these members do not exist in the clusterIllegalStateException- if at least one of the partitions insortedPartitionIdsis not distributed over any membersIllegalStateException- if at least one of the partitions insortedPartitionIdsdoes not have exactlyreplicationFactormembers
-