go-zookeeper / zk

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

<fix>[constants]: add StateSyncConnected WatchEvent state #127

Closed jeffbean closed 4 months ago

jeffbean commented 5 months ago

NOTE: WatcherEvent State will change from StateUnknown to StateSyncConnected

jeffbean: rebased authored commit from @KaithyRookie to pickup unit test configuration in github.

StateSyncConnected means client is connected to a server in the ensemble

alxn commented 4 months ago

Doesn't this need a call to c.setState somewhere in conn.go ?

jeffbean commented 4 months ago

In this case, The State is actually used as the Field on watcherEvent. In all other cases in this library, the State is client side only (and can be any value).

Example is StateConnected = State(100) was just picked by samuel and can be anything this library wants. But the bug here is that we share this with the proto value for watcherEvent.

so no in this case its only for the wire response here.

jeffbean commented 4 months ago

This does raise the problem of this being a breaking change if folks do switch or conditional logic on the State in a watcher event :(. Like the redis bugfix recently