zookeeper-cpp
ZooKeeper Client for C++
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Groups
zk::event Class Referencefinal

Data delivered when a watched event triggers. More...

#include <zk/results.hpp>

Public Member Functions

 event (event_type type, zk::state state) noexcept
 
const event_typetype () const
 The type of event that occurred. More...
 
const zk::statestate () const
 The state of the connection when the event occurred. More...
 

Detailed Description

Data delivered when a watched event triggers.

Note
If you are familiar with the ZooKeeper C API, the limited information delivered might seem very simplistic. Since this API only supports non-global watches, the extra parameters are not helpful and generally unsafe. As an example, the path parameter is not included. It is not helpful to include, since you already know the path you specified when you set the watch in the first place. Furthermore, it is unsafe, as the contents addressed by the pointer are only safe in the callback thread. While we could copy the path into an std::string, this would require an allocation on every delivery, which is very intrusive.

Definition at line 202 of file results.hpp.

Member Function Documentation

const zk::state& zk::event::state ( ) const
inline

The state of the connection when the event occurred.

Keep in mind that it might be different when the value is delivered.

Definition at line 212 of file results.hpp.

const event_type& zk::event::type ( ) const
inline

The type of event that occurred.

Definition at line 208 of file results.hpp.


The documentation for this class was generated from the following files: