Now, we don't support ceph versions < nautilus this function
can move to a generic file so that nautilus specific functions
can be written here. Moved GetNamespace() and the corresponding
test function.
Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
The GetLastVersion returns a number representing the most recent
read/write version for the io context.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
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>
In order to avoid external dependencies on implementation details,
this change replaces RadosError with the unexported radosError. In case
some application really needs access to the integer value, it can use
the pattern
var errno interface{ Errno() int }
if errors.As(err, errno) { ... errno.Errno() ... }
Signed-off-by: Sven Anderson <sven@redhat.com>
For more consisistency use getError where possible.
Changes produced using `gofmt -r 'RadosError(int(x)) -> getError(x)`,
followed by a few manual fixups.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This improves the code in two ways: first, it makes the function name and the
return type match. Second, it avoids issues found by go vet converting
from uintptr to unsafe.Pointer without any obvious pointer math.
(See: https://pkg.go.dev/unsafe)
Technically, this is an API breaking change but this function is only
public to exchange the internal ceph structure between the rados and
rbd modules. This had the smallest delta and doesn't feel any more
hacky than what already existed in the code. If someone was using this
function externally then too bad.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Create an object_iter.go from the Iter related functions that were
formerly in ioctx.go. This makes ioctx a little less of a giant wall of
code as well as making things easier to work on in the future.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Create an omap.go from the omap functions that were formerly in
ioctx.go. This makes ioctx a little less of a giant wall of code
as well as making things easier to work on in the future.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
RadosError-prefixes are not recommended, instead just Err as prefix is
used.
Also, errors are constants, not variables.
For existing users, backwards compatible constants are available. These
will need to be removed in a future go-ceph release.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
There is no good reason why the internal error handling support should
be exposed outside the rados package. Make the function lower-cased and
thus private.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
- Use C errno constants in place of hardcoded ints
- Use type inference where possible (especially C.CString
- Don't explicitly specify zero values where value would be default anway
- Rewrap some unnecessarily wrapped short lines
- Use if/else one-liners where value is not needed afterwards
Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
ioctx.read should contact the cluster even when its slice is empty so
that errors like ENOENT can be reported.
Signed-off-by: Noah Watkins <nwatkins@redhat.com>