let's say I want to write out this tree to zookeeper
. a
. / \
. b c
. / \
. d e
some other client could come along and delete node b right after I create it but before I'm able to write node 'd' or 'e'.
Is there a way I can write this hierarchy atomically, or possibly lock a certain path?
You can use the new multi() API
It completes all the operations or aborts them all.
You can coordinate different clients by either electing a leader or maintaining locks You can read a nice description on Zookeeper's recipes on the Netflix curator docs (which is also a nice library to use if you want to do anything with zookeeper)