Commit Graph

9 Commits

Author SHA1 Message Date
Livio Soares 3d88c03e6e rados: Change RadoError Error() interface to provide meaningful string, even for non-default cases GetRadosError().
I got a "rados: ret=-22" message as part of call I made. I'm a bit rusty with my
C stderror codes, which made the error a bit unhelpful.

This commit makes this particular error come out as "rados: invalid argument",
even if we don't need to explicitly create a Rados error variable for invalid
argument case. It does so by using C.strerror().

A further change is that with this, we do not need to explicitly code
RadosErrorNotFound and RadosErrorPermissionsDenied using a different error type
thank RadosError.
2016-03-26 11:50:03 -04:00
Livio Soares 74d77ff49b Fix rados.GetRadosError() interface to allow package-external use.
In Go, the "C" package is a special type of package that creates local symbols
names (non exportable) to the importing package. The result, in the case of
rados.GetRadosError() is that trying to use results in:

cannot use cerr (type C.int) as type rados.C.int in argument to rados.GetRadosError

It seems that "C.int" within 'rados' namespace produces a symbol of the type
`_Ctype_int`, which given it's first character `_` is not exported. As such, we
have the type being defined as `rados._Ctype_int`, which is not accessible
outside of the rados package.

This commit changes the interface to use the native Go `int` type.
2016-03-24 22:37:52 -04:00
Ye Yin 5c2d42ef5a Change return new error for rados and rbd
Signed-off-by: Ye Yin <eyniy@qq.com>
2015-07-24 11:34:18 +08:00
Ye Yin 193dbacdb0 Convert some C error code to Go code, for convenient Golang code to handle error.
Define some Rbd constant variables, to pass to librbd API.
Add test unit for RbdErrorNotFound

Signed-off-by: Ye Yin <eyniy@qq.com>
2015-07-23 15:33:34 +08:00
Abhishek Lekshmanan d63c6698c2 gofmt all the source files
Running gofmt ./... on the repository

Signed-off-by: Abhishek Lekshmanan <abhishek.lekshmanan@gmail.com>
2015-07-08 14:04:54 +05:30
Travis Nielsen 2835eeac35 Add an overload for creating a connection to a cluster other than the default cluster name of "ceph". 2015-06-16 15:32:09 -07:00
Dusty Wilson 9c7193f3ad Added NewConnWithUser to allow users other than the default 2015-02-22 02:54:06 -08:00
Kai Storbeck 0c6bdf8d59 run gofmt on all sources 2015-02-11 22:21:05 +01:00
Noah Watkins 253495ee26 rados: move rados to its own package
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2015-01-12 20:54:02 -08:00