Commit Graph

25 Commits

Author SHA1 Message Date
John Mulligan
46ed646e03 rados: support fetching the cluster from the Conn
The cephfs function ceph_create_from_rados requires the cluster_t
value, which is current private to the Conn type. Alias the cluster_t
type and allow other pkgs to get it if needed.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-27 18:30:10 +01:00
John Mulligan
f6d77333b7 rados: fix and update doc comments for PGCommand funcs
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-23 08:09:36 -05:00
John Mulligan
0dfa7bcfac rados: add missing doc comment for OpenIOContext function
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-23 08:09:36 -05:00
John Mulligan
65f2417c4c rados: add doc comment for not connected error
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-23 08:09:36 -05:00
John Mulligan
18dcd69eb6 rados: drop extra else + return indent blocks
Clean up if-return-else-return pattern ocurrances in rados package's
conn.go file.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-22 10:35:02 +01:00
John Mulligan
bb375f68ac rados: convert less-than-zero error checks to getRadosError
A number of the error handling checks do not seem to need to check
for specific non-zero error returns so we should be able to
convert to getRadosError rather than a lot of boiler-plate.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-22 10:35:02 +01:00
John Mulligan
d7bcba78dd rados: use getRadosError where obviously applicable
A number of the functions in rados do not use the simple error
conversion function where is obviously applies. Convert them to use it.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-22 10:35:02 +01:00
Yue Zhu
750fe1830e rados: add support for sending PG commands 2019-12-13 16:30:00 +01:00
John Mulligan
e07f6a6050 rados: replace Println calls with a proper error
Replace the odd calls to Println with a comparable error value.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-13 15:17:27 +01:00
John Mulligan
5ea85a9419
Merge pull request #89 from CodeLingoBot/rewrite
Fix function comments based on best practices from Effective Go
2019-12-11 19:56:20 -05:00
Niels de Vos
09b6977dc9 rados: free cluster runtime resources automatically
Release resources that are allocated while configuring the connection to
the cluster. rados_shutdown() should only be needed after a successful
call to rados_connect(), however if the connection has been configured
with non-default parameters, some of the parameters may be allocated
before connecting. rados_shutdown() will free the allocated resources,
even if there has not been a connection yet.

Note that the finalizers get executed during garbage collection, which
can be forced by calling runtime.GC() for testing.

Fixes: #109
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2019-11-26 09:59:19 -05:00
Niels de Vos
43a863d1cb Add GetPoolByID() for calling rados_pool_reverse_lookup()
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2019-11-01 14:40:47 -04:00
Niels de Vos
bcf44fc782 Add GetPoolByName() for calling rados_pool_lookup()
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2019-11-01 14:40:47 -04:00
CodeLingo Bot
9e2fbe369f Fix function comments based on best practices from Effective Go
Signed-off-by: CodeLingo Bot <bot@codelingo.io>
2019-03-06 03:14:57 +00:00
Dario Maiocchi
caf0f7ed68 Use Guardclause for function 2018-10-09 10:22:02 +02:00
Noah Watkins
6363bf77ae rados: use test suite to share code
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
2018-08-07 18:48:17 -07:00
Noah Watkins
c14a3857fa rados: add a connected flag to the conn obj
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
2018-07-28 14:23:18 -07:00
Jared Watts
c08104a20f Add support for mon_command input buffer 2016-07-21 13:07:30 -07: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
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
253495ee26 rados: move rados to its own package
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2015-01-12 20:54:02 -08:00