zookeeper-cpp
ZooKeeper Client for C++
zk::stat Struct Referencefinal

Statistics about a znode, similar to the UNIX stat structure. More...

#include <zk/types.hpp>

Public Types

using time_point = std::chrono::system_clock::time_point
 

Public Member Functions

bool is_ephemeral () const
 Is the znode an ephemeral entry? More...
 

Public Attributes

transaction_id create_transaction
 The transaction ID that created the znode. More...
 
transaction_id modified_transaction
 The last transaction that modified the znode. More...
 
transaction_id child_modified_transaction
 The transaction ID that last modified the children of the znode. More...
 
time_point create_time
 Time the znode was created. More...
 
time_point modified_time
 Last time the znode was last modified. More...
 
zk::version data_version
 The number of changes to the data of the znode. More...
 
zk::child_version child_version
 The number of changes to the children of the znode. More...
 
zk::acl_version acl_version
 The number of changes to the ACL of the znode. More...
 
std::uint64_t ephemeral_owner
 The session ID of the owner of this znode, if it is an ephemeral entry. More...
 
std::size_t data_size
 The size of the data field of the znode. More...
 
std::size_t children_count
 The number of children this znode has. More...
 

Detailed Description

Statistics about a znode, similar to the UNIX stat structure.

Note
{Time in ZooKeeper} The concept of time is tricky in distributed systems. ZooKeeper keeps track of time in a number of ways.
  • zxid: Every change to a ZooKeeper cluster receives a stamp in the form of a zxid (ZooKeeper Transaction ID). This exposes the total ordering of all changes to ZooKeeper. Each change will have a unique zxid – if zxid:a is smaller than zxid:b, then the associated change to zxid:a happened before zxid:b.
  • Version Numbers: Every change to a znode will cause an increase to one of the version numbers of that node.
  • Clock Time: ZooKeeper does not use clock time to make decisions, but it uses it to put timestamps into the stat structure.

Definition at line 191 of file types.hpp.

Member Function Documentation

bool zk::stat::is_ephemeral ( ) const
inline

Is the znode an ephemeral entry?

Definition at line 239 of file types.hpp.

Member Data Documentation

zk::acl_version zk::stat::acl_version

The number of changes to the ACL of the znode.

Definition at line 227 of file types.hpp.

transaction_id zk::stat::child_modified_transaction

The transaction ID that last modified the children of the znode.

Definition at line 204 of file types.hpp.

zk::child_version zk::stat::child_version

The number of changes to the children of the znode.

Definition at line 224 of file types.hpp.

std::size_t zk::stat::children_count

The number of children this znode has.

Definition at line 236 of file types.hpp.

time_point zk::stat::create_time

Time the znode was created.

Warning
This should not be relied on for any logic. ZooKeeper sets this time based on the system clock of the master server at the time the znode is created and performs no validity checking or synchronization with other servers in the cluster. As such, there is no guarantee that this value is accurrate. There are many situations where a znode with a higher create_transaction (created after) will have a lower create_time (appear to have been created before).

Definition at line 215 of file types.hpp.

transaction_id zk::stat::create_transaction

The transaction ID that created the znode.

Definition at line 198 of file types.hpp.

std::size_t zk::stat::data_size

The size of the data field of the znode.

Definition at line 233 of file types.hpp.

zk::version zk::stat::data_version

The number of changes to the data of the znode.

Definition at line 221 of file types.hpp.

std::uint64_t zk::stat::ephemeral_owner

The session ID of the owner of this znode, if it is an ephemeral entry.

Definition at line 230 of file types.hpp.

time_point zk::stat::modified_time

Last time the znode was last modified.

Like create_time, this is not a reliable source.

Definition at line 218 of file types.hpp.

transaction_id zk::stat::modified_transaction

The last transaction that modified the znode.

Definition at line 201 of file types.hpp.


The documentation for this struct was generated from the following file: