Marcosrico commented on code in PR #2619:
URL: https://github.com/apache/helix/pull/2619#discussion_r1332411130


##########
meta-client/src/main/java/org/apache/helix/metaclient/impl/zk/ZkMetaClientCache.java:
##########
@@ -81,14 +114,45 @@ public int countDirectChildren(final String key) {
         throw new MetaClientException("Not implemented yet.");
     }
 
-    @Override
-    public List<T> get(List<String> keys) {
-        throw new MetaClientException("Not implemented yet.");
+    private void handleCacheUpdate(String path, ChildChangeListener.ChangeType 
changeType) {
+        switch (changeType) {
+            case ENTRY_CREATED:
+                // Not implemented yet.
+                break;
+            case ENTRY_DELETED:
+                // Not implemented yet.
+                break;
+            case ENTRY_DATA_CHANGE:
+                modifyDataInCache(path);
+                break;
+            default:
+                LOG.error("Unknown change type: " + changeType);
+        }
     }
 
+    private void modifyDataInCache(String path) {
+        if (_cacheData) {
+            T dataRecord = _cacheClient.readData(path, true);
+            getDataCacheMap().put(path, dataRecord);
+        }
+    }
+
+    public ConcurrentHashMap<String, T> getDataCacheMap() {
+        return _dataCacheMap;
+    }
+
+    public TrieNode getChildrenCacheTree() {
+        return _childrenCacheTree;
+    }
+
+    /**
+     * Connect to the underlying ZkClient.
+     */
     @Override
-    public List<Stat> exists(List<String> keys) {
-        throw new MetaClientException("Not implemented yet.");
+    public void connect() {
+        super.connect();
+        _eventListener = this::handleCacheUpdate;

Review Comment:
   That's a good point - will add that



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