rkhachatryan commented on code in PR #23146:
URL: https://github.com/apache/flink/pull/23146#discussion_r1285261372


##########
flink-runtime/src/main/java/org/apache/flink/runtime/state/SharedStateRegistry.java:
##########
@@ -106,4 +108,12 @@ StreamStateHandle registerReference(
     void registerAllAfterRestored(CompletedCheckpoint checkpoint, RestoreMode 
mode);
 
     void checkpointCompleted(long checkpointId);
+
+    /** Create a unique key based on physical id. */
+    static SharedStateRegistryKey 
createSharedStateRegistryKey(StreamStateHandle handle) {
+        String keyString = handle.getStreamStateHandleID().getKeyString();
+        // key strings tend to be longer, so we use the MD5 of the key string 
to save memory
+        return new SharedStateRegistryKey(
+                
UUID.nameUUIDFromBytes(keyString.getBytes(StandardCharsets.UTF_8)).toString());
+    }

Review Comment:
   Static factory methods are usually placed in the type which instance they 
create,
   so how about moving this method to `SharedStateRegistryKey`?
   And naming it something like `SharedStateRegistryKey.forStreamStateHandle` ?



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to