Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deleteall command implementation to the client #52

Open
yonasstephen opened this issue Mar 26, 2021 · 2 comments
Open

Add deleteall command implementation to the client #52

yonasstephen opened this issue Mar 26, 2021 · 2 comments
Labels
enhancement New feature or request proposal

Comments

@yonasstephen
Copy link

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 get ErrNotEmpty. 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!

@nemith
Copy link

nemith commented Mar 26, 2021

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.

@nemith nemith added the enhancement New feature or request label Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request proposal
Projects
None yet
Development

No branches or pull requests

2 participants