[GitHub] zookeeper pull request #90: ZOOKEEPER-761: Remove *synchronous* calls from t...

2016-12-15 Thread breed
Github user breed commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/90#discussion_r92719995
  
--- Diff: src/c/tests/TestClient.cc ---
@@ -47,6 +47,10 @@ struct buff_struct_2 {
 char *buffer;
 };
 
+// TODO(br33d): the vast majority of this test is not usable with single 
threaded.
--- End diff --

it's more a matter of implementing the tests than refactoring :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] zookeeper pull request #90: ZOOKEEPER-761: Remove *synchronous* calls from t...

2016-11-15 Thread rgs1
Github user rgs1 commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/90#discussion_r88183747
  
--- Diff: src/c/src/zookeeper.c ---
@@ -4052,6 +3958,76 @@ int zoo_amulti(zhandle_t *zh, int count, const 
zoo_op_t *ops,
 return (rc < 0) ? ZMARSHALLINGERROR : ZOK;
 }
 
+
+int zoo_aremove_watchers(zhandle_t *zh, const char *path, ZooWatcherType 
wtype,
+watcher_fn watcher, void *watcherCtx, int local,
+void_completion_t *completion, const void *data)
+{
+char *server_path = prepend_string(zh, path);
+int rc;
+struct oarchive *oa;
+struct RequestHeader h = { get_xid(), ZOO_REMOVE_WATCHES };
+struct RemoveWatchesRequest req =  { (char*)server_path, wtype };
+watcher_deregistration_t *wdo;
+
+if (!zh || !isValidPath(server_path, 0)) {
+rc = ZBADARGUMENTS;
+goto done;
+}
+
+if (!local && is_unrecoverable(zh)) {
+rc = ZINVALIDSTATE;
+goto done;
+}
+
+if (!pathHasWatcher(zh, server_path, wtype, watcher, watcherCtx)) {
+rc = ZNOWATCHER;
+goto done;
+}
+
+if (local) {
+removeWatchers(zh, server_path, wtype, watcher, watcherCtx);
+#ifdef THREADED
+notify_sync_completion((struct sync_completion *)data);
--- End diff --

@breed @fpj btw -- sorry for the confusing code. `zoo_aremove_watchers` is 
sui generis given that it's the only public method that can return `ZOK` 
without scheduling a remote call (for which then, the callback would be 
naturally dispatched). Thus, this horrible hack of calling 
`notify_sync_completion()`. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] zookeeper pull request #90: ZOOKEEPER-761: Remove *synchronous* calls from t...

2016-11-11 Thread breed
Github user breed commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/90#discussion_r87652058
  
--- Diff: src/c/src/zookeeper.c ---
@@ -4052,6 +3958,76 @@ int zoo_amulti(zhandle_t *zh, int count, const 
zoo_op_t *ops,
 return (rc < 0) ? ZMARSHALLINGERROR : ZOK;
 }
 
+
+int zoo_aremove_watchers(zhandle_t *zh, const char *path, ZooWatcherType 
wtype,
+watcher_fn watcher, void *watcherCtx, int local,
+void_completion_t *completion, const void *data)
+{
+char *server_path = prepend_string(zh, path);
+int rc;
+struct oarchive *oa;
+struct RequestHeader h = { get_xid(), ZOO_REMOVE_WATCHES };
+struct RemoveWatchesRequest req =  { (char*)server_path, wtype };
+watcher_deregistration_t *wdo;
+
+if (!zh || !isValidPath(server_path, 0)) {
+rc = ZBADARGUMENTS;
+goto done;
+}
+
+if (!local && is_unrecoverable(zh)) {
+rc = ZINVALIDSTATE;
+goto done;
+}
+
+if (!pathHasWatcher(zh, server_path, wtype, watcher, watcherCtx)) {
+rc = ZNOWATCHER;
+goto done;
+}
+
+if (local) {
+removeWatchers(zh, server_path, wtype, watcher, watcherCtx);
+#ifdef THREADED
+notify_sync_completion((struct sync_completion *)data);
--- End diff --

so, just to be clear. is this change correct? we don't need to call 
notify_sync_completion in the non-threaded case. right?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] zookeeper pull request #90: ZOOKEEPER-761: Remove *synchronous* calls from t...

2016-10-22 Thread hanm
Github user hanm commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/90#discussion_r84585224
  
--- Diff: src/c/include/zookeeper.h ---
@@ -2000,6 +2001,7 @@ ZOOAPI int zoo_set_acl(zhandle_t *zh, const char 
*path, int version,
  * \ref zoo_acreate, \ref zoo_adelete, \ref zoo_aset).
  */
 ZOOAPI int zoo_multi(zhandle_t *zh, int count, const zoo_op_t *ops, 
zoo_op_result_t *results);
+#endif
--- End diff --

+1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] zookeeper pull request #90: ZOOKEEPER-761: Remove *synchronous* calls from t...

2016-10-20 Thread breed
GitHub user breed opened a pull request:

https://github.com/apache/zookeeper/pull/90

ZOOKEEPER-761: Remove *synchronous* calls from the *single-threaded* C 
client API

the synchronous calls from a single-threaded client do not work. this patch
makes using them in a single-threaded client a compilation error.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/breed/zookeeper ZOOKEEPER-761

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/zookeeper/pull/90.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #90


commit af04dd6fc0b74ab723e6ce449c0e80cc73df
Author: Ben Reed 
Date:   2016-10-19T17:36:44Z

ZOOKEEPER-761: Remove *synchronous* calls from the *single-threaded* C 
client API

the synchronous calls from a single-threaded client do not work. this patch
makes using them in a single-threaded client a compilation error.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---