<> == What is it? == The gozk project enables [[http://golang.org|Go]] programs to communicate with a [[http://hadoop.apache.org/zookeeper/|ZooKeeper]] cluster. It was developed within Canonical as part of an experiment related to using the Go language with the [[https://juju.ubuntu.com|juju]] project. == API documentation == The API documentation is currently available at: http://go.pkgdoc.org/launchpad.net/gozk/zookeeper == Example == Here is a simple example which connects to !ZooKeeper, waits for the session to be established, and attempts to create a node: {{{ package main import ( "launchpad.net/gozk" ) func main() { zk, session, err := gozk.Init("localhost:2181", 5000) if err != nil { println("Couldn't connect: " + err.String()) return } defer zk.Close() // Wait for connection. event := <-session if event.State != gozk.STATE_CONNECTED { println("Couldn't connect") return } _, err = zk.Create("/counter", "0", 0, gozk.WorldACL(gozk.PERM_ALL)) if err != nil { println(err.String()) } else { println("Created!") } } }}} == Installing == Assuming you have the !ZooKeeper library and headers installed in your system (tested with Ubuntu), you can use goinstall: {{{ $ sudo apt-get install libzookeeper-dev $ goinstall launchpad.net/gozk }}} == Source code == To obtain the source code, use [[http://bazaar.canonical.com|Bazaar]] to download it from Launchpad: {{{ $ bzr branch lp:gozk }}} == Reporting bugs == Please report bugs at: https://launchpad.net/gozk == Running tests == To run tests, you'll have to define at least the `$ZKROOT` environment variable, and point it to the root of your !ZooKeeper source build (`$ZKROOT/bin/zkServer.sh` should exist). Then, install gocheck: {{{ $ goinstall launchpad.net/gocheck }}} Once that's in place, and any other necessary environment variables are defined (see above), run tests with `gotest` as usual: {{{ $ gotest }}} Note that a !ZooKeeper server will be dynamically started and stopped by the test suite. == License == gozk is licensed under the LGPL. == Contact == This project is being developed under the [[https://launchpad.net/ensemble|Ensemble]] project at [[http://www.canonical.com|Canonical]]. To get in touch, send a message to the Ensemble mailing list at: