go-zookeeper / zk

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

Align flags with the CreateMode registered on zookeeper libs #125

Closed alandiegosantos closed 1 week ago

alandiegosantos commented 5 months ago

The flags added were not aligned with the flags from zookeeper repo. This change aligns both to support the multiple CreateModes supported by zookeeper.

Refer to https://github.com/go-zookeeper/zk/issues/119

alxn commented 5 months ago

This is all so weird, I thought these were bit flags, and it sort of makes sense where:

EPHEMERAL(1,
PERSISTENT_SEQUENTIAL(2

1 | 2 == 3

EPHEMERAL_SEQUENTIAL(3

Though I guess "EPHEMERAL/PERSISTENT" is an oxymoron.

But otherwise I guess it makes sense.

Mengyantong commented 5 months ago

Yeah it makes sense by |, currently i used the CreateTTL well by changing my flags into zk.FlagTTL|zk.FlagEphemeral, I also thought it werid and asked the question on stackoverflow a month ago. 👻