lhotari commented on code in PR #25868:
URL: https://github.com/apache/pulsar/pull/25868#discussion_r3301735472


##########
pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/functions/FunctionUtils.java:
##########
@@ -42,6 +46,17 @@ public class FunctionUtils {
 
     private static final String PULSAR_IO_SERVICE_NAME = "pulsar-io.yaml";
 
+    /**
+     * Computes MD5 digest of a file as lower-case hex (for function archive 
identity on reload).
+     */
+    public static String computeArchiveMd5Hex(Path path) throws IOException {
+        return calculateMd5Hex(path.toAbsolutePath().normalize().toFile());
+    }
+
+    private static String calculateMd5Hex(File file) throws IOException {
+        return HexFormat.of().formatHex(FileUtils.calculateMd5sum(file));

Review Comment:
   The common methods like this could be extracted to `SharedUtils` which would 
go into `org.apache.pulsar.functions.utils` package. Adding more utilities to 
`pulsar-common` should be avoided, so this would go into 
`pulsar-function-utils`.
   Refactoring to avoid all existing duplication would require broader changes. 
That's why it's better to leave it out of the scope of this PR.



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