zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an...@apache.org
Subject [08/45] zookeeper git commit: ZOOKEEPER-3030: MAVEN MIGRATION - Step 1.3 - move contrib directories
Date Mon, 06 Aug 2018 12:13:33 GMT
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/zookeeper-contrib/zookeeper-contrib-zkperl/t/50_access.t
----------------------------------------------------------------------
diff --git a/zookeeper-contrib/zookeeper-contrib-zkperl/t/50_access.t b/zookeeper-contrib/zookeeper-contrib-zkperl/t/50_access.t
new file mode 100644
index 0000000..ef61ed6
--- /dev/null
+++ b/zookeeper-contrib/zookeeper-contrib-zkperl/t/50_access.t
@@ -0,0 +1,356 @@
+# Net::ZooKeeper - Perl extension for Apache ZooKeeper
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+use File::Spec;
+use Test::More tests => 40;
+
+BEGIN { use_ok('Net::ZooKeeper', qw(:all)) };
+
+
+my $test_dir;
+(undef, $test_dir, undef) = File::Spec->splitpath($0);
+require File::Spec->catfile($test_dir, 'util.pl');
+
+my($hosts, $root_path, $node_path) = zk_test_setup(0);
+
+my($username, $password, $digest) = zk_acl_test_setup();
+
+
+SKIP: {
+    my $zkh = Net::ZooKeeper->new($hosts);
+
+    my $path = $zkh->create($node_path, 'foo',
+                            'acl' => ZOO_OPEN_ACL_UNSAFE) if (defined($zkh));
+
+    skip 'no connection to ZooKeeper', 36 unless
+        (defined($path) and $path eq $node_path);
+
+
+    ## _zk_acl_constant()
+
+    my $no_read_acl = ZOO_OPEN_ACL_UNSAFE;
+    ok((ref($no_read_acl) eq 'ARRAY' and
+        @{$no_read_acl} == 1 and
+        ref($no_read_acl->[0]) eq 'HASH' and
+        keys(%{$no_read_acl->[0]}) == 3 and
+        $no_read_acl->[0]->{'perms'} == ZOO_PERM_ALL),
+       '_zk_acl_constant(): returned default ACL');
+
+    my $zoo_read_acl_unsafe = ZOO_READ_ACL_UNSAFE;
+    ok((ref($zoo_read_acl_unsafe) eq 'ARRAY' and
+        @{$zoo_read_acl_unsafe} == 1 and
+        ref($zoo_read_acl_unsafe->[0]) eq 'HASH' and
+        keys(%{$zoo_read_acl_unsafe->[0]}) == 3 and
+        $zoo_read_acl_unsafe->[0]->{'perms'} == ZOO_PERM_READ),
+       '_zk_acl_constant(): returned good ACL');
+
+    my $zoo_creator_all_acl = ZOO_CREATOR_ALL_ACL;
+    ok((ref($zoo_creator_all_acl) eq 'ARRAY' and
+        @{$zoo_creator_all_acl} == 1 and
+        ref($zoo_creator_all_acl->[0]) eq 'HASH' and
+        keys(%{$zoo_creator_all_acl->[0]}) == 3 and
+        $zoo_creator_all_acl->[0]->{'perms'} == ZOO_PERM_ALL),
+       '_zk_acl_constant(): returned good ACL');
+
+    $no_read_acl->[0]->{'perms'} &= ~ZOO_PERM_READ;
+    is($no_read_acl->[0]->{'perms'}, ((ZOO_PERM_ALL) & ~ZOO_PERM_READ),
+       'assign: altered default ACL');
+
+    is(ZOO_OPEN_ACL_UNSAFE->[0]->{'perms'}, ZOO_PERM_ALL,
+       '_zk_acl_constant(): returned unaltered default ACL');
+
+    my $copy_no_read_acl = $no_read_acl;
+    is_deeply($copy_no_read_acl, $no_read_acl,
+              'assign: copied default ACL');
+
+    undef $no_read_acl;
+    ok(!defined($no_read_acl),
+       'undef: released original default ACL');
+
+    is($copy_no_read_acl->[0]->{'perms'}, ((ZOO_PERM_ALL) & ~ZOO_PERM_READ),
+       'undef: no change to copied default ACL');
+
+    $no_read_acl = $copy_no_read_acl;
+    is_deeply($no_read_acl, $copy_no_read_acl,
+              'assign: re-copied default ACL');
+
+
+    ## create()
+
+    my $acl_node_path = "$node_path/a1";
+
+    $path = $zkh->create($acl_node_path, 'foo', 'acl' => $no_read_acl);
+    is($path, $acl_node_path,
+       'create(): created node with no-read ACL');
+
+    my $node = $zkh->get($acl_node_path);
+
+    my $skip_acl;
+    if (defined($node) and $node eq 'foo') {
+        $skip_acl = 1;
+    }
+    elsif(!defined($node) and $zkh->get_error() == ZNOAUTH) {
+        $skip_acl = 0;
+    }
+    else {
+        $skip_acl = -1;
+        diag(sprintf('unable to get node with no-read ACL %s: %d, %s',
+                     $acl_node_path, $zkh->get_error(), $!));
+    }
+
+    my $ret = $zkh->delete($acl_node_path);
+    diag(sprintf('unable to delete node with no-read ACL %s: %d, %s',
+                 $acl_node_path, $zkh->get_error(), $!)) unless ($ret);
+
+    my $digest_acl = [
+        {
+            'perms'  => ZOO_PERM_READ,
+            'scheme' => 'world',
+            'id'     => 'anyone'
+        },
+        {
+            'perms'  => (ZOO_PERM_WRITE | ZOO_PERM_ADMIN),
+            'scheme' => 'digest',
+            'id'     => "$username:$digest"
+        }
+    ];
+
+    $path = $zkh->create($acl_node_path, 'foo', 'acl' => $digest_acl);
+    is($path, $acl_node_path,
+       'create(): created node with digest auth ACL');
+
+    SKIP: {
+        skip 'ZooKeeper skipping ACLs', 1 unless (!$skip_acl);
+
+        my $acl_node_path = "$node_path/a2";
+
+        my $path = $zkh->create($acl_node_path, 'foo', 'acl' => [
+            {
+                'perms'  => ZOO_PERM_WRITE,
+                'scheme' => 'foo',
+                'id'     => 'bar'
+            }
+        ]);
+        ok((!defined($path) and $zkh->get_error() == ZINVALIDACL and $! eq ''),
+           'create(): undef when attempting to create node with invalid ACL');
+    }
+
+
+    ## get_acl()
+
+    my @acl = ('abc');
+    @acl = $zkh->get_acl($node_path . '/NONE');
+    ok((@acl == 0 and $zkh->get_error() == ZNONODE and $! eq ''),
+       'get_acl(): empty list returned for non-extant node');
+
+    $num_acl_entries = $zkh->get_acl($node_path . '/NONE');
+    ok((!defined($num_acl_entries) and $zkh->get_error() == ZNONODE and
+        $! eq ''),
+       'get_acl(): undef returned for non-extant node');
+
+    @acl = ('abc');
+    @acl = $zkh->get_acl($acl_node_path);
+    is_deeply(\@acl, $digest_acl,
+              'get_acl(): retrieved digest ACL');
+
+    my $stat = $zkh->stat();
+
+    @acl = ('abc');
+    @acl = $zkh->get_acl($node_path, 'stat' => $stat);
+    is_deeply(\@acl, ZOO_OPEN_ACL_UNSAFE,
+              'get_acl(): retrieved ACL');
+
+    is($stat->{'data_len'}, 3,
+       'get_acl(): retrieved ACL with stat handle');
+
+    SKIP: {
+        skip 'ZooKeeper not skipping ACLs', 3 unless ($skip_acl > 0);
+
+        my $acl_node_path = "$node_path/a2";
+
+        my $path = $zkh->create($acl_node_path, 'foo', 'acl' => []);
+        is($path, $acl_node_path,
+           'create(): created node with empty ACL');
+
+        my @acl = ('abc');
+        @acl = $zkh->get_acl($acl_node_path);
+        ok((@acl == 0 and $zkh->get_error() == ZOK),
+           'get_acl(): retrieved empty ACL');
+
+        my $num_acl_entries = $zkh->get_acl($acl_node_path);
+        ok((defined($num_acl_entries) and $num_acl_entries == 0),
+           'get_acl(): retrieved zero count of ACL entries');
+
+        my $ret = $zkh->delete($acl_node_path);
+        diag(sprintf('unable to delete node with empty ACL %s: %d, %s',
+                     $acl_node_path, $zkh->get_error(), $!)) unless ($ret);
+    }
+
+
+    ## set_acl()
+
+    SKIP: {
+        skip 'ZooKeeper skipping ACLs', 2 unless (!$skip_acl);
+
+        my $ret = $zkh->set_acl($acl_node_path, [
+            {
+                'perms'  => ZOO_PERM_CREATE,
+                'scheme' => 'foo',
+                'id'     => 'bar'
+            }
+        ]);
+        ok((!$ret and $zkh->get_error() == ZINVALIDACL and $! eq ''),
+           'set_acl(): invalid ACL');
+
+        push @{$digest_acl}, {
+            'perms'  => (ZOO_PERM_CREATE | ZOO_PERM_DELETE),
+            'scheme' => 'ip',
+            'id'     => '0.0.0.0'
+        };
+
+        $ret = $zkh->set_acl($acl_node_path, $digest_acl);
+        ok((!$ret and $zkh->get_error() == ZNOAUTH and $! eq ''),
+           'set_acl(): ACL unchanged if no auth');
+    }
+
+
+    ## add_auth(), set_acl()
+
+    $ret = $zkh->add_auth('digest', '');
+    ok($ret,
+       'add_auth(): empty digest cert');
+
+    SKIP: {
+        skip 'ZooKeeper skipping ACLs', 1 unless (!$skip_acl);
+
+        my $ret = $zkh->set($acl_node_path, 'foo');
+        ok((!$ret and $zkh->get_error() == ZNOAUTH and $! eq ''),
+           'set(): node value unchanged if no auth');
+    }
+
+    $ret = $zkh->add_auth('digest', "$username:$password");
+    ok($ret,
+       'add_auth(): valid digest cert');
+
+    SKIP: {
+        skip 'ZooKeeper skipping ACLs', 13 unless (!$skip_acl);
+
+        my $ret = $zkh->set($acl_node_path, 'baz');
+        ok($ret,
+           'set(): set node value with auth');
+
+        my $node = $zkh->get($acl_node_path);
+        is($node, 'baz',
+           'get(): retrieved node value with auth');
+
+        $ret = $zkh->set_acl($acl_node_path, $digest_acl);
+        ok($ret,
+           'set_acl(): set digest ACL with auth');
+
+        my $stat = $zkh->stat();
+
+        my @acl = ('abc');
+        @acl = $zkh->get_acl($acl_node_path, 'stat' => $stat);
+        is_deeply(\@acl, $digest_acl,
+                  'get_acl(): retrieved digest ACL with auth');
+
+        is($stat->{'data_len'}, 3,
+           'get_acl(): retrieved digest ACL with stat handle and auth');
+
+        SKIP: {
+            skip 'invalid node data', 2 unless ($stat->{'version'} == 1);
+
+            my $ret = $zkh->set_acl($acl_node_path, $digest_acl,
+                                    'version' => $stat->{'version'});
+            ok($ret,
+               'set_acl(): set digest ACL with matching version with auth');
+
+            $ret = $zkh->set_acl($acl_node_path, $digest_acl,
+                                 'version' => $stat->{'version'});
+            ok((!$ret and $zkh->get_error() == ZBADVERSION and $! eq ''),
+               'set_acl(): ACL unchanged if non-matching version');
+        }
+
+        my $child_node_path = "$acl_node_path/c1";
+
+        my $path = $zkh->create($child_node_path, 'foo',
+                                'acl' => ZOO_OPEN_ACL_UNSAFE);
+        ok((!defined($path) and $zkh->get_error() == ZNOAUTH and $! eq ''),
+           'create(): undef when attempting to create node if no auth');
+
+        $digest_acl->[1]->{'perms'} |= ZOO_PERM_CREATE;
+        $digest_acl->[2]->{'perms'} &= ~ZOO_PERM_CREATE;
+
+        $ret = $zkh->set_acl($acl_node_path, $digest_acl);
+        ok($ret,
+           'set_acl(): set changed digest ACL with auth');
+
+        $path = $zkh->create($child_node_path, 'foo',
+                             'acl' => ZOO_OPEN_ACL_UNSAFE);
+        is($path, $child_node_path,
+           'create(): created node with auth');
+
+        $ret = $zkh->delete($child_node_path);
+        ok((!$ret and $zkh->get_error() == ZNOAUTH and $! eq ''),
+           'delete(): no deletion of node if no auth');
+
+        $digest_acl->[1]->{'perms'} |= ZOO_PERM_DELETE;
+        pop @{$digest_acl};
+
+        $ret = $zkh->set_acl($acl_node_path, $digest_acl);
+        ok($ret,
+           'set_acl(): set reduced digest ACL with auth');
+
+        $ret = $zkh->delete($child_node_path);
+        ok($ret,
+           'delete(): deleted node with auth');
+    }
+
+
+    ## cleanup
+
+    $ret = $zkh->delete($acl_node_path);
+    diag(sprintf('unable to delete node with digest auth ACL %s: %d, %s',
+                 $acl_node_path, $zkh->get_error(), $!)) unless ($ret);
+
+    $ret = $zkh->delete($node_path);
+    diag(sprintf('unable to delete node %s: %d, %s',
+                 $node_path, $zkh->get_error(), $!)) unless ($ret);
+}
+
+SKIP: {
+    my $zkh = Net::ZooKeeper->new($hosts);
+
+    my $ret = $zkh->exists($root_path) if (defined($zkh));
+
+    skip 'no connection to ZooKeeper', 1 unless
+        (defined($ret) and $ret);
+
+
+    ## add_auth()
+
+    $ret = $zkh->add_auth('foo', 'bar');
+    my $err = $zkh->get_error();
+    ok((!$ret and
+        ($err == ZAUTHFAILED or
+         $err == ZCONNECTIONLOSS or
+         $err == ZSESSIONEXPIRED)
+        and $! eq ''),
+       'set_acl(): invalid scheme');
+}
+

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/zookeeper-contrib/zookeeper-contrib-zkperl/t/60_watch.t
----------------------------------------------------------------------
diff --git a/zookeeper-contrib/zookeeper-contrib-zkperl/t/60_watch.t b/zookeeper-contrib/zookeeper-contrib-zkperl/t/60_watch.t
new file mode 100644
index 0000000..7d30602
--- /dev/null
+++ b/zookeeper-contrib/zookeeper-contrib-zkperl/t/60_watch.t
@@ -0,0 +1,304 @@
+# Net::ZooKeeper - Perl extension for Apache ZooKeeper
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+use File::Spec;
+use Test::More tests => 30;
+
+BEGIN { use_ok('Net::ZooKeeper', qw(:all)) };
+
+
+my $test_dir;
+(undef, $test_dir, undef) = File::Spec->splitpath($0);
+require File::Spec->catfile($test_dir, 'util.pl');
+
+my($hosts, $root_path, $node_path) = zk_test_setup(0);
+
+
+SKIP: {
+    my $zkh = Net::ZooKeeper->new($hosts);
+
+    my $path = $zkh->create($node_path, 'foo',
+                            'acl' => ZOO_OPEN_ACL_UNSAFE) if (defined($zkh));
+
+    skip 'no connection to ZooKeeper', 20 unless
+        (defined($path) and $path eq $node_path);
+
+
+    ## exists()
+
+    $zkh->{'watch_timeout'} = 100;
+
+    my $watch = $zkh->watch();
+
+    my $ret = $zkh->exists($node_path, 'watch' => $watch);
+    ok($ret,
+       'exists(): checked node existence with watch handle');
+
+    $ret = $watch->wait();
+    ok(!$ret,
+       'wait(): watch after checking node existence timed out');
+
+    $ret = $zkh->exists($node_path, 'watch' => $watch);
+    ok($ret,
+       'exists(): checked node existence with renewed watch handle');
+
+    $ret = $watch->wait();
+    ok(!$ret,
+       'wait(): watch after checking node existence timed out with ' .
+       'renewed watch handle');
+
+    undef $watch;
+    ok(!defined($watch),
+       'undef: released watch handle');
+
+    my $pending_watches = $zkh->{'pending_watches'};
+    is($pending_watches, 2,
+       '_zk_release_watches(): report pending watches');
+
+
+    ## get_children()
+
+    $watch = $zkh->watch('timeout' => 50);
+
+    my $num_children = $zkh->get_children($node_path, 'watch' => $watch);
+    ok((defined($num_children) and $num_children == 0),
+       'get_children(): retrieved zero count of child nodes with ' .
+       'watch handle');
+
+    $ret = $watch->wait();
+    ok(!$ret,
+       'wait(): watch after retrieving child nodes timed out with ' .
+       'watch handle');
+
+    $watch->{'timeout'} = 100;
+
+    my @child_paths = $zkh->get_children($node_path, 'watch' => $watch);
+    ok((@child_paths == 0),
+       'get_children(): retrieved empty list of child nodes with ' .
+       'renewed watch handle');
+
+    $ret = $watch->wait();
+    ok(!$ret,
+       'wait(): watch after retrieving child nodes timed out with ' .
+       'renewed watch handle');
+
+    $pending_watches = $zkh->{'pending_watches'};
+    is($pending_watches, 4,
+       '_zk_release_watches(): report pending watches');
+
+
+    ## get()
+
+    $watch = $zkh->watch();
+
+    my $node = $zkh->get($node_path, 'watch' => $watch);
+    is($node, 'foo',
+       'get(): retrieved node value with watch handle');
+
+    $ret = $watch->wait('timeout' => 0);
+    ok(!$ret,
+       'wait(): watch after retrieving node value timed out with ' .
+       'watch handle');
+
+    $node = $zkh->get($node_path, 'watch' => $watch);
+    is($node, 'foo',
+       'get(): retrieved node value with renewed watch handle');
+
+    $ret = $watch->wait();
+    ok(!$ret,
+       'wait(): watch after retrieving node value timed out with ' .
+       'renewed watch handle');
+
+    $pending_watches = $zkh->{'pending_watches'};
+    is($pending_watches, 6,
+       '_zk_release_watches(): all watches pending');
+
+
+    ## _zk_release_watches()
+
+    $ret = $zkh->DESTROY();
+    ok($ret,
+       'DESTROY(): destroyed handle with pending watches');
+
+    my $event = $watch->{'event'};
+    is($event, 0,
+       '_zk_release_watches(): watch not destroyed when tied to watch handle');
+
+    $zkh = Net::ZooKeeper->new($hosts);
+
+    SKIP: {
+        my $ret = $zkh->exists($node_path, 'watch' => $watch);
+
+        skip 'no connection to ZooKeeper', 2 unless
+            (defined($ret) and $ret);
+
+        ok($ret,
+           'exists(): checked node existence with renewed watch handle ' .
+           'from prior connection');
+
+        $ret = $watch->wait();
+        ok(!$ret,
+           'wait(): watch after checking node existence timed out with ' .
+           'renewed watch handle from prior connection');
+
+
+    }
+}
+
+my $pid = fork();
+
+SKIP: {
+    skip 'unable to fork', 4 unless (defined($pid));
+
+    my $zkh = Net::ZooKeeper->new($hosts);
+
+    my $ret = $zkh->exists($node_path) if (defined($zkh));
+
+    if ($pid == 0) {
+        ## child process
+
+        my $code = 0;
+
+        if (defined($ret) and $ret) {
+            sleep(1);
+
+            my $ret = $zkh->set($node_path, 'foo');
+
+            diag(sprintf('set(): failed in child process: %d, %s',
+                         $zkh->get_error(), $!)) unless ($ret);
+
+            $code = !$ret;
+
+            sleep(1);
+
+            my $path = $zkh->create("$node_path/c", 'foo',
+                                    'acl' => ZOO_OPEN_ACL_UNSAFE);
+
+            diag(sprintf('create(): failed in child process: %d, %s',
+                         $zkh->get_error(), $!)) unless
+                (defined($path) and $path eq "$node_path/c");
+
+            $code &= !$ret;
+
+            sleep(1);
+
+            $ret = $zkh->delete("$node_path/c");
+
+            diag(sprintf('delete(): failed in child process: %d, %s',
+                         $zkh->get_error(), $!)) unless ($ret);
+
+            $code &= !$ret;
+
+            sleep(1);
+
+            $ret = $zkh->set($node_path, 'foo');
+
+            diag(sprintf('set(): failed in child process: %d, %s',
+                         $zkh->get_error(), $!)) unless ($ret);
+
+            $code &= !$ret;
+        }
+
+        exit($code);
+    }
+    else {
+        ## parent process
+
+        SKIP: {
+            skip 'no connection to ZooKeeper', 9 unless
+                (defined($ret) and $ret);
+
+            my $watch = $zkh->watch('timeout' => 5000);
+
+
+            ## wait()
+
+            my $ret = $zkh->exists($node_path, 'watch' => $watch);
+            ok($ret,
+               'exists(): checked node existence with watch handle ' .
+               'in parent');
+
+            $ret = $watch->wait();
+            ok(($ret and $watch->{'event'} == ZOO_CHANGED_EVENT and
+                $watch->{'state'} == ZOO_CONNECTED_STATE),
+               'wait(): waited for event after checking node existence');
+
+            my $num_children = $zkh->get_children($node_path,
+                                                 'watch' => $watch);
+            ok((defined($num_children) and $num_children == 0),
+               'get_children(): retrieved zero count of child nodes with ' .
+               'watch handle in parent');
+
+            $ret = $watch->wait();
+            ok(($ret and $watch->{'event'} == ZOO_CHILD_EVENT and
+                $watch->{'state'} == ZOO_CONNECTED_STATE),
+               'wait(): waited for create child event after ' .
+               'retrieving child nodes');
+
+            my @child_paths = $zkh->get_children($node_path,
+                                                'watch' => $watch);
+            ok((@child_paths == 1 and $child_paths[0] eq 'c'),
+               'get_children(): retrieved list of child nodes with ' .
+               'watch handle in parent');
+
+            $ret = $watch->wait();
+            ok(($ret and $watch->{'event'} == ZOO_CHILD_EVENT and
+                $watch->{'state'} == ZOO_CONNECTED_STATE),
+               'wait(): waited for delete child event after ' .
+               'retrieving child nodes');
+
+            my $node = $zkh->get($node_path, 'watch' => $watch);
+            is($node, 'foo',
+               'get(): retrieved node value with watch handle in parent');
+
+            $ret = $watch->wait();
+            ok(($ret and $watch->{'event'} == ZOO_CHANGED_EVENT and
+                $watch->{'state'} == ZOO_CONNECTED_STATE),
+               'wait(): waited for event after retrieving node value');
+
+            undef $watch;
+
+            my $pending_watches = $zkh->{'pending_watches'};
+            is($pending_watches, 0,
+               '_zk_release_watches(): no watches pending');
+        }
+
+        my $reap = waitpid($pid, 0);
+
+        diag(sprintf('child process failed: exit %d, signal %d%s',
+                     ($? >> 8), ($? & 127),
+                     (($? & 128) ? ', core dump' : ''))) if
+            ($reap == $pid and $? != 0);
+    }
+}
+
+
+## cleanup
+
+{
+    my $zkh = Net::ZooKeeper->new($hosts);
+
+    my $ret = $zkh->exists($node_path) if (defined($zkh));
+
+    if (defined($ret) and $ret) {
+        $ret = $zkh->delete($node_path);
+        diag(sprintf('unable to delete node %s: %d, %s',
+                     $node_path, $zkh->get_error(), $!)) unless ($ret);
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/zookeeper-contrib/zookeeper-contrib-zkperl/t/util.pl
----------------------------------------------------------------------
diff --git a/zookeeper-contrib/zookeeper-contrib-zkperl/t/util.pl b/zookeeper-contrib/zookeeper-contrib-zkperl/t/util.pl
new file mode 100644
index 0000000..1ca738d
--- /dev/null
+++ b/zookeeper-contrib/zookeeper-contrib-zkperl/t/util.pl
@@ -0,0 +1,62 @@
+# Net::ZooKeeper - Perl extension for Apache ZooKeeper
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+sub zk_test_setup
+{
+    my $verbose = shift;
+
+    $SIG{'PIPE'} = 'IGNORE';
+
+    my $hosts = $ENV{'ZK_TEST_HOSTS'};
+    unless (defined($hosts) and $hosts =~ /\S/) {
+        $hosts = 'localhost:0';
+        diag('no ZooKeeper hostnames specified in ZK_TEST_HOSTS env var, ' .
+             "using $hosts") if ($verbose);
+    }
+
+    my $root_path = $ENV{'ZK_TEST_PATH'};
+    if (defined($root_path) and $root_path =~ /^\//) {
+        $root_path =~ s/\/+/\//g;
+        $root_path =~ s/\/$//;
+    }
+    else {
+        $root_path = '/';
+        diag('no ZooKeeper path specified in ZK_TEST_PATH env var, ' .
+             'using root path') if ($verbose);
+    }
+
+    my $node_path = $root_path . (($root_path =~ /\/$/) ? '' : '/') .
+        '_net_zookeeper_test';
+
+    return ($hosts, $root_path, $node_path);
+}
+
+sub zk_acl_test_setup
+{
+    my $username = '_net_zookeeper_test';
+
+    my $password = 'test';
+
+    ## digest is Base64-encoded SHA1 digest of username:password
+    my $digest = '2qi7Erp2cXYLGcQbXADiwUFaOGo=';
+
+    return ($username, $password, $digest);
+}
+
+1;
+    

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/zookeeper-contrib/zookeeper-contrib-zkperl/typemap
----------------------------------------------------------------------
diff --git a/zookeeper-contrib/zookeeper-contrib-zkperl/typemap b/zookeeper-contrib/zookeeper-contrib-zkperl/typemap
new file mode 100644
index 0000000..84636fd
--- /dev/null
+++ b/zookeeper-contrib/zookeeper-contrib-zkperl/typemap
@@ -0,0 +1,38 @@
+# Net::ZooKeeper - Perl extension for Apache ZooKeeper
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+TYPEMAP
+Net::ZooKeeper	T_ZK_HANDLE
+Net::ZooKeeper::Stat	T_ZK_HANDLE
+Net::ZooKeeper::Watch	T_ZK_HANDLE
+
+INPUT
+T_ZK_HANDLE
+	if (SvROK($arg) && SvTYPE(SvRV($arg)) == SVt_PVHV &&
+	    sv_derived_from($arg, \"${ntype}\")) {
+	    $var = (HV*) SvRV($arg);
+	}
+	else {
+	    Perl_croak(aTHX_
+                       \"$var is not a hash reference of type ${ntype}\");
+	}
+
+OUTPUT
+T_ZK_HANDLE
+	NOT_IMPLEMENTED
+

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/zookeeper-contrib/zookeeper-contrib-zkpython/README
----------------------------------------------------------------------
diff --git a/zookeeper-contrib/zookeeper-contrib-zkpython/README b/zookeeper-contrib/zookeeper-contrib-zkpython/README
new file mode 100644
index 0000000..89d9998
--- /dev/null
+++ b/zookeeper-contrib/zookeeper-contrib-zkpython/README
@@ -0,0 +1,109 @@
+Early version of ZooKeeper bindings for Python. All functions are imported as methods into the zookeeper module.
+
+Please do not rely on APIs staying constant in the short term. The handling of exceptions and failure modes is one area that is subject to change. 
+
+DEPENDENCIES:
+-------------
+
+This has only been tested against SVN (i.e. 3.2.0 in development) but should work against 3.1.1. 
+
+You will need the Python development headers installed to build the module - on many package-management systems, these can be found in python-devel.
+
+Python >= 2.6 is required. We have tested against 2.6. We have not tested against 3.x. 
+
+BUILD AND INSTALL:
+-------------------
+
+To install, make sure that the C client has been built and that the libraries are installed in /usr/local/lib (or change this directory in setup.py). Then run:
+
+ant install
+
+from zookeeper/src/contrib/zkpython/.
+
+To test, run ant test from the same directory. 
+
+You can compile the module without installing by running
+
+ant compile
+
+In order to use the module, zookeeper.so must be in your PYTHONPATH or in one of the directories referenced by sys.path. Running ant install should make sure that this is the case, but if you only run ant compile you probably need to add build/contrib/zkpython/* to PYTHONPATH to find the module. The C client libraries must be in a system library path, or LD_LIBRARY_PATH or DYLD_LIBRARY_PATH (Mac OS) for the module to work correctly, otherwise you will see a library not found error when trying to import the module. 
+
+NAMING CONVENTIONS:
+--------------------
+
+All methods that in the C library are zoo_fn_name have been implemented as zookeeper.fn_name. The exception is any function that has a watch function argument is named without the 'w' prefix (for example, zoo_wexists becomes zookeeper.exists). The variants of these functions without the watch argument (i.e. zoo_exists) have not been implemented on the understanding that they are superseded by the zoo_w* API. 
+
+Enums and integer constants that begin ZOO_int_name are named as zookeeper.int_name.
+
+PARAMETER CHANGES:
+------------------
+
+Zookeeper handles are represented as integers to avoid marshalling the entire structure for every call. Therefore they are opaque from Python. 
+
+Any parameter that is used to provide arguments to callback methods is not exposed in the API. Python provides better mechanisms for providing a closure to be called in the future.
+
+Every callback gets passed the handle of the ZooKeeper instance used to register the callback.
+
+DATA TYPES:
+-----------
+
+ACL_vectors are lists of dictionaries. Stat structures are dictionaries. String_vectors are lists of strings.
+
+EXCEPTIONS AND ERROR HANDLING:
+------------------------------
+
+Currently synchronous calls indicate failure by throwing an exception (note that this includes the synchronous calls to set up asynchronous completion callbacks!). Success is returned as an integer. 
+
+Callbacks signify failure by having the integer response code passed in. 
+
+WHAT'S NEW IN 0.4:
+------------------
+
+More test coverage. 
+
+Better reference counting, fixing at least two serious bugs.
+
+Out-of-range zhandles are now checked, fixing a potential security hole.
+
+Docstrings! Editing and cleanup required, but most of the text is there.
+
+zookeeper.set_watcher is now implemented correctly.
+
+zookeeper.client_id is now implemented correctly. zookeeper.init now respects the client_id parameter.
+
+get_context and set_context have been removed from the API. The context mechanism is used by PyZK to store the callables that are dispatched by C-side watchers. Messing with this from Python-side causes bugs very quickly. You should wrap all desired context up in a callable and then use zookeeper.set_watcher to attach it to the global watcher. 
+
+Many methods now have optional parameters (usually if you can specify a watch, it's optional). The only time where genuinely optional parameters are still mandatory is when a required parameters comes after it. Currently we still respect the ZK C client parameter ordering. For example, you can simply connect with zookeeper.init("host:port") and ignore the other three parameters.
+
+
+WHAT'S NEW IN 0.3:
+------------------
+
+Some tests in zkpython/test. More to follow!
+
+A variety of bugfixes.
+
+Changed the way methods return results - all responses are integers now, for the client to convert to a string if it needs.
+
+WHAT'S NEW IN 0.2:
+------------------
+
+The asynchronous API is now implemented (see zookeeper.a*).
+
+Most enums defined in zookeeper.h are now added as constants to the module.
+
+_set2 and a few other edge API calls have been implemented. The module is now nearly 100% feature complete!
+
+A reference count error was tracked down and killed. More probably lurk in there!
+
+WHAT'S NOT DONE / KNOWN ISSUES / FUTURE WORK:
+---------------------------------------------
+
+1. There may well be more memory leaks / reference count issues; however I am more confident that common paths are relatively safe. 
+2. There probably needs to be a more Pythonic Python-side wrapper for these functions (e.g. a zookeeper object, the ability to iterate through a tree of zk nodes)
+3. Docstrings need a cleanup.
+4. The way exceptions and error codes are returned needs looking at. Currently synchronous calls throw exceptions on everything but ZOK return, but asynchronous completions are simply passed the error code. Async. functions should never throw an exception on the C-side as they are practically impossible to catch. For the sync. functions, exceptions seem more reasonable, but some cases are certainly not exceptional. 
+
+Bug reports / comments very welcome!
+
+Henry Robinson henry@cloudera.com

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/zookeeper-contrib/zookeeper-contrib-zkpython/build.xml
----------------------------------------------------------------------
diff --git a/zookeeper-contrib/zookeeper-contrib-zkpython/build.xml b/zookeeper-contrib/zookeeper-contrib-zkpython/build.xml
new file mode 100644
index 0000000..82ff902
--- /dev/null
+++ b/zookeeper-contrib/zookeeper-contrib-zkpython/build.xml
@@ -0,0 +1,111 @@
+<?xml version="1.0"?>
+
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+
+<project name="zkpython" default="install">
+  <import file="../build-contrib.xml"/>
+  <property name="python.src.dir" value="src/python"/>
+  <property name="test.build.dir" value="build/test/" />
+  <property name="test.src.dir" value="src/test"/>
+  <property name="test.log.dir" value="${build.test}/logs" />
+  <property name="test.output" value="no" />
+  <property name="test.timeout" value="900000" />
+
+  <target name="test"
+          depends="compile,test-init,test-category,test-start,python-test,test-stop" />
+	
+    <target name="test-init" depends="checkMainCompiled">
+        <delete dir="${test.log.dir}" />
+        <mkdir dir="${test.log.dir}" />
+    </target>
+
+    <target name="test-start">
+      <exec executable="${test.src.dir}/zkServer.sh" failonerror="true">
+        <arg value="startClean"/>
+      </exec>
+    </target>
+
+    <target name="test-stop">
+      <exec executable="${test.src.dir}/zkServer.sh" failonerror="true">
+        <arg value="stop"/>
+      </exec>
+    </target>
+
+    <target name="test-category">
+         <property name="test.category" value=""/>
+    </target>
+
+    <target name="python-test">
+      <exec executable="${test.src.dir}/run_tests.sh" failonerror="true">
+        <arg value="${test.src.dir}"/>
+        <arg value="${test.log.dir}"/>
+      </exec>
+    </target>
+
+    <target name="compile" depends="ivy-retrieve">
+      <exec executable="python" failonerror="true">
+        <arg value="${python.src.dir}/setup.py"/>
+        <arg value="build"/>
+        <arg value="--build-base=${build.dir}"/>
+      </exec>
+    </target>
+
+    <target name="install" depends="compile">
+      <exec executable="python" failonerror="true">
+        <arg value="${python.src.dir}/setup.py"/>
+        <arg value="build"/>
+        <arg value="--build-base=${build.dir}"/>
+        <arg value="install"/>
+      </exec>
+    </target>
+
+    <target name="package" unless="skip.contrib">
+      <echo message="contrib: ${name}"/>
+
+      <mkdir dir="${build.dir}"/>
+      <copy todir="${build.dir}">
+        <fileset dir="${basedir}">
+          <exclude name="**/VERSION"/>
+        </fileset>
+      </copy>
+      <exec executable="echo" output="${build.dir}/VERSION">
+        <arg line="${version}" />
+      </exec>
+
+      <mkdir dir="${dist.dir}/contrib/${name}"/>
+      <copy todir="${dist.dir}/contrib/${name}">
+        <fileset dir="${build.dir}">
+          <exclude name="**/temp*"/>
+        </fileset>
+      </copy>
+    </target>
+
+    <target name="bin-package" depends="compile, package" unless="skip.contrib">
+    </target>
+
+    <target name="tar-bin" depends="init, compile, bin-package" unless="skip.contrib">
+      <exec executable="python" failonerror="true" dir="${build.dir}">
+        <arg value="${python.src.dir}/setup.py"/>
+        <arg value="build"/>
+        <arg value="--build-base=${build.dir}"/>
+        <arg value="bdist_dumb"/>
+      </exec>
+    </target>
+
+</project>
+

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/zookeeper-contrib/zookeeper-contrib-zkpython/ivy.xml
----------------------------------------------------------------------
diff --git a/zookeeper-contrib/zookeeper-contrib-zkpython/ivy.xml b/zookeeper-contrib/zookeeper-contrib-zkpython/ivy.xml
new file mode 100644
index 0000000..f8bad40
--- /dev/null
+++ b/zookeeper-contrib/zookeeper-contrib-zkpython/ivy.xml
@@ -0,0 +1,35 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+
+<ivy-module version="2.0"
+            xmlns:e="http://ant.apache.org/ivy/extra">
+
+  <info organisation="org.apache.zookeeper"
+        module="${name}" revision="${version}">
+    <license name="Apache 2.0"/>
+    <ivyauthor name="Apache ZooKeeper" url="http://zookeeper.apache.org"/>
+    <description>ZKPython</description>
+  </info>
+
+  <configurations defaultconfmapping="default">
+    <conf name="default"/>
+    <conf name="test"/>
+    <conf name="jdiff" visibility="private"/>
+    <conf name="releaseaudit" visibility="private" description="Artifacts required for releaseaudit target"/>
+  </configurations>
+
+</ivy-module>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/zookeeper-contrib/zookeeper-contrib-zkpython/src/c/pyzk_docstrings.h
----------------------------------------------------------------------
diff --git a/zookeeper-contrib/zookeeper-contrib-zkpython/src/c/pyzk_docstrings.h b/zookeeper-contrib/zookeeper-contrib-zkpython/src/c/pyzk_docstrings.h
new file mode 100644
index 0000000..1f38d53
--- /dev/null
+++ b/zookeeper-contrib/zookeeper-contrib-zkpython/src/c/pyzk_docstrings.h
@@ -0,0 +1,594 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef PYZK_DOCSTRINGS_H
+#define PYZK_DOCSTRINGS_H
+
+const char pyzk_acreate_doc[] = 
+"Create a node asynchronously.\n"
+"\n"
+"This method will create a node in ZooKeeper. A node can only be created if\n"
+"it does not already exists. The Create Flags affect the creation of nodes.\n"
+"If EPHEMERAL flag is set, the node will automatically get removed if the\n"
+"client session goes away. If the SEQUENCE flag is set, a unique\n"
+"monotonically increasing sequence number is appended to the path name.\n"
+"\n"
+" zh: the zookeeper handle obtained by a call to zookeeper.init\n"
+" path: The name of the node. Expressed as a file name with slashes \n"
+"separating ancestors of the node.\n"
+" value: The data to be stored in the node.\n"
+" acl: The initial ACL of the node. If None, the ACL of the parent will be\n"
+"   used.\n"
+"\n"
+" (Subsequent parameters are optional)\n"
+" flags: this parameter can be set to 0 for normal create or an OR\n"
+"   of the Create Flags\n"
+" completion: the routine to invoke when the request completes. The completion\n"
+"will be triggered with one of the following codes passed in as the rc argument:\n"
+"OK operation completed successfully\n"
+"NONODE the parent node does not exist.\n"
+"NODEEXISTS the node already exists\n"
+"NOAUTH the client does not have permission.\n"
+"NOCHILDRENFOREPHEMERALS cannot create children of ephemeral nodes.\n"
+"\n"
+"RETURNS:\n"
+"Returns OK on success or throws of the following errcodes on failure:\n"
+"EXCEPTIONS:\n"
+"BADARGUMENTS - invalid input parameters\n"
+"INVALIDSTATE - zhandle state is either SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+"MARSHALLINGERROR - failed to marshall a request; possibly, out of memory";
+
+static const char pyzk_client_id_doc[] = 
+"Return the client session id, only valid if the connections\n"
+" is currently connected (ie. last watcher state is CONNECTED_STATE)";
+
+static const char pyzk_state_doc[] = 
+"Get the state of the zookeeper connection.\n"
+  "The return value will be one of the State Consts.";
+  
+static const char pyzk_adelete_doc[] = 
+" Delete a node in zookeeper.\n"
+"\n"
+" zh: the zookeeper handle obtained by a call to zookeeper.init\n"
+" path: the name of the node. Expressed as a file name with slashes \n"
+"separating ancestors of the node.\n"
+"\n"
+"(Subsequent parameters are optional)\n"
+" version: the expected version of the node. The function will fail if the\n"
+"   actual version of the node does not match the expected version.\n"
+" If -1 is used the version check will not take place. \n"
+" completion: the routine to invoke when the request completes. The completion\n"
+"will be triggered with one of the following codes passed in as the rc argument:\n"
+"OK operation completed successfully\n"
+"NONODE the node does not exist.\n"
+"NOAUTH the client does not have permission.\n"
+"BADVERSION expected version does not match actual version.\n"
+"NOTEMPTY children are present; node cannot be deleted.\n"
+"Returns OK on success or one of the following errcodes on failure:\n"
+"BADARGUMENTS - invalid input parameters\n"
+"INVALIDSTATE - zhandle state is either SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+  "MARSHALLINGERROR - failed to marshall a request; possibly, out of memory";
+
+static const char pyzk_aexists_doc[] = 
+" checks the existence of a node in zookeeper.\n"
+"\n"
+" zh the zookeeper handle obtained by a call to zookeeper.init\n"
+" path the name of the node. Expressed as a file name with slashes \n"
+"separating ancestors of the node.\n"
+"\n"
+"(Subsequent parameters are optional)\n"
+" watch: if not None, a watch will be set at the server to notify the \n"
+"client if the node changes. The watch will be set even if the node does not \n"
+"exist. This allows clients to watch for nodes to appear.\n"
+"\n"
+" completion: the routine to invoke when the request completes. The completion\n"
+"will be triggered with one of the following codes passed in as the rc argument:\n"
+" OK operation completed successfully\n"
+" NONODE the node does not exist.\n"
+" NOAUTH the client does not have permission.\n"
+" data the data that will be passed to the completion routine when the \n"
+"function completes.\n"
+" OK on success or one of the following errcodes on failure:\n"
+" BADARGUMENTS - invalid input parameters\n"
+" INVALIDSTATE - zhandle state is either SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+" MARSHALLINGERROR - failed to marshall a request; possibly, out of memory";
+
+static const char pyzk_aget_doc[] = 
+"Gets the data associated with a node.\n"
+"\n"
+" zh the zookeeper handle obtained by a call to zookeeper.init\n"
+" path the name of the node. Expressed as a file name with slashes \n"
+"separating ancestors of the node.\n"
+"\n"
+"(Subsequent parameters are optional)\n"
+" watcher if not None, a watch will be set at the server to notify \n"
+"the client if the node changes.\n"
+" completion: the routine to invoke when the request completes. The completion\n"
+"will be triggered with one of the following codes passed in as the rc argument:\n"
+" OK operation completed successfully\n"
+" NONODE the node does not exist.\n"
+" NOAUTH the client does not have permission.\n"
+" data the data that will be passed to the completion routine when \n"
+"the function completes.\n"
+"Returns OK on success or one of the following errcodes on failure:\n"
+" BADARGUMENTS - invalid input parameters\n"
+" INVALIDSTATE - zhandle state is either in SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+  " MARSHALLINGERROR - failed to marshall a request; possibly, out of memory";
+
+static const char pyzk_aset_doc[] = 
+" Sets the data associated with a node.\n"
+"\n"
+" zh the zookeeper handle obtained by a call to zookeeper.init\n"
+" path the name of the node. Expressed as a file name with slashes \n"
+"separating ancestors of the node.\n"
+" buffer the buffer holding data to be written to the node.\n"
+" buflen the number of bytes from buffer to write.\n"
+"\n"
+"(Subsequent parameters are optional)\n"
+" version the expected version of the node. The function will fail if \n"
+"the actual version of the node does not match the expected version. If -1 is \n"
+"used the version check will not take place.\n"
+"completion: If None, \n"
+"the function will execute synchronously. Otherwise, the function will return \n"
+"immediately and invoke the completion routine when the request completes.\n"
+" completion the routine to invoke when the request completes. The completion\n"
+"will be triggered with one of the following codes passed in as the rc argument:\n"
+"OK operation completed successfully\n"
+"NONODE the node does not exist.\n"
+"NOAUTH the client does not have permission.\n"
+"BADVERSION expected version does not match actual version.\n"
+" data the data that will be passed to the completion routine when \n"
+"the function completes.\n"
+"Returns OK on success or one of the following errcodes on failure:\n"
+"BADARGUMENTS - invalid input parameters\n"
+"INVALIDSTATE - zhandle state is either SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+"MARSHALLINGERROR - failed to marshall a request; possibly, out of memory";
+
+static const char pyzk_aget_children_doc[] = 
+" Lists the children of a node.\n"
+"\n"
+"This function is similar to zoo_aget_children except it allows one specify \n"
+"a watcher object rather than a boolean watch flag.\n"
+" \n"
+" zh the zookeeper handle obtained by a call to zookeeper.init\n"
+" path the name of the node. Expressed as a file name with slashes \n"
+"separating ancestors of the node.\n"
+"\n"
+"(Subsequent parameters are optional)\n"
+" watcher if non-null, a watch will be set at the server to notify \n"
+"the client if the node changes.\n"
+"\n"
+" completion the routine to invoke when the request completes. The completion\n"
+"will be triggered with one of the following codes passed in as the rc argument:\n"
+"OK operation completed successfully\n"
+"NONODE the node does not exist.\n"
+"NOAUTH the client does not have permission.\n"
+"\n"
+"Returns OK on success or one of the following errcodes on failure:\n"
+"BADARGUMENTS - invalid input parameters\n"
+"INVALIDSTATE - zhandle state is either SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+"MARSHALLINGERROR - failed to marshall a request; possibly, out of memory";
+
+static const char pyzk_async_doc[] = 
+" Flush leader channel.\n"
+"\n"
+" zh the zookeeper handle obtained by a call to zookeeper.init\n"
+" path the name of the node. Expressed as a file name with slashes\n"
+"separating ancestors of the node.\n"
+" completion the routine to invoke when the request completes. The completion\n"
+"will be triggered with one of the following codes passed in as the rc argument:\n"
+"OK operation completed successfully\n"
+"NONODE the node does not exist.\n"
+"NOAUTH the client does not have permission.\n"
+"\n"
+"Returns OK on success or one of the following errcodes on failure:\n"
+"BADARGUMENTS - invalid input parameters\n"
+"INVALIDSTATE - zhandle state is either SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+  "MARSHALLINGERROR - failed to marshall a request; possibly, out of memory";
+
+const static char pyzk_aget_acl_doc[] = 
+" Gets the acl associated with a node.\n"
+"\n"
+" zh: the zookeeper handle obtained by a call to zookeeper.init\n"
+" path: the name of the node. Expressed as a file name with slashes \n"
+"separating ancestors of the node.\n"
+"\n"
+"(Subsequent parameters are optional)\n"
+" completion: the routine to invoke when the request completes. The completion\n"
+"will be triggered with one of the following codes passed in as the rc argument:\n"
+"OK operation completed successfully\n"
+"NONODE the node does not exist.\n"
+"NOAUTH the client does not have permission.\n"
+"\n"
+"Returns:\n"
+" OK on success or one of the following errcodes on failure:\n"
+" BADARGUMENTS - invalid input parameters\n"
+" INVALIDSTATE - zhandle state is either SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+" MARSHALLINGERROR - failed to marshall a request; possibly, out of memory";
+
+const char pyzk_aset_acl_doc[] = 
+" Sets the acl associated with a node.\n"
+"\n"
+"PARAMETERS:\n"
+" zh: the zookeeper handle obtained by a call to zookeeper.init\n"
+" path: the name of the node. Expressed as a file name with slashes \n"
+"separating ancestors of the node.\n"
+" buffer: the buffer holding the acls to be written to the node.\n"
+" completion: the routine to invoke when the request completes. The completion\n"
+"will be triggered with one of the following codes passed in as the rc argument:\n"
+"OK operation completed successfully\n"
+"NONODE the node does not exist.\n"
+"NOAUTH the client does not have permission.\n"
+"INVALIDACL invalid ACL specified\n"
+"BADVERSION expected version does not match actual version.\n"
+""
+" Returns OK on success or one of the following errcodes on failure:\n"
+" BADARGUMENTS - invalid input parameters\n"
+" INVALIDSTATE - zhandle state is either SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+" MARSHALLINGERROR - failed to marshall a request; possibly, out of memory";
+
+const char pyzk_zerror_doc[] = 
+"Returns an error string corresponding to an integer error code.\n"
+"\n"
+"PARAMETERS:\n"
+" err: Error code\n"
+"RETURNS:\n"
+  " string corresponding to the return code\n";
+
+const char pyzk_add_auth_doc[] = 
+" specify application credentials.\n"
+"\n"
+"The application calls this function to specify its credentials for purposes\n"
+"of authentication. The server will use the security provider specified by \n"
+"the scheme parameter to authenticate the client connection. If the \n"
+"authentication request has failed:\n"
+"- the server connection is dropped\n"
+"- the watcher is called with the AUTH_FAILED_STATE value as the state \n"
+"parameter.\n"
+"\n"
+"PARAMETERS:\n"
+" zh: the zookeeper handle obtained by a call to zookeeper.init\n"
+" scheme the id of authentication scheme. Natively supported:\n"
+"'digest' password-based authentication\n"
+" cert: application credentials. The actual value depends on the scheme.\n"
+" completion: the routine to invoke when the request completes. One of \n"
+"the following result codes may be passed into the completion callback:\n"
+"OK operation completed successfully\n"
+"AUTHFAILED authentication failed \n"
+"\n"
+"RETURNS:\n"
+"OK on success or one of the following errcodes on failure:\n"
+"BADARGUMENTS - invalid input parameters\n"
+"INVALIDSTATE - zhandle state is either SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+"MARSHALLINGERROR - failed to marshall a request; possibly, out of memory\n"
+  "SYSTEMERROR - a system error occurred\n";
+
+const char pyzk_is_unrecoverable_doc[] = 
+" checks if the current zookeeper connection state can't be recovered.\n"
+"\n"
+" The application must close the zhandle and try to reconnect.\n"
+"\n"
+"PARAMETERS:\n"
+" zh the zookeeper handle (see zookeeper.init)\n"
+"\n"
+"RETURNS:\n"
+  "True if connection is unrecoverable, otherwise False\n";
+
+const char pyzk_set_debug_level_doc[] = 
+"\brief sets the debugging level for the library \n"
+"\n"
+"PARAMETERS:\n"
+" logLevel: One of LOG_LEVEL_ERROR, LOG_LEVEL_WARN, LOG_LEVEL_INFO or LOG_LEVEL_DEBUG\n"
+"\n"
+"RETURNS:\n"
+  " None\n";
+
+static const char pyzk_set_log_stream_doc[] = 
+" sets the stream to be used by the library for logging \n"
+"\n"
+"The zookeeper library uses stderr as its default log stream. Applications\n"
+"must make sure the stream is writable. Passing in NULL resets the stream \n"
+  "to its default value (stderr).\n"
+"\n"
+"PARAMETERS:\n"
+" logStream: a writable file object\n"
+"RETURNS:\n"
+" None\n";
+
+static const char pyzk_deterministic_conn_order_doc[] = 
+" enable/disable quorum endpoint order randomization\n"
+"\n"
+"If passed a non-zero value, will make the client connect to quorum peers\n"
+"in the order as specified in the zookeeper.init() call.\n"
+"A zero value causes zookeeper.init() to permute the peer endpoints\n"
+"which is good for more even client connection distribution among the \n"
+"quorum peers.\n"
+"PARAMETERS:\n"
+" yesOrNo\n"
+"\n"
+"RETURNS:\n"
+  " None\n";
+
+static const char pyzk_create_doc[] = 
+" create a node synchronously.\n"
+"\n"
+"This method will create a node in ZooKeeper. A node can only be created if\n"
+"it does not already exists. The Create Flags affect the creation of nodes.\n"
+"If the EPHEMERAL flag is set, the node will automatically get removed if the\n"
+"client session goes away. If the SEQUENCE flag is set, a unique\n"
+"monotonically increasing sequence number is appended to the path name.\n"
+"\n"
+"PARAMETERS:\n"
+" zh: the zookeeper handle obtained by a call to zookeeper.init\n"
+" path: The name of the node. Expressed as a file name with slashes \n"
+"separating ancestors of the node.\n"
+" value: The data to be stored in the node.\n"
+" acl: The initial ACL of the node. If null, the ACL of the parent will be\n"
+"   used.\n"
+" flags: this parameter can be set to 0 for normal create or an OR\n"
+"   of the Create Flags\n"
+" realpath: the real path that is created (this might be different than the\n"
+"   path to create because of the SEQUENCE flag.\n"
+" the maximum length of real path you would want.\n"
+"\n"
+"RETURNS:\n"
+" The actual znode path that was created (may be different from path due to use of SEQUENTIAL\n" 
+" flag).\n"
+"EXCEPTIONS:\n"
+" NONODE the parent node does not exist.\n"
+" NODEEXISTS the node already exists\n"
+" NOAUTH the client does not have permission.\n"
+" NOCHILDRENFOREPHEMERALS cannot create children of ephemeral nodes.\n"
+" BADARGUMENTS - invalid input parameters\n"
+" INVALIDSTATE - zhandle state is either SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+  " MARSHALLINGERROR - failed to marshall a request; possibly, out of memory\n";
+
+static const char pyzk_delete_doc[] = 
+" delete a node in zookeeper synchronously.\n"
+"\n"
+"PARAMETERS:\n"
+" zh the zookeeper handle obtained by a call to zookeeper.init\n"
+" path the name of the node. Expressed as a file name with slashes \n"
+"separating ancestors of the node.\n"
+"\n"
+"(Subsequent parameters are optional)\n"
+" version: the expected version of the node. The function will fail if the\n"
+"   actual version of the node does not match the expected version.\n"
+" If -1 (the default) is used the version check will not take place. \n"
+"\n"
+"RETURNS:\n"
+"One of the following values is returned.\n"
+"OK operation completed successfully\n"
+"NONODE the node does not exist.\n"
+"NOAUTH the client does not have permission.\n"
+"BADVERSION expected version does not match actual version.\n"
+"NOTEMPTY children are present; node cannot be deleted.\n"
+"BADARGUMENTS - invalid input parameters\n"
+"INVALIDSTATE - zhandle state is either SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+  "MARSHALLINGERROR - failed to marshall a request; possibly, out of memory\n";
+
+static const char pyzk_exists_doc[] = 
+" checks the existence of a node in zookeeper synchronously.\n"
+"\n"
+"PARAMETERS:\n"
+" zh: the zookeeper handle obtained by a call to zookeeper.init\n"
+" path: the name of the node. Expressed as a file name with slashes \n"
+"separating ancestors of the node.\n"
+"\n"
+"(Subsequent parameters are optional)\n"
+" watch: if nonzero, a watch will be set at the server to notify the \n"
+"client if the node changes. The watch will be set even if the node does not \n"
+"exist. This allows clients to watch for nodes to appear.\n"
+"\n"
+"RETURNS:\n"
+" the return stat value of the node.\n"
+"EXCEPTIONS:\n"
+"OK operation completed successfully\n"
+"NONODE the node does not exist.\n"
+"NOAUTH the client does not have permission.\n"
+"BADARGUMENTS - invalid input parameters\n"
+"INVALIDSTATE - zhandle state is either SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+  "MARSHALLINGERROR - failed to marshall a request; possibly, out of memory\n";
+
+
+static const char pyzk_get_children_doc[] =
+" lists the children of a node synchronously.\n"
+"\n"
+"PARAMETERS:\n"
+" zh: the zookeeper handle obtained by a call to zookeeper.init\n"
+" path: the name of the node. Expressed as a file name with slashes \n"
+"separating ancestors of the node.\n"
+"\n"
+"(subsequent parameters are optional)\n"
+" watcher: if non-null, a watch will be set at the server to notify \n"
+"the client if the node changes.\n"
+"\n"
+"RETURNS:\n"
+" A list of znode names\n"
+"EXCEPTIONS:\n"
+"NONODE the node does not exist.\n"
+"NOAUTH the client does not have permission.\n"
+"BADARGUMENTS - invalid input parameters\n"
+"INVALIDSTATE - zhandle state is either SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+  "MARSHALLINGERROR - failed to marshall a request; possibly, out of memory\n";
+
+static const char pyzk_set_doc[] = 
+"\n"
+" sets the data associated with a node. See set2 function if\n"
+"you require access to the stat information associated with the znode.\n"
+"\n"
+"PARAMETERS:\n"
+" zh: the zookeeper handle obtained by a call to zookeeper.init\n"
+" path: the name of the node. Expressed as a file name with slashes \n"
+"separating ancestors of the node.\n"
+" buffer: the buffer holding data to be written to the node.\n"
+"\n"
+"(subsequent parameters are optional)\n"
+" version: the expected version of the node. The function will fail if \n"
+"the actual version of the node does not match the expected version. If -1 is \n"
+"used the version check will not take place. \n"
+"\n"
+"RETURNS:\n"
+" the return code for the function call.\n"
+"OK operation completed successfully\n"
+"EXCEPTIONS:\n"
+"NONODE the node does not exist.\n"
+"NOAUTH the client does not have permission.\n"
+"BADVERSION expected version does not match actual version.\n"
+"BADARGUMENTS - invalid input parameters\n"
+"INVALIDSTATE - zhandle state is either SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+  "MARSHALLINGERROR - failed to marshall a request; possibly, out of memory\n";
+
+static const char pyzk_get_acl_doc[] = 
+" gets the acl associated with a node synchronously.\n"
+"\n"
+"PARAMETERS:\n"
+" zh: the zookeeper handle obtained by a call to zookeeper.init\n"
+" path: the name of the node. Expressed as a file name with slashes \n"
+"separating ancestors of the node.\n"
+" acl: the return value of acls on the path.\n"
+"RETURNS:"
+" returns the stat of the path specified.\n"
+"EXCEPTIONS:"
+"NONODE the node does not exist.\n"
+"NOAUTH the client does not have permission.\n"
+"BADARGUMENTS - invalid input parameters\n"
+"INVALIDSTATE - zhandle state is either SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+  "MARSHALLINGERROR - failed to marshall a request; possibly, out of memory\n";
+
+
+static const char pyzk_set_acl_doc[] = 
+" sets the acl associated with a node synchronously.\n"
+"\n"
+"PARAMETERS:\n"
+" zh: the zookeeper handle obtained by a call to zookeeper.init\n"
+" path: the name of the node. Expressed as a file name with slashes \n"
+"separating ancestors of the node.\n"
+" version: the expected version of the path.\n"
+" acl: the acl to be set on the path. \n"
+"\n"
+"RETURNS:\n"
+"OK operation completed successfully\n"
+"EXCEPTIONS:\n"
+"NONODE the node does not exist.\n"
+"NOAUTH the client does not have permission.\n"
+"INVALIDACL invalid ACL specified\n"
+"BADVERSION expected version does not match actual version.\n"
+"BADARGUMENTS - invalid input parameters\n"
+"INVALIDSTATE - zhandle state is either SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+  "MARSHALLINGERROR - failed to marshall a request; possibly, out of memory\n";
+
+static const char pyzk_close_doc[] = 
+" close the zookeeper handle and free up any resources.\n"
+"\n"
+"After this call, the client session will no longer be valid. The function\n"
+"will flush any outstanding send requests before return. As a result it may \n"
+"block.\n"
+"\n"
+"This method should only be called only once on a zookeeper handle. Calling\n"
+"twice will cause undefined (and probably undesirable behavior).\n"
+"\n"
+"PARAMETERS:\n"
+" zh: the zookeeper handle obtained by a call to zookeeper.init\n"
+"RETURNS:\n"
+"Regardless of the error code returned, the zhandle \n"
+"will be destroyed and all resources freed. \n"
+"OK - success\n"
+"EXCEPTIONS:\n"
+"BADARGUMENTS - invalid input parameters\n"
+"MARSHALLINGERROR - failed to marshall a request; possibly, out of memory\n"
+"OPERATIONTIMEOUT - failed to flush the buffers within the specified timeout.\n"
+"CONNECTIONLOSS - a network error occurred while attempting to send request to server\n"
+  "SYSTEMERROR -- a system (OS) error occurred; it's worth checking errno to get details\n";
+
+static const char pyzk_set2_doc[] = 
+"\n"
+" sets the data associated with a node, and returns the associated stat structure.\n" 
+"\n"
+"PARAMETERS:\n"
+" zh: the zookeeper handle obtained by a call to zookeeper.init\n"
+" path: the name of the node. Expressed as a file name with slashes \n"
+"separating ancestors of the node.\n"
+" buffer: the buffer holding data to be written to the node.\n"
+"\n"
+"(subsequent parameters are optional)\n"
+" version: the expected version of the node. The function will fail if \n"
+"the actual version of the node does not match the expected version. If -1 is \n"
+"used the version check will not take place. \n"
+"\n"
+"RETURNS:\n"
+" the stat structure for the target znode\n"
+"OK operation completed successfully\n"
+"EXCEPTIONS:\n"
+"NONODE the node does not exist.\n"
+"NOAUTH the client does not have permission.\n"
+"BADVERSION expected version does not match actual version.\n"
+"BADARGUMENTS - invalid input parameters\n"
+"INVALIDSTATE - zhandle state is either SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+  "MARSHALLINGERROR - failed to marshall a request; possibly, out of memory\n";
+
+static const char pyzk_init_doc[] = 
+"This method creates a new handle and a zookeeper session that corresponds\n"
+"to that handle. Session establishment is asynchronous, meaning that the\n"
+"session should not be considered established until (and unless) an\n"
+"event of state CONNECTED_STATE is received.\n"
+"PARAMETERS:\n"
+" host: comma separated host:port pairs, each corresponding to a zk\n"
+"  server. e.g. '127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002'\n"
+"\n"
+"(subsequent parameters are optional)\n"
+" fn: the global watcher callback function. When notifications are\n"
+"  triggered this function will be invoked.\n"
+" recv_timeout: \n"
+" (clientid, passwd)\n"
+" clientid the id of a previously established session that this\n"
+"  client will be reconnecting to. Clients can access the session id of an established, valid,\n"
+"  connection by calling zoo_client_id. If\n"
+"  the specified clientid has expired, or if the clientid is invalid for \n"
+"  any reason, the returned zhandle_t will be invalid -- the zhandle_t \n"
+"  state will indicate the reason for failure (typically\n"
+"  EXPIRED_SESSION_STATE).\n"
+"\n"
+"RETURNS:\n"
+" an integer handle. If it fails to create \n"
+" a new zhandle the function throws an exception.\n";
+
+static const char pyzk_get_doc[] = 
+" gets the data associated with a node synchronously.\n"
+"\n"
+"\n"
+"PARAMETERS:\n"
+" zh the zookeeper handle obtained by a call to zookeeper.init\n"
+" path the name of the node. Expressed as a file name with slashes \n"
+"separating ancestors of the node.\n"
+"\n"
+"(subsequent parameters are optional)\n"
+" watcher if not None, a watch will be set at the server to notify \n"
+" the client if the node changes.\n"
+" bufferlen: This value defaults to 1024*1024 - 1Mb. This method returns \n"
+" the minimum of bufferlen and the true length of the znode's data. \n"
+"RETURNS:\n"
+" the data associated with the node\n"
+"OK operation completed successfully\n"
+"NONODE the node does not exist.\n"
+"NOAUTH the client does not have permission.\n"
+"BADARGUMENTS - invalid input parameters\n"
+"INVALIDSTATE - zhandle state is either in SESSION_EXPIRED_STATE or AUTH_FAILED_STATE\n"
+  "MARSHALLINGERROR - failed to marshall a request; possibly, out of memory\n";
+
+#endif


Mime
View raw message