doxygen comment for state argument of watcher_fn typedef and implementation
differ ("...one of the *_STATE constants, otherwise -1")
------------------------------------------------------------------------------------------------------------------------------------
Key: ZOOKEEPER-196
URL: https://issues.apache.org/jira/browse/ZOOKEEPER-196
Project: Zookeeper
Issue Type: Bug
Environment: Linux
Reporter: Maxim P. Dementiev
In zookeeper.h:
* \param state connection state. If the type is ZOO_SESSION_EVENT, the state
value
* will be one of the *_STATE constants, otherwise -1.
but for this sequence:
1. zoo_awexists(name)
2. zoo_acreate(name)
we've got a watcher callback with type=ZOO_CREATED_EVENT and state!=-1
I think the comment should be altered to underline the difference between
zookeeper_init() callback usage and others ("the getter API functions with the
"w" prefix in their names") for the new "watcher object" style.
It looks like the type and path argument values are useless for the former
(because type is always ZOO_SESSION_EVENT, and path is always empty), and the
state is useless for the latter (it is considered to be -1).
And more, the state of the legacy style should be commented - will it be
marked as obsolete? Or will it be supported in the future?
I wonder if there are any plans to split current watcher_fn callback to
something like:
1. new watcher_fn: typedef void (*watcher_fn)(zhandle_t *zh, int type, const
char *path, void *watcherCtx);
2. connection_fn: typedef void (*watcher_fn)(zhandle_t *zh, int state, void
*context);
Because, you see, the usage is different and there is no any common set of
arguments apart from zh (which is common for API) and context.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.