kezhuw commented on code in PR #2068:
URL: https://github.com/apache/zookeeper/pull/2068#discussion_r1338251206


##########
zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeper.java:
##########
@@ -2708,6 +2708,31 @@ public void 
getEphemerals(AsyncCallback.EphemeralsCallback cb, Object ctx) {
         getEphemerals("/", cb, ctx);
     }
 
+    /**
+     * Synchronous sync. Flushes channel between process and leader.
+     *
+     * @param path the given path
+     * @throws KeeperException If the server signals an error with a non-zero 
error code
+     * @throws InterruptedException If the server transaction is interrupted.
+     * @throws IllegalArgumentException if an invalid path is specified
+     */
+    public void sync(final String path) throws KeeperException, 
InterruptedException {
+        final String clientPath = path;
+        PathUtils.validatePath(clientPath);
+
+        final String serverPath = prependChroot(clientPath);
+
+        RequestHeader h = new RequestHeader();
+        h.setType(ZooDefs.OpCode.sync);
+        SyncRequest request = new SyncRequest();
+        SyncResponse response = new SyncResponse();
+        request.setPath(serverPath);

Review Comment:
   I guess it may not worth the effort.
   
   * To cover only above code, we probably have to introduce wrapper struct to 
cover context for `submitRequest` and `queuePacket`.
   * To cover also following code, we probably have to introduce an overload to 
accept all parameters from asynchronous code and a flag to differentiate origin 
as `zk.sync("/", null, null")` is valid.
   
   A little duplication probably be a good here.



-- 
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: notifications-unsubscr...@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to