GrantPSpencer commented on code in PR #2607:
URL: https://github.com/apache/helix/pull/2607#discussion_r1330835034
##########
meta-client/src/main/java/org/apache/helix/metaclient/impl/zk/util/ZkMetaClientUtil.java:
##########
@@ -358,4 +358,25 @@ public static MetaClientException.ReturnCode
translateZooKeeperCodeToMetaClientC
return MetaClientException.ReturnCode.DB_USER_ERROR;
}
}
+
+ public static String getZkParentPath(String path) {
+ if (path.equals("/")) {
+ return null;
+ }
+
+ int idx = path.lastIndexOf('/');
+ return idx == 0 ? "/" : path.substring(0, idx);
+ }
+
+ // Splits a path into the paths for each node along the way.
+ // /a/b/c --> /a/b/c, /a/b, /a
+ public static List<String> separateIntoUniqueNodePaths(String path) {
Review Comment:
I think this would take /a/b/c and return:
/c, /b/c,and /a/b/c
I've taken this algo and made a small adjustment to 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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]