xyuanlu commented on code in PR #2623:
URL: https://github.com/apache/helix/pull/2623#discussion_r1340455192


##########
meta-client/src/main/java/org/apache/helix/metaclient/impl/zk/ZkMetaClientCache.java:
##########
@@ -102,14 +102,90 @@ public List<T> get(List<String> keys) {
         return dataList;
     }
 
+    /**
+     * Get the direct children for a given key.
+     * @param key For metadata storage that has hierarchical key space (e.g. 
ZK), the key would be
+     *            a parent key,
+     *            For metadata storage that has non-hierarchical key space 
(e.g. etcd), the key would
+     *            be a prefix key.
+     * @return list of direct children or null if key doesn't exist / cache is 
not populated yet.
+     */
     @Override
     public List<String> getDirectChildrenKeys(final String key) {
-        throw new MetaClientException("Not implemented yet.");
+        if (_cacheChildren) {
+            TrieNode node = getTree(key);
+            if (node == null) {
+                LOG.debug("Children not found in cache for key: {}. This could 
be because the cache is still being populated.", key);
+                return null;
+            }
+            return new ArrayList<>(node.getChildren().keySet());

Review Comment:
   Consider using `ImmutableArray`



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

Reply via email to