go-zookeeper
go-zookeeper copied to clipboard
how to know the value before watch event?
If I watch a path, when the value changed/delete/create, how to know the prev-value and latest value?
no! u should save the value and deal with the value changing
You first read the node data with GetW which returns the lastest value (as you need) and a channel that you listen to new change event on that node. When such an event comes you have to invoke GetW again and get the new latest value and a channel for events. Now, you have the previous value, the latest value and a channel for new events.