Make dialer extensible by making it an interface
pawelbeza opened this issue · 3 comments
Hi,
we'd like to add exponential backoff if zookeeper is not reachable. Currently it's not possible to implement as that would require keeping some state inside dialer, since dialer is currently function it's not viable solution therefore so it would be great to make dialer an interface instead.
Here #95 you can find small PR which makes dialer an interface
I believe you can pass your own dialer using the WithDialer
options func.
https://github.com/go-zookeeper/zk/blob/master/conn.go#L233
Or use ConnectWithDialer
method
@neelayu You can but you cannot store state in it as it is a function not an interface
You can store state with a closure. I believe the existing dialer already fits the standard in the ‘net’ package