There are two ways to receive watch notifications: legacy and watcher object.
<p>
The legacy style, an application wishing to receive events from ZooKeeper must
first implement a function with this signature and pass a pointer to the function
to \ref zookeeper_init. Next, the application sets a watch by calling one of
the getter API that accept the watch integer flag (for example, \ref zoo_aexists,
\ref zoo_get, etc).
<p>
The watcher object style uses an instance of a "watcher object" which in
the C world is represented by a pair: a pointer to a function implementing this
signature and a pointer to watcher context -- handback user-specific data.
When a watch is triggered this function will be called along with
the watcher context. An application wishing to use this style must use
the getter API functions with the "w" prefix in their names (for example, \ref
zoo_awexists, \ref zoo_wget, etc).
\param zh zookeeper handle
\param type event type. This is one of the *_EVENT constants.
\param state connection state. The state value will be one of the *_STATE constants.
\param path znode path for which the watcher is triggered. NULL if the event
type is ZOO_SESSION_EVENT
\param watcherCtx watcher context.
\brief signature of a watch function.
There are two ways to receive watch notifications: legacy and watcher object. <p> The legacy style, an application wishing to receive events from ZooKeeper must first implement a function with this signature and pass a pointer to the function to \ref zookeeper_init. Next, the application sets a watch by calling one of the getter API that accept the watch integer flag (for example, \ref zoo_aexists, \ref zoo_get, etc). <p> The watcher object style uses an instance of a "watcher object" which in the C world is represented by a pair: a pointer to a function implementing this signature and a pointer to watcher context -- handback user-specific data. When a watch is triggered this function will be called along with the watcher context. An application wishing to use this style must use the getter API functions with the "w" prefix in their names (for example, \ref zoo_awexists, \ref zoo_wget, etc).
\param zh zookeeper handle \param type event type. This is one of the *_EVENT constants. \param state connection state. The state value will be one of the *_STATE constants. \param path znode path for which the watcher is triggered. NULL if the event type is ZOO_SESSION_EVENT \param watcherCtx watcher context.