You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2020/01/27 14:28:30 UTC

[GitHub] [helix] dasahcc commented on a change in pull request #682: Implement sharding key trie node class

dasahcc commented on a change in pull request #682: Implement sharding key trie node class
URL: https://github.com/apache/helix/pull/682#discussion_r371268204
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/ShardingKeyTrieNode.java
 ##########
 @@ -0,0 +1,117 @@
+package org.apache.helix.rest.metadatastore;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Map;
+
+/**
+ * A trie node that is used to represent Zk path sharding keys. Terminal nodes contain ZkRealm
+ * addresses.
+ */
+public class ShardingKeyTrieNode {
+  /**
+   * Children trie nodes of this trie node. Each node is identified by their name.
+   */
+  private final Map<String, ShardingKeyTrieNode> _children;
+  /**
+   * Boolean value dictating if this trie node is a terminal node.
+   */
+  private final boolean _isLeaf;
+  /**
+   * This trie node's name.
+   */
+  private final String _name;
+  /**
+   * ZkRealm address corresponding to this trie node. The value is only valid when the node is a
+   * terminal node.
+   */
+  private final String _zkRealmAddress;
+
+  public ShardingKeyTrieNode(Map<String, ShardingKeyTrieNode> children, boolean isLeaf, String name,
+      String zkRealmAddress) {
+    _children = children;
+    _isLeaf = isLeaf;
+    _name = name;
+    _zkRealmAddress = zkRealmAddress;
+  }
+
+  public Map<String, ShardingKeyTrieNode> getChildren() {
+    return _children;
 
 Review comment:
   Let's wrap it as unmodifiable map. Otherwise, it will be changed.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org