narendly commented on a change in pull request #731: Add TrieRoutingData
constructor
URL: https://github.com/apache/helix/pull/731#discussion_r376245807
##########
File path:
helix-rest/src/main/java/org/apache/helix/rest/metadatastore/TrieRoutingData.java
##########
@@ -124,8 +128,91 @@ private TrieNode findTrieNode(String path, boolean
findLeafAlongPath)
return curNode;
}
- // TODO: THE CLASS WILL BE CHANGED TO PRIVATE ONCE THE CONSTRUCTOR IS
CREATED.
- static class TrieNode {
+ /**
+ * Checks for the edge case when the only sharding key in provided routing
data is the delimiter
+ * or an empty string. When this is the case, the trie is valid and contains
only one node, which
+ * is the root node, and the root node is a leaf node with a realm address
associated with it.
+ * @param routingData - a mapping from "sharding keys" to "realm addresses"
to be parsed into a
+ * trie
+ * @return whether the edge case is true
+ */
+ private boolean isRootShardingKey(Map<String, List<String>> routingData) {
+ if (routingData.values().size() == 1) {
+ for (List<String> shardingKeys : routingData.values()) {
+ return shardingKeys.size() == 1
+ && (shardingKeys.get(0).equals(DELIMITER) ||
shardingKeys.get(0).equals(""));
Review comment:
Why is it possible to have two different cases? What does it mean to have
just "/", and what does it mean to have an empty string?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]