private void addPartitionsToAssignment(
        TopicMetadata topicMetadata,
        Map<Uuid, Set<Integer>> memberAssignment
    ) {
        int start = topicMetadata.nextRange;
        int quota = topicMetadata.minQuota;

        // Adjust quota to account for extra partitions if available.
        if (topicMetadata.extraPartitions > 0) {
            quota++;
            topicMetadata.extraPartitions--;
        }

        // Calculate the end using the quota.
        int end = Math.min(start + quota, topicMetadata.numPartitions);

        topicMetadata.nextRange = end;

        if (start < end) {
            memberAssignment.put(topicMetadata.topicId, new RangeSet(start, end));
        }
    }
Assigns a range of partitions to the specified topic based on the provided metadata.

@param topicMetadata         Metadata containing the topic details, including the number of partitions,
                             the next range to assign, minQuota, and extra partitions.
@param memberAssignment      Map from topic Id to the set of assigned partition Ids.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/assignor/RangeAssignor.java