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

Statistics about a ZooKeeper entry, 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 entry an ephemeral entry? More...
 

Public Attributes

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

Detailed Description

Statistics about a ZooKeeper entry, 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 an entry will cause an increase to one of the version numbers of that entry.
  • 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 220 of file types.hpp.

Member Function Documentation

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

Is the entry an ephemeral entry?

Definition at line 271 of file types.hpp.

Member Data Documentation

zk::acl_version zk::stat::acl_version

The number of changes to the ACL of the entry.

Definition at line 256 of file types.hpp.

transaction_id zk::stat::child_modified_transaction

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

Definition at line 233 of file types.hpp.

zk::child_version zk::stat::child_version

The number of changes to the children of the entry.

Definition at line 253 of file types.hpp.

std::size_t zk::stat::children_count

The number of children this entry has.

Definition at line 268 of file types.hpp.

time_point zk::stat::create_time

Time the entry 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 entry 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 entry with a higher create_transaction (created after) will have a lower create_time (appear to have been created before).

Definition at line 243 of file types.hpp.

transaction_id zk::stat::create_transaction

The transaction ID that created the entry.

Definition at line 227 of file types.hpp.

std::size_t zk::stat::data_size

The size of the data field of the entry.

Definition at line 265 of file types.hpp.

zk::version zk::stat::data_version

The number of changes to the data of the entry.

This value is used in operations like client::set that take a version check before modifying data.

Definition at line 250 of file types.hpp.

std::uint64_t zk::stat::ephemeral_owner

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

In general, this is not useful beyond a check for being 0.

See also
is_ephemeral

Definition at line 262 of file types.hpp.

time_point zk::stat::modified_time

Last time the entry was last modified. Like create_time, this is not a reliable source.

Definition at line 246 of file types.hpp.

transaction_id zk::stat::modified_transaction

The last transaction that modified the entry.

Definition at line 230 of file types.hpp.


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