gaurav-narula commented on code in PR #24320:
URL: https://github.com/apache/kafka/pull/24320#discussion_r4671483745


##########
metadata/src/main/java/org/apache/kafka/image/TopicImage.java:
##########
@@ -34,7 +36,16 @@
  *
  * This class is thread-safe.
  */
-public record TopicImage(String name, Uuid id, Map<Integer, 
PartitionRegistration> partitions) {
+public record TopicImage(String name,
+                         Uuid id,
+                         String mirrorName,
+                         byte desiredMirrorState,
+                         Map<Integer, PartitionRegistration> partitions) {
+
+    public TopicImage(String name, Uuid id, Map<Integer, 
PartitionRegistration> partitions) {
+        this(name, id, null, MirrorPartitionState.UNKNOWN.value(), partitions);

Review Comment:
   I think `UNKNOWN` is the safest value to persist when writing the image and 
I'd like to avoid introducing a new state if possible. I figured we could do 
better with types here. I've made some changes so that the in-memory state uses 
Optional#empty to represent a missing mirror. The changes required replacing a 
`record` with a concrete `final class` as I wanted to have a constructor that 
accepts `null` but have an accessor for the field that returns an `Optional`



-- 
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]

Reply via email to