Open yonasstephen opened 3 years ago
It is pretty trivial to implement this yourself, perhaps we can have utility functions but I don't think it should be high priority.
deleteAll is not an operation, that map you are referencing is mapping the operations on the wire (the zookeeper protocol) to a name. deleteall is not defined by a zk operation and instead is just implemented as GetChilderen and many Delete calls. You can wrap it in a Multi to get an atomic delete.
Note the Java client doesn't provide a deleteall method. It is only implemented by the cli.
I think they may be best for a utility package zkutil
to match the Java implementation and not added as a method on the client. The expectations should be that a method on the client does a roundtrip to the server and not hide implementations.
Add a
deleteall
implementation to the client. It is especially useful in test to teardown the test nodes. Right now if the nodes have children, using the client, we need to delete recursively. Else would getErrNotEmpty
. I briefly looked at the implementation and this seems to be the start where we can add: https://github.com/go-zookeeper/zk/blob/master/constants.go#L202. Happy to pull a PR if there is a guide on this. Thanks!