rados.NewConnWithUser(user string) expects user to be a simple user ID (e.g. admin), while rados.NewConnWithClusterAndUser(clusterName string, userName string) expects userName in the form client.<ID> (e.g. client.admin). Omitting the client. prefix in rados.NewConnWithClusterAndUser() results in a rather obscure rados: ret=22, Invalid argument.
This expectation isn't made clear in the documentation, and would require users to know that rados.NewConnWithUser() uses C.rados_create() while rados.NewConnWithClusterAndUser() uses C.rados_create2(). And even then, the documentation for rados_create2() states:
Like rados_create, but don’t assume ‘client.’+id; allow full specification of name.
which sounds like both formats would be valid.
So I think either
- Documentation should be updated to make it clear which user name format is valid for each function;
rados.NewConnWithUser() and rados.NewConnWithClusterAndUser() should be made to accept both user name formats, i.e. with or without the client. prefix;
- Both functions should use
C.rados_create2() under the hood, meaning both would require user names to include the client. prefix (that would be a breaking change though).
rados.NewConnWithUser(user string)expectsuserto be a simple user ID (e.g.admin), whilerados.NewConnWithClusterAndUser(clusterName string, userName string)expectsuserNamein the formclient.<ID>(e.g.client.admin). Omitting theclient.prefix inrados.NewConnWithClusterAndUser()results in a rather obscurerados: ret=22, Invalid argument.This expectation isn't made clear in the documentation, and would require users to know that
rados.NewConnWithUser()usesC.rados_create()whilerados.NewConnWithClusterAndUser()usesC.rados_create2(). And even then, the documentation for rados_create2() states:which sounds like both formats would be valid.
So I think either
rados.NewConnWithUser()andrados.NewConnWithClusterAndUser()should be made to accept both user name formats, i.e. with or without theclient.prefix;C.rados_create2()under the hood, meaning both would require user names to include theclient.prefix (that would be a breaking change though).