go-zookeeper / zk

Native ZooKeeper client for Go
BSD 3-Clause "New" or "Revised" License
512 stars 130 forks source link

Is there any plan for connecting to a readonly zookeeper? #59

Closed linsite closed 2 years ago

linsite commented 3 years ago

The python-client kazoo supports connection to a readonly zookeeper, is there any plan to implement it in go-zookeeper?

GauthierHacout commented 3 years ago

Hello linsite,

Disclaimer: I'm not part of the maintainers of this project, only a wanna be contributor.

There's a PR waiting for appending the read-only flag to the connection request, this should allow you to connect to a read only ZK server. https://github.com/go-zookeeper/zk/pull/57

However the change for now is only adding this flag making you able to to connect to it, but doesn't enforce actual read only behavior, so it would be your responsibility to make sure you don't write to the ZK server or you'll have errors.

linsite commented 3 years ago

Hello linsite,

Disclaimer: I'm not part of the maintainers of this project, only a wanna be contributor.

There's a PR waiting for appending the read-only flag to the connection request, this should allow you to connect to a read only ZK server.

57

However the change for now is only adding this flag making you able to to connect to it, but doesn't enforce actual read only behavior, so it would be your responsibility to make sure you don't write to the ZK server or you'll have errors.

Yes, I totally agree with that. I'll check the PR, thanks.