You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "XComp (via GitHub)" <gi...@apache.org> on 2023/08/30 12:08:29 UTC

[GitHub] [flink] XComp commented on a diff in pull request #23327: [FLINK-32994][runtime] Adds human-readable toString implementations to the LeaderElectionDriver classes

XComp commented on code in PR #23327:
URL: https://github.com/apache/flink/pull/23327#discussion_r1310169296


##########
flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java:
##########
@@ -610,12 +611,41 @@ FileSystemStateStorageHelper<T> createFileSystemStateStorage(
                 prefix);
     }
 
-    /** Creates a ZooKeeper path of the form "/a/b/.../z". */
-    public static String generateZookeeperPath(String... paths) {
-        return Arrays.stream(paths)
+    /** Creates an absolute ZooKeeper path of the form "/a/b/.../z". */
+    public static String generateAbsoluteZookeeperPath(String... pathElements) {
+        return generateZookeeperPath("/", pathElements);
+    }
+
+    /** Creates a relative ZooKeeper path of the form "a/b/.../z". */
+    public static String generateRelativeZooKeeperPath(String... pathElements) {
+        return generateZookeeperPath("", pathElements);
+    }
+
+    private static String generateZookeeperPath(String prefix, String... pathElements) {
+        return Arrays.stream(pathElements)
                 .map(ZooKeeperUtils::trimSlashes)
                 .filter(s -> !s.isEmpty())
-                .collect(Collectors.joining("/", "/", ""));
+                .collect(Collectors.joining("/", prefix, ""));
+    }
+
+    private static boolean isAbsolutePath(String path) {
+        return path.startsWith("/");
+    }
+
+    /** Extracts the parent path from the given {@code path}. */
+    public static String extractParentPath(String path) {

Review Comment:
   yes



-- 
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-unsubscribe@flink.apache.org

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