Shekharrajak commented on code in PR #22835:
URL: https://github.com/apache/kafka/pull/22835#discussion_r3667529827
##########
server-common/src/main/java/org/apache/kafka/server/share/persister/PersisterStateManager.java:
##########
@@ -183,6 +185,23 @@ public void setGenerateCallback(Runnable generateCallback)
{
this.generateCallback = generateCallback;
}
+ // Groups a combined response's results into topicId -> partition ->
result for O(1) per-partition lookup.
+ private static <T, P> Map<Uuid, Map<Integer, P>> indexByTopicPartition(
+ List<T> results,
+ Function<T, Uuid> topicId,
+ Function<T, List<P>> partitions,
+ ToIntFunction<P> partition
+ ) {
+ Map<Uuid, Map<Integer, P>> index = new HashMap<>();
+ for (T result : results) {
Review Comment:
Flattens results -> partitions into a nested HashMap for O(1) per-partition
lookup. Generic so any RPC handler can reuse it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]