rados: add a validate() function to IOContexts

The validate function works similarly to those already found
in rbd and cephfs. It will be used in future functions or
updated functions to ensure the C ioctx is ready for use.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2020-07-29 16:35:27 -04:00 committed by John Mulligan
parent 085e2049b3
commit 9179f8df29

View File

@ -92,6 +92,15 @@ type IOContext struct {
ioctx C.rados_ioctx_t
}
// validate returns an error if the ioctx is not ready to be used
// with ceph C calls.
func (ioctx *IOContext) validate() error {
if ioctx.ioctx == nil {
return ErrNotConnected
}
return nil
}
// Pointer returns a pointer reference to an internal structure.
// This function should NOT be used outside of go-ceph itself.
func (ioctx *IOContext) Pointer() unsafe.Pointer {