zookeeper-cpp
ZooKeeper Client for C++
|
Interacting with ZooKeeper as a client. More...
Macros | |
#define | ZKPP_BUFFER_USE_CUSTOM 0 |
Set this to 1 to use a custom definitions for zk::buffer . More... | |
#define | ZKPP_BUFFER_USE_STD_VECTOR 1 |
Set this to 1 to use std::vector<char> for the implementation of zk::buffer . More... | |
#define | ZKPP_BUFFER_INCLUDE <vector> |
#define | ZKPP_BUFFER_TYPE std::vector<char> |
#define | ZKPP_VERSION_MAJOR 0 |
#define | ZKPP_VERSION_MINOR 1 |
#define | ZKPP_VERSION_PATCH 0 |
#define | ZKPP_DEBUG 0 |
Was ZooKeeper C++ compiled in debug mode? This value must be the same between when the SO was built and when you are compiling. More... | |
#define | ZKPP_SO 1 |
Are you using shared objects (DLLs in Windows)? More... | |
#define | ZKPP_ERROR_CODE_LIST(item) |
#define | ZKPP_ERROR_CODE_SIZE_IMPL(cxx_name, number, c_name) +1 |
#define | ZKPP_FUTURE_USE_STD_EXPERIMENTAL 0 |
Set this to 1 to use std::experimental::future and std::experimental::promise as the backing types for zk::future and zk::promise . More... | |
#define | ZKPP_FUTURE_USE_CUSTOM 0 |
Set this to 1 to use custom definitions of zk::future and zk::promise . More... | |
#define | ZKPP_FUTURE_TEMPLATE std::future |
The template to use for zk::future . More... | |
#define | ZKPP_PROMISE_TEMPLATE std::promise |
The template to use for zk::promise . More... | |
#define | ZKPP_FUTURE_INCLUDE <future> |
The file to include to get the implementation for future and promise . More... | |
#define | ZKPP_FUTURE_USE_STD 1 |
Set this to 1 to use std::future and std::promise as the backing types for zk::future and zk::promise . More... | |
#define | ZKPP_OPTIONAL_USE_STD_EXPERIMENTAL 0 |
Set this to 1 to use std::experimental::optional , std::experimental::nullopt_t , and std::experimental::nullopt as the backing types for zk::optional , zk::nullopt_t , and zk::nullopt . More... | |
#define | ZKPP_OPTIONAL_USE_CUSTOM 0 |
Set this to 1 to use custom definitions for zk::optional , zk::nullopt_t , and zk::nullopt . More... | |
#define | ZKPP_OPTIONAL_INCLUDE <optional> |
The file to include to get the implementation for optional , nullopt_t , and nullopt . More... | |
#define | ZKPP_OPTIONAL_TEMPLATE std::optional |
The template to use for zk::optional . More... | |
#define | ZKPP_NULLOPT_TYPE std::nullopt_t |
The type to use for zk::nullopt_t . More... | |
#define | ZKPP_NULLOPT_VALUE std::nullopt |
The value to use for zk::nullopt . More... | |
#define | ZKPP_OPTIONAL_USE_STD 1 |
Set this to 1 to use std::optional , std::nullopt_t , and std::nullopt as the backing types for zk::optional , zk::nullopt_t , and zk::nullopt . More... | |
#define | ZKPP_STRING_VIEW_USE_STD_EXPERIMENTAL 0 |
#define | ZKPP_STRING_VIEW_USE_CUSTOM 0 |
#define | ZKPP_STRING_VIEW_USE_STD 1 |
#define | ZKPP_STRING_VIEW_INCLUDE <string_view> |
#define | ZKPP_STRING_VIEW_TYPE std::string_view |
Typedefs | |
using | zk::buffer = ZKPP_BUFFER_TYPE |
The buffer type. More... | |
template<typename T > | |
using | zk::ptr = T * |
A simple, unowned pointer. More... | |
template<typename T > | |
using | zk::future = ZKPP_FUTURE_TEMPLATE< T > |
template<typename T > | |
using | zk::promise = ZKPP_PROMISE_TEMPLATE< T > |
template<typename T > | |
using | zk::optional = ZKPP_OPTIONAL_TEMPLATE< T > |
using | zk::nullopt_t = ZKPP_NULLOPT_TYPE |
Enumerations | |
enum | zk::permission : unsigned int { zk::permission::none = 0b00000, zk::permission::read = 0b00001, zk::permission::write = 0b00010, zk::permission::create = 0b00100, zk::permission::erase = 0b01000, zk::permission::admin = 0b10000, zk::permission::all = 0b11111 } |
Describes the ability of a user to perform a certain action. More... | |
enum | error_code : int { ZKPP_ERROR_CODE_ENUM_DEF_IMPL } |
enum | op_type : int { check, create, erase, set } |
enum | zk::create_mode : unsigned int { zk::create_mode::normal = 0b0000, zk::create_mode::ephemeral = 0b0001, zk::create_mode::sequential = 0b0010, zk::create_mode::container = 0b0100 } |
When used in client::set , this value determines how the znode is created on the server. More... | |
enum | zk::event_type : int { zk::event_type::error = 0, zk::event_type::created = 1, zk::event_type::erased = 2, zk::event_type::changed = 3, zk::event_type::child = 4, zk::event_type::session = -1, zk::event_type::not_watching = -2 } |
Enumeration of types of events that may occur. More... | |
enum | zk::state : int { zk::state::closed = 0, zk::state::connecting = 1, zk::state::associating = 2, zk::state::connected = 3, zk::state::read_only = 5, not_connected = 999, zk::state::expired_session = -112, zk::state::authentication_failed = -113 } |
Enumeration of states the client may be at when a watch triggers. More... | |
Functions | |
constexpr permission | zk::operator| (permission a, permission b) |
constexpr permission | zk::operator& (permission a, permission b) |
constexpr permission | zk::operator~ (permission a) |
constexpr bool | zk::allows (permission self, permission perform) |
Check that self allows it perform all operations. More... | |
std::ostream & | zk::operator<< (std::ostream &os, const permission &self) |
std::string | zk::to_string (const permission &self) |
std::size_t | zk::hash (const acl_rule &self) |
bool | zk::operator== (const acl_rule &lhs, const acl_rule &rhs) |
bool | zk::operator!= (const acl_rule &lhs, const acl_rule &rhs) |
bool | zk::operator< (const acl_rule &lhs, const acl_rule &rhs) |
bool | zk::operator<= (const acl_rule &lhs, const acl_rule &rhs) |
bool | zk::operator> (const acl_rule &lhs, const acl_rule &rhs) |
bool | zk::operator>= (const acl_rule &lhs, const acl_rule &rhs) |
std::ostream & | zk::operator<< (std::ostream &os, const acl_rule &self) |
std::string | zk::to_string (const acl_rule &self) |
bool | zk::operator== (const acl &lhs, const acl &rhs) |
bool | zk::operator!= (const acl &lhs, const acl &rhs) |
std::ostream & | zk::operator<< (std::ostream &os, const acl &self) |
std::string | zk::to_string (const acl &self) |
std::ostream & | zk::operator<< (std::ostream &os, const error_code &code) |
std::string | zk::to_string (const error_code &code) |
const std::array< error_code, ZKPP_ERROR_CODE_LIST(ZKPP_ERROR_CODE_SIZE_IMPL)> & | zk::all_error_codes () |
constexpr bool | zk::is_system_error (error_code code) |
constexpr bool | zk::is_api_error (error_code code) |
void | zk::throw_error (error_code code) |
std::exception_ptr | zk::get_exception_ptr_of (error_code code) |
std::ostream & | zk::operator<< (std::ostream &os, const op_type &self) |
std::string | zk::to_string (const op_type &self) |
std::ostream & | zk::operator<< (std::ostream &os, const op &self) |
std::string | zk::to_string (const op &self) |
std::ostream & | zk::operator<< (std::ostream &os, const multi_op &self) |
std::string | zk::to_string (const multi_op &) |
std::ostream & | zk::operator<< (std::ostream &os, const multi_result::part &self) |
std::ostream & | zk::operator<< (std::ostream &os, const multi_result &self) |
std::string | zk::to_string (const multi_result::part &self) |
std::string | zk::to_string (const multi_result &self) |
std::ostream & | zk::operator<< (std::ostream &os, const get_result &self) |
std::string | zk::to_string (const get_result &self) |
std::ostream & | zk::operator<< (std::ostream &os, const get_children_result &self) |
std::string | zk::to_string (const get_children_result &self) |
std::ostream & | zk::operator<< (std::ostream &os, const exists_result &self) |
std::string | zk::to_string (const exists_result &self) |
std::ostream & | zk::operator<< (std::ostream &os, const create_result &self) |
std::string | zk::to_string (const create_result &self) |
std::ostream & | zk::operator<< (std::ostream &os, const set_result &self) |
std::string | zk::to_string (const set_result &self) |
std::ostream & | zk::operator<< (std::ostream &os, const get_acl_result &self) |
std::string | zk::to_string (const get_acl_result &self) |
std::ostream & | zk::operator<< (std::ostream &os, const event &self) |
std::string | zk::to_string (const event &self) |
std::ostream & | zk::operator<< (std::ostream &os, const watch_result &self) |
std::string | zk::to_string (const watch_result &self) |
std::ostream & | zk::operator<< (std::ostream &os, const watch_children_result &self) |
std::string | zk::to_string (const watch_children_result &self) |
std::ostream & | zk::operator<< (std::ostream &os, const watch_exists_result &self) |
std::string | zk::to_string (const watch_exists_result &self) |
template<typename TReal , typename TId > | |
constexpr bool | zk::operator== (const strong_id< TReal, TId > &a, const strong_id< TReal, TId > &b) |
template<typename TReal , typename TId > | |
constexpr bool | zk::operator!= (const strong_id< TReal, TId > &a, const strong_id< TReal, TId > &b) |
template<typename TReal , typename TId > | |
constexpr bool | zk::operator< (const strong_id< TReal, TId > &a, const strong_id< TReal, TId > &b) |
template<typename TReal , typename TId > | |
constexpr bool | zk::operator<= (const strong_id< TReal, TId > &a, const strong_id< TReal, TId > &b) |
template<typename TReal , typename TId > | |
constexpr bool | zk::operator> (const strong_id< TReal, TId > &a, const strong_id< TReal, TId > &b) |
template<typename TReal , typename TId > | |
constexpr bool | zk::operator>= (const strong_id< TReal, TId > &a, const strong_id< TReal, TId > &b) |
template<typename TReal , typename TId > | |
std::size_t | zk::hash (const strong_id< TReal, TId > &x) |
std::ostream & | zk::operator<< (std::ostream &os, const version &self) |
std::string | zk::to_string (const version &self) |
std::ostream & | zk::operator<< (std::ostream &os, const acl_version &self) |
std::string | zk::to_string (const acl_version &self) |
std::ostream & | zk::operator<< (std::ostream &os, const child_version &self) |
std::string | zk::to_string (const child_version &self) |
std::ostream & | zk::operator<< (std::ostream &os, const transaction_id &self) |
std::string | zk::to_string (const transaction_id &self) |
std::ostream & | zk::operator<< (std::ostream &os, const stat &self) |
std::string | zk::to_string (const stat &self) |
constexpr create_mode | zk::operator| (create_mode a, create_mode b) |
constexpr create_mode | zk::operator& (create_mode a, create_mode b) |
constexpr create_mode | zk::operator~ (create_mode a) |
constexpr bool | zk::is_set (create_mode self, create_mode flags) |
Check that self has flags set. More... | |
std::ostream & | zk::operator<< (std::ostream &os, const create_mode &mode) |
std::string | zk::to_string (const create_mode &self) |
std::ostream & | zk::operator<< (std::ostream &os, const event_type &self) |
std::string | zk::to_string (const event_type &self) |
std::ostream & | zk::operator<< (std::ostream &os, const state &self) |
std::string | zk::to_string (const state &self) |
Interacting with ZooKeeper as a client.
#define ZKPP_BUFFER_USE_CUSTOM 0 |
Set this to 1 to use a custom definitions for zk::buffer
.
If this is set, you must also set ZKPP_BUFFER_INCLUDE
and ZKPP_BUFFER_TYPE
.
Definition at line 19 of file buffer.hpp.
#define ZKPP_BUFFER_USE_STD_VECTOR 1 |
Set this to 1 to use std::vector<char>
for the implementation of zk::buffer
.
This is the default behavior.
Definition at line 29 of file buffer.hpp.
#define ZKPP_DEBUG 0 |
Was ZooKeeper C++ compiled in debug mode? This value must be the same between when the SO was built and when you are compiling.
In general, this is not useful outside of library maintainers.
#if ZKPP_DEBUG
, not #ifdef ZKPP_DEBUG
. Definition at line 27 of file config.hpp.
#define ZKPP_FUTURE_INCLUDE <future> |
The file to include to get the implementation for future
and promise
.
If you define ZKPP_FUTURE_TEMPLATE
and ZKPP_PROMISE_TEMPLATE
, you must also define this.
Definition at line 52 of file future.hpp.
#define ZKPP_FUTURE_TEMPLATE std::future |
The template to use for zk::future
.
By default, this is std::future
.
Definition at line 53 of file future.hpp.
#define ZKPP_FUTURE_USE_CUSTOM 0 |
Set this to 1 to use custom definitions of zk::future
and zk::promise
.
If this is set, you must also set ZKPP_FUTURE_TEMPLATE
, ZKPP_PROMISE_TEMPLATE
, and ZKPP_FUTURE_INCLUDE
.
Definition at line 36 of file future.hpp.
#define ZKPP_FUTURE_USE_STD 1 |
Set this to 1 to use std::future
and std::promise
as the backing types for zk::future
and zk::promise
.
This is the default behavior.
Definition at line 47 of file future.hpp.
#define ZKPP_FUTURE_USE_STD_EXPERIMENTAL 0 |
Set this to 1 to use std::experimental::future
and std::experimental::promise
as the backing types for zk::future
and zk::promise
.
Definition at line 18 of file future.hpp.
#define ZKPP_NULLOPT_TYPE std::nullopt_t |
The type to use for zk::nullopt_t
.
By default, this is std::nullopt_t
.
Definition at line 58 of file optional.hpp.
#define ZKPP_NULLOPT_VALUE std::nullopt |
The value to use for zk::nullopt
.
By default, this is std::nullopt
.
Definition at line 59 of file optional.hpp.
#define ZKPP_OPTIONAL_INCLUDE <optional> |
The file to include to get the implementation for optional
, nullopt_t
, and nullopt
.
By default, this pulls from the standard library.
Definition at line 56 of file optional.hpp.
#define ZKPP_OPTIONAL_TEMPLATE std::optional |
The template to use for zk::optional
.
By default, this is std::optional
.
Definition at line 57 of file optional.hpp.
#define ZKPP_OPTIONAL_USE_CUSTOM 0 |
Set this to 1 to use custom definitions for zk::optional
, zk::nullopt_t
, and zk::nullopt
.
If this is set, you must also set ZKPP_OPTIONAL_INCLUDE
, ZKPP_NULLOPT_TYPE
, and ZKPP_NULLOPT_VALUE
.
Definition at line 40 of file optional.hpp.
#define ZKPP_OPTIONAL_USE_STD 1 |
Set this to 1 to use std::optional
, std::nullopt_t
, and std::nullopt
as the backing types for zk::optional
, zk::nullopt_t
, and zk::nullopt
.
This is the default behavior.
Definition at line 51 of file optional.hpp.
#define ZKPP_OPTIONAL_USE_STD_EXPERIMENTAL 0 |
Set this to 1 to use std::experimental::optional
, std::experimental::nullopt_t
, and std::experimental::nullopt
as the backing types for zk::optional
, zk::nullopt_t
, and zk::nullopt
.
Definition at line 19 of file optional.hpp.
#define ZKPP_PROMISE_TEMPLATE std::promise |
The template to use for zk::promise
.
This should be highly related to ZKPP_FUTURE_TEMPLATE
Definition at line 54 of file future.hpp.
#define ZKPP_SO 1 |
Are you using shared objects (DLLs in Windows)?
Definition at line 34 of file config.hpp.
using zk::buffer = typedef ZKPP_BUFFER_TYPE |
The buffer
type.
By default, this is an std::vector<char>
, but this can be altered by compile-time flags such as ZKPP_BUFFER_USE_CUSTOM
. The requirements for a custom buffer are minimal – the type must fit this criteria:
expression | type | description |
---|---|---|
buffer::value_type | char | Buffers must be made of single-byte elements |
buffer::size_type | std::size_t | |
buffer(ib, ie) | buffer | Constructs a buffer with the range [ib , ie ) |
buffer(buffer&&) | buffer | Move constructible. |
size() | size_type | Get the length of the buffer |
data() | const value_type* | Get a pointer to the beginning of the contents |
Definition at line 67 of file buffer.hpp.
using zk::ptr = typedef T* |
A simple, unowned pointer.
It operates exactly like using *
, but removes the question of *
associativity and is easier to read when const
qualifiers are involved.
Definition at line 75 of file config.hpp.
|
strong |
When used in client::set
, this value determines how the znode is created on the server.
These values can be ORed together to create combinations.
Enumerator | |
---|---|
normal |
Standard behavior of a znode – the opposite of doing any of the options. |
ephemeral |
The znode will be deleted upon the client's disconnect. |
sequential |
The name of the znode will be appended with a monotonically increasing number. The actual path name of a sequential node will be the given path plus a suffix |
container |
Container nodes are special purpose nodes useful for recipes such as leader, lock, etc. When the last child of a container is deleted, the container becomes a candidate to be deleted by the server at some point in the future. Given this property, you should be prepared to get |
|
strong |
Enumeration of types of events that may occur.
|
strong |
Describes the ability of a user to perform a certain action.
Permissions can be mixed together like integers with | and
&
.
|
strong |
Enumeration of states the client may be at when a watch triggers.
It represents the state of the connection at the time the event was generated.
constexpr bool zk::allows | ( | permission | self, |
permission | perform | ||
) |
Check that self allows it perform all operations.
For example, allows(permission::read | permission::write, permission::read)
will be true
, as read|write
is allowed to read
.
constexpr bool zk::is_set | ( | create_mode | self, |
create_mode | flags | ||
) |