Subject: | No way to get state of Net::ZooKeeper handle |
Just want to call zoo_state().
--- ZooKeeper.xs 2011-11-24 19:45:29.000000000 +0400
+++ ZooKeeper.xs 2011-11-24 19:52:52.000000000 +0400
@@ -128,7 +128,8 @@
{"hosts", 0, 0, 0, 0},
{"session_timeout", 0, 0, 0, 0},
{"session_id", 0, 0, 0, 0},
- {"pending_watches", 0, 0, 0, 0}
+ {"pending_watches", 0, 0, 0, 0},
+ {"state", 0, 0, 0, 0}
};
static zk_key_t zk_stat_keys[NUM_STAT_KEYS] = {
@@ -1051,6 +1052,9 @@
/* cleanup any completed watches not tied to a handle */
val = newSVuv(_zk_release_watches(aTHX_ zk->first_watch, 0));
}
+ else if (strcaseEQ(key, "state")) {
+ val = newSViv(zoo_state(zk->handle));
+ }
if (val) {
ST(0) = sv_2mortal(val);
--- ZooKeeper.pm 2009-07-15 20:56:06.000000000 +0400
+++ ZooKeeper.pm 2011-11-24 19:52:03.000000000 +0400
@@ -514,6 +514,14 @@
This attribute is B<read-only> and may not be modified.
+=item state
+
+The state of the Net::ZooKeeper connection at current time.
+See C<:states> for a list of the possible connection states.
+If zero, no connection has established yet.
+
+This attribute is B<read-only> and may not be modified.
+
=back
=head2 Net::ZooKeeper::Stat