I would like to be able to update or create if it doesn't exist a node in Zookeeper. We are using Curator.
I could just do:
CuratorFramework client = ...
String path = "/my/interesting/path";
byte[] data = ...
client.createContainers(path);
client.setData(path, data);
But this isn't transactional. There's also inTransaction(), but that doesn't seem to have any methods like createContainers or even any way to check for existence to do if/else.
Am I missing something? This seems like it should be extremely basic
您可以使用Curator
Utility ZkPaths ,特别是mkdirs
函数。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.