On Thu, 9 Apr 2020, John Mulligan wrote:
Hello ceph-devel,
I'm one of the members of the team currently maintaining, and hopefully improving, go-ceph (ceph library bindings for Go) [1].
An issue I keep returning to is the nature of api calls such as: - rados_mon_command - rados_mgr_command - ceph_mds_command ... etc
The argument named cmd for these functions is of type `const char **cmd` and is followed by a `size_t cmdlen`. I'd like to better understand the rationale for array-of-char* strings and how this is intended to be used.
It's purely historical. The command used to be an array of strings/arguments directly from the CLI so that the parsing was done on the mon. Way back when we changed it to JSON, but never cleaned up the message strcture. sage
When I first saw the function I initially thought it was meant to support multiple "commands" getting issued at once but later started thinking that a single command could be split across multiple strings, and experimentation demonstrated that this does indeed work. I've attempted reading the sources but nothing jumps out at me to explain this approach. Most callers of these functions seem to only use a single "command string".
I also tried looking to see how the code makes use of the array (or vector after the transition to C++) but I will admit I'm not very familiar with C++ and get a bit lost in some of the templates and overloading.
Could someone who is familiar with this better explain how this argument and it's type is meant to be used? I want to make sure we're making good use of the apis that ceph provides in the wrapper library, or at the very least I want to make sure we're not mis- using the apis. :-)
Thank you for your time.
1 - https://github.com/ceph/go-ceph
_______________________________________________ Dev mailing list -- dev@ceph.io To unsubscribe send an email to dev-leave@ceph.io