Commit Graph

153 Commits

Author SHA1 Message Date
Michael Andersen
59cdfdc5a4 rados: improve support for namespaces 2018-02-03 10:59:54 -08:00
Joannah Nanjekye
35ee127486 Add go vet to Travis 2018-01-30 21:12:42 +03:00
Noah Watkins
bd5bc6d4cb
Merge pull request #48 from immesys/master
Get luminous working
2018-01-04 14:54:52 -06:00
Michael Andersen
a97ce4a032 ioctx: replace functions unimplemented on luminous 2017-12-30 09:35:26 -08:00
Kefu Chai
9db9a99b59 ioctx: compiles on osx
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
2017-10-17 19:44:47 +08:00
Damien Tournoud
03facd6d90 Fix bogus duration handling in IOContext.Lock*
Signed-off-by: Damien Tournoud <damien@platform.sh>
2017-07-28 16:32:25 +02:00
Noah Watkins
616140cd3c Merge pull request #36 from immesys/test-omap-enoent
Add test for ENOENT for omap

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2017-01-20 09:38:21 -08:00
Noah Watkins
022d69c468 ioctx: check high-level error first
the problem was that the C-API was returning an error, but the error
pointer (from the op) was getting -EIO. That makes sense as the outer
error was resulting in junk being decode somewhere.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2017-01-20 09:36:07 -08:00
Michael Andersen
f40720f238 Add test for ENOENT for omap 2017-01-12 17:49:01 -08:00
Emmet Cassidy
628bae93d1 rados: add support for object locking + test 2016-08-03 15:50:34 -07:00
Jared Watts
c08104a20f Add support for mon_command input buffer 2016-07-21 13:07:30 -07:00
Noah Watkins
29d1ad9394 ioctx: fix integer cast
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2016-03-26 11:54:51 -07:00
Noah Watkins
8c0703f5e2 Merge remote-tracking branch 'origin/pr/15' 2016-03-26 11:52:02 -07:00
Noah Watkins
b6a7e80009 Merge remote-tracking branch 'origin/pr/14' 2016-03-26 11:49:28 -07:00
Noah Watkins
a82279dba8 Merge remote-tracking branch 'origin/pr/13' 2016-03-26 11:44:42 -07:00
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
f74dc6c3c6 rados: Use GetRadosError() in lieu of RadosError() so as to guarantee the translation of error codes into rados errors where applicable.
This commit fixes the TestObjectStat() case where a non existing object name is
tested for existance.
2016-03-25 00:59:18 -04:00
Livio Soares
57195e64fe rados_test.go: Improve Stat() test for non existant object name.
The test currently fails since 'RadosErrorNotFound' is not properly returned.
2016-03-25 00:58:11 -04:00
Livio Soares
d5b49dd4ea rados_test.go: Fix import header to allow gofmt to work. 2016-03-25 00:57:23 -04:00
Livio Soares
46f5d61aba Namespace support for Pools.
This commit simply adds a SetNamespace() method to IOContext, allowing users to
perform pool operations in the context of a specific namespace.
2016-03-25 00:42:49 -04:00
Livio Soares
2d33c55c6b rados: Fix iterator memory allocation; allocating a c_entry is not necessary and performed directly by the library. 2016-03-25 00:08:28 -04:00
Livio Soares
373a3043d7 rados: Implement Iter() interface to allow incremental listing of Pools.
The current IOContext struct has a ListObjects() method that works well for
pools with a reasonable number of objects. However, for very large pools, having
finer control over the iteration may be desirable.

This commit adds a new Iter() interface for pools. It allows callers to stop
iterating at any time by issuing a iter.Close(). It also allows callers to
"Seek" into the pool list using a token object.
2016-03-24 23:18:07 -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
Livio Soares
6f8cc46f47 rados/conn: Fix passing of Go allocated pointer to CGO function in MonCommand(), which panics Go 1.6.
Addresses issue #10.
2016-03-24 22:13:09 -04:00
Emmet Cassidy
f251b539c3 added append function and a test 2015-10-28 09:25:11 -07:00
Noah Watkins
3f52ea219a repo: update new repo path
noahdesu -> ceph

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2015-08-31 07:34:42 -07: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
Ye Yin
f39179553f Add rados_write_full function
Signed-off-by: Ye Yin <eyniy@qq.com>
2015-07-20 20:37:32 +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
8e73ca4191 Pass the correct admin user name 2015-06-16 16:10:09 -07:00
Travis Nielsen
c7214b5694 Add a test for connecting with the cluster name and user name 2015-06-16 15:55:12 -07:00
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
Vincent Giersch
b15639c44c ioctx: ListOmapValues & GetAllOmapValues added
* `ListOmapValues` allows to iterate on all the key feteched during
a read operation of an omap (the goal is to easily get the last
read key from the C iterator. This one can then be used in another
call as `startAfter` parameter).
* `GetAllOmapValues` returns all the keys / values of the whole omap
* `GetOmapValues` now uses `ListOmapValues`

Signed-off-by: Vincent Giersch <vincent.giersch@ovh.net>
2015-05-04 14:50:59 +00:00
Noah Watkins
c7a0450712 Merge pull request #15 from gierschv/feat-stat
ioctx: Stat added
2015-04-27 11:32:58 -07:00
Vincent Giersch
476dc4001d ioctx: omap set / get / delete / clear added
Signed-off-by: Vincent Giersch <vincent.giersch@ovh.net>
2015-04-27 15:21:54 +00:00
Vincent Giersch
1779dc795a ioctx: Stat added
Signed-off-by: Vincent Giersch <vincent.giersch@ovh.net>
2015-04-24 12:01:50 +00:00
Abhishek Lekshmanan
68bbcb2f80 ioctx: RmXattr added
Signed-off-by: Abhishek Lekshmanan <abhishek.lekshmanan@gmail.com>
2015-04-09 00:09:27 +05:30
Abhishek Lekshmanan
6324a7917d ioctx: use bytes for ListXattrs
Signed-off-by: Abhishek Lekshmanan <abhishek.lekshmanan@gmail.com>
2015-04-07 14:29:00 +05:30
Abhishek Lekshmanan
ee55aa1810 ioctx: added ListXattrs()
Added a function to List Xattrs, which returns a map of all xattrs set
on an object, errors out otherwise

Signed-off-by: Abhishek Lekshmanan <abhishek.lekshmanan@gmail.com>
2015-04-06 12:39:37 +05:30
Abhishek Lekshmanan
592900cb3a ioctx: get/put xattr added
Added functions GetXattr & SetXattr for getting &/ setting xattrs on
objects in a pool
2015-03-31 15:10:17 +05:30
Dusty Wilson
f8de1c7f5a Added test for NewConnWithUser 2015-02-22 13:09:13 -08: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
Kai Storbeck
563c4eb06d add some comments, drop reflect version 2015-02-11 20:13:35 +01:00
Kai Storbeck
1e0ea49819 Return a []byte pointing to the original C array
This was taken from an example on Go's own wiki (cgo page).
2015-02-11 19:56:41 +01:00
Kai Storbeck
ca76480b0b implemment MonCommand 2015-02-10 22:11:37 +01:00
Kai Storbeck
a06dd37546 implement the MonCommand function 2015-02-10 21:13:56 +01:00
Noah Watkins
f5bfcec122 fix go-rados -> go-ceph renames
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2015-01-14 17:30:46 -08:00
Noah Watkins
44c15bf439 rbd: add rbd package
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2015-01-12 22:15:32 -08:00
Noah Watkins
94b23c6de7 doc: setup docs for multiple packages
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2015-01-12 20:57:40 -08:00
Noah Watkins
ae9281be81 rados: fix import path
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2015-01-12 20:54:17 -08: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