14 template <
typename TBuffer>
15 auto print_buffer(std::ostream& os,
const TBuffer& buf)
16 -> decltype((os << buf),
void())
21 template <
typename TBuffer>
22 void print_buffer(std::ostream& os,
const TBuffer& buf, ...)
24 os <<
"size=" << buf.size();
27 template <
typename TRange>
28 void print_range(std::ostream& os,
const TRange& range)
32 for (
const auto& x : range)
44 std::string to_string_generic(
const T& x)
46 std::ostringstream os;
55 get_result::get_result(
buffer data,
const zk::stat& stat) noexcept :
56 _data(std::move(data)),
60 get_result::~get_result() noexcept
63 std::ostream& operator<<(std::ostream& os,
const get_result&
self)
66 print_buffer(os,
self.data());
67 os <<
' ' <<
self.stat();
71 std::string to_string(
const get_result&
self)
73 return to_string_generic(
self);
80 get_children_result::get_children_result(children_list_type children,
const stat& parent_stat) noexcept :
81 _children(std::move(children)),
82 _parent_stat(parent_stat)
85 get_children_result::~get_children_result() noexcept
88 std::ostream& operator<<(std::ostream& os,
const get_children_result&
self)
90 os <<
"get_children_result{";
91 print_range(os,
self.children());
92 os <<
" parent=" <<
self.parent_stat();
96 std::string to_string(
const get_children_result&
self)
98 return to_string_generic(
self);
105 exists_result::exists_result(
const optional<zk::stat>& stat) noexcept :
109 exists_result::~exists_result() noexcept
112 std::ostream& operator<<(std::ostream& os,
const exists_result&
self)
114 os <<
"exists_result{";
122 std::string to_string(
const exists_result&
self)
124 return to_string_generic(
self);
131 create_result::create_result(std::string name) noexcept :
132 _name(std::move(name))
135 create_result::~create_result() noexcept
138 std::ostream& operator<<(std::ostream& os,
const create_result&
self)
140 return os <<
"create_result{name=" <<
self.name() <<
'}';
143 std::string to_string(
const create_result&
self)
145 return to_string_generic(
self);
152 set_result::set_result(
const zk::stat& stat) noexcept :
156 set_result::~set_result() noexcept
159 std::ostream& operator<<(std::ostream& os,
const set_result&
self)
161 return os <<
"set_result{" <<
self.stat() <<
'}';
164 std::string to_string(
const set_result&
self)
166 return to_string_generic(
self);
173 get_acl_result::get_acl_result(
zk::acl acl,
const zk::stat& stat) noexcept :
174 _acl(std::move(acl)),
178 get_acl_result::~get_acl_result() noexcept
181 std::ostream& operator<<(std::ostream& os,
const get_acl_result&
self)
183 return os <<
"get_acl_result{" <<
self.acl() <<
' ' <<
self.stat() <<
'}';
186 std::string to_string(
const get_acl_result&
self)
188 return to_string_generic(
self);
200 std::ostream& operator<<(std::ostream& os,
const event&
self)
202 return os <<
"event{" <<
self.type() <<
" | " <<
self.state() <<
'}';
205 std::string to_string(
const event&
self)
207 return to_string_generic(
self);
214 watch_result::watch_result(get_result initial, future<event> next) noexcept :
215 _initial(std::move(initial)),
216 _next(std::move(next))
219 watch_result::~watch_result() noexcept
222 std::ostream& operator<<(std::ostream& os,
const watch_result&
self)
224 return os <<
"watch_result{initial=" <<
self.initial() <<
'}';
227 std::string to_string(
const watch_result&
self)
229 return to_string_generic(
self);
236 watch_children_result::watch_children_result(get_children_result initial, future<event> next) noexcept :
237 _initial(std::move(initial)),
238 _next(std::move(next))
241 watch_children_result::~watch_children_result() noexcept
244 std::ostream& operator<<(std::ostream& os,
const watch_children_result&
self)
246 return os <<
"watch_children_result{initial=" <<
self.initial() <<
'}';
249 std::string to_string(
const watch_children_result&
self)
251 return to_string_generic(
self);
258 watch_exists_result::watch_exists_result(exists_result initial, future<event> next) noexcept :
259 _initial(std::move(initial)),
260 _next(std::move(next))
263 watch_exists_result::~watch_exists_result() noexcept
266 std::ostream& operator<<(std::ostream& os,
const watch_exists_result&
self)
268 return os <<
"watch_exists_result{initial=" <<
self.initial() <<
'}';
271 std::string to_string(
const watch_exists_result&
self)
273 return to_string_generic(
self);
Describes the various result types of client operations.
state
Enumeration of states the client may be at when a watch triggers.
Statistics about a znode, similar to the UNIX stat structure.
event_type
Enumeration of types of events that may occur.
An access control list is a wrapper around acl_rule instances.
ZKPP_BUFFER_TYPE buffer
The buffer type.