Hey Chris this is really great! Thanks for making it available to the
community, very cool.
Chris Darroch wrote:
The http://wiki.apache.org/hadoop/ZooKeeper page includes the
comment that "someday we hope to get Python, Perl, and REST interfaces".
I hope I can help with one item from that list now, at least. I recently
put together a Perl module named Net::ZooKeeper which is now available
Modelled on the DBI module, it provides an interface to ZooKeeper
through the synchronous C API functions, e.g.:
my $zkh = Net::ZooKeeper->new('localhost:7000');
my $ret = $zkh->set('/foo', 'baz');
Net::ZooKeeper currently requires ZooKeeper 3.1.1 (or at least
that version of the C API code) and Perl 5.8.8 or up, including 5.10.x.
The test suite is reasonably complete, I think, and covers a
fair bit of ground. I've found it useful for testing the ZooKeeper
C API as well as learning more than I wanted to know about
I've licensed the module under the Apache license 2.0 so it should
be compatible with ZooKeeper itself if there's interest in including
it under src/contribs.
For those who ask why Perl 5 and not Rakudo/Ruby/Lua/Python/
[insert cool new dynamic language here], the answer is just that I
needed an old-style Perl module first. (As a thought experiment,
though, I wonder if one could write a Parrot extension that communicated
directly with ZooKeeper, handled the ping requests internally via
a Parrot scheduler/thread/whatever, and didn't need the C API at all.
You could support any language running on Parrot with that. Well,
maybe in a few years, anyway. :-)
In the meantime, please report any suggestions or bugs to
me -- thanks!