go-zookeeper icon indicating copy to clipboard operation
go-zookeeper copied to clipboard

Chroot support?

Open mmcgrana opened this issue 11 years ago • 1 comments

A feature supported by some other Zookeeper clients, including the canonical JVM one, is chroot support. This allows you to create (or move) a connection that's relative to some fixed path prefix, for example "/apps/myapp", Chrooting is discussed in the Zookeeper admin guide here:

https://zookeeper.apache.org/doc/r3.2.2/zookeeperProgrammers.html#ch_zkSessions

Here's the chroot interface for the canonical Java client:

https://zookeeper.apache.org/doc/r3.3.3/api/org/apache/zookeeper/ZooKeeper.html#ZooKeeper(java.lang.String, int, org.apache.zookeeper.Watcher)

What do you think about chroot support in this client?

It would be tricky to support something like this against the current interface of the Go client because we expect a []string of server addrs, instead of the single connection string expected by the Java client. But perhaps we could figure something out. An alternative would be a Chroot(path string) *Conn method on *Conn that returned a new connection chrooted to the given path.

If you're interested in supporting chrooting, I'd consider trying to write a patch for it.

(BTW, thanks for writing and sharing this code!)

mmcgrana avatar Jul 07 '14 15:07 mmcgrana

We also like the chroot feature very much, but it seems that the maintainer didn't want to accept any pr. Finally, we wrap the go-zookeeper connection with chroot. https://github.com/git-hulk/zk_wrapper

git-hulk avatar Sep 20 '17 12:09 git-hulk