rebase: bump go-ceph version to v0.16.0

go-ceph v0.16.0 contains subvolume metadata APIs and subvolume snapshot
metadata APIs.

Please note, as the APIs can not be tested in the go-ceph CI, it requires
build-tag `ceph_ci_untested`.

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
Prasanna Kumar Kalever
2022-06-15 11:04:25 +05:30
committed by mergify[bot]
parent 025b90f74c
commit 23c324898a
26 changed files with 384 additions and 113 deletions

View File

@ -43,6 +43,11 @@ const (
// CreateIdempotent if used with IOContext.Create() and the object
// already exists, the function will not return an error.
CreateIdempotent = C.LIBRADOS_CREATE_IDEMPOTENT
defaultListObjectsResultSize = 1000
// listEndSentinel is the value returned by rados_list_object_list_is_end
// when a cursor has reached the end of a pool
listEndSentinel = 1
)
//revive:disable:var-naming old-yet-exported public api
@ -302,22 +307,36 @@ type ObjectListFunc func(oid string)
// RadosAllNamespaces before calling this function to return objects from all
// namespaces
func (ioctx *IOContext) ListObjects(listFn ObjectListFunc) error {
var ctx C.rados_list_ctx_t
ret := C.rados_nobjects_list_open(ioctx.ioctx, &ctx)
if ret < 0 {
return getError(ret)
pageResults := C.size_t(defaultListObjectsResultSize)
var filterLen C.size_t
results := make([]C.rados_object_list_item, pageResults)
next := C.rados_object_list_begin(ioctx.ioctx)
if next == nil {
return ErrNotFound
}
defer func() { C.rados_nobjects_list_close(ctx) }()
defer C.rados_object_list_cursor_free(ioctx.ioctx, next)
finish := C.rados_object_list_end(ioctx.ioctx)
if finish == nil {
return ErrNotFound
}
defer C.rados_object_list_cursor_free(ioctx.ioctx, finish)
for {
var cEntry *C.char
ret := C.rados_nobjects_list_next(ctx, &cEntry, nil, nil)
if ret == -C.ENOENT {
return nil
} else if ret < 0 {
ret := C.rados_object_list(ioctx.ioctx, next, finish, pageResults, nil, filterLen, (*C.rados_object_list_item)(unsafe.Pointer(&results[0])), &next)
if ret < 0 {
return getError(ret)
}
listFn(C.GoString(cEntry))
numEntries := int(ret)
for i := 0; i < numEntries; i++ {
item := results[i]
listFn(C.GoStringN(item.oid, (C.int)(item.oid_length)))
}
if C.rados_object_list_is_end(ioctx.ioctx, next) == listEndSentinel {
return nil
}
}
}

View File

@ -1,6 +1,3 @@
//go:build ceph_preview
// +build ceph_preview
package rados
// #cgo LDFLAGS: -lrados
@ -12,7 +9,6 @@ import "C"
// AssertVersion ensures that the object exists and that its internal version
// number is equal to "ver" before reading. "ver" should be a version number
// previously obtained with IOContext.GetLastVersion().
// PREVIEW
//
// Implements:
// void rados_read_op_assert_version(rados_read_op_t read_op,

View File

@ -16,7 +16,6 @@ import (
// SetLocator sets the key for mapping objects to pgs within an io context.
// Until a different locator key is set, all objects in this io context will be placed in the same pg.
// To reset the locator, an empty string must be set.
// PREVIEW
//
// Implements:
// void rados_ioctx_locator_set_key(rados_ioctx_t io, const char *key);

View File

@ -1,6 +1,3 @@
//go:build ceph_preview
// +build ceph_preview
package rados
// #cgo LDFLAGS: -lrados
@ -12,7 +9,6 @@ import "C"
// AssertVersion ensures that the object exists and that its internal version
// number is equal to "ver" before writing. "ver" should be a version number
// previously obtained with IOContext.GetLastVersion().
// PREVIEW
//
// Implements:
// void rados_read_op_assert_version(rados_read_op_t read_op,

View File

@ -1,6 +1,3 @@
//go:build ceph_preview
// +build ceph_preview
package rados
// #cgo LDFLAGS: -lrados
@ -10,7 +7,6 @@ package rados
import "C"
// Remove object.
// PREVIEW
//
// Implements:
// void rados_write_op_remove(rados_write_op_t write_op)

View File

@ -1,6 +1,3 @@
//go:build ceph_preview
// +build ceph_preview
package rados
// #cgo LDFLAGS: -lrados
@ -14,7 +11,6 @@ import (
)
// SetXattr sets an xattr.
// PREVIEW
//
// Implements:
// void rados_write_op_setxattr(rados_write_op_t write_op,

View File

@ -1,6 +1,3 @@
//go:build ceph_preview
// +build ceph_preview
package rados
// #cgo LDFLAGS: -lrados
@ -58,7 +55,6 @@ func (s *ReadOpOmapGetValsByKeysStep) update() error {
// ReadOpOmapGetValsByKeysStep's internal iterator.
// If there are no more elements to retrieve, (nil, nil) is returned.
// May be called only after Operate() finished.
// PREVIEW
func (s *ReadOpOmapGetValsByKeysStep) Next() (*OmapKeyValue, error) {
if !s.canIterate {
return nil, ErrOperationIncomplete
@ -88,7 +84,6 @@ func (s *ReadOpOmapGetValsByKeysStep) Next() (*OmapKeyValue, error) {
}
// GetOmapValuesByKeys starts iterating over specific key/value pairs.
// PREVIEW
//
// Implements:
// void rados_read_op_omap_get_vals_by_keys2(rados_read_op_t read_op,

View File

@ -1,6 +1,3 @@
//go:build ceph_preview
// +build ceph_preview
package rados
// #cgo LDFLAGS: -lrados
@ -49,7 +46,6 @@ func newReadOpReadStep() *ReadOpReadStep {
// Read bytes from offset into buffer.
// len(buffer) is the maximum number of bytes read from the object.
// buffer[:ReadOpReadStep.BytesRead] then contains object data.
// PREVIEW
//
// Implements:
// void rados_read_op_read(rados_read_op_t read_op,

View File

@ -1,6 +1,3 @@
//go:build ceph_preview
// +build ceph_preview
package rados
/*
@ -69,7 +66,6 @@ var (
)
// Watch creates a Watcher for the specified object.
// PREVIEW
//
// A Watcher receives all notifications that are sent to the object on which it
// has been created. It exposes two read-only channels: Events() receives all
@ -103,7 +99,6 @@ func (ioctx *IOContext) Watch(obj string) (*Watcher, error) {
// WatchWithTimeout creates a watcher on an object. Same as Watcher(), but
// different timeout than the default can be specified.
// PREVIEW
//
// Implements:
// int rados_watch3(rados_ioctx_t io, const char *o, uint64_t *cookie,
@ -142,26 +137,22 @@ func (ioctx *IOContext) WatchWithTimeout(oid string, timeout time.Duration) (*Wa
}
// ID returns the WatcherId of the Watcher
// PREVIEW
func (w *Watcher) ID() WatcherID {
return w.id
}
// Events returns a read-only channel, that receives all notifications that are
// sent to the object of the Watcher.
// PREVIEW
func (w *Watcher) Events() <-chan NotifyEvent {
return w.events
}
// Errors returns a read-only channel, that receives all errors for the Watcher.
// PREVIEW
func (w *Watcher) Errors() <-chan error {
return w.errors
}
// Check on the status of a Watcher.
// PREVIEW
//
// Returns the time since it was last confirmed. If there is an error, the
// Watcher is no longer valid, and should be destroyed with the Delete() method.
@ -177,7 +168,6 @@ func (w *Watcher) Check() (time.Duration, error) {
}
// Delete the watcher. This closes both the event and error channel.
// PREVIEW
//
// Implements:
// int rados_unwatch2(rados_ioctx_t io, uint64_t cookie)
@ -203,7 +193,6 @@ func (w *Watcher) Delete() error {
// Notify sends a notification with the provided data to all Watchers of the
// specified object.
// PREVIEW
//
// CAUTION: even if the error is not nil. the returned slices
// might still contain data.
@ -213,7 +202,6 @@ func (ioctx *IOContext) Notify(obj string, data []byte) ([]NotifyAck, []NotifyTi
// NotifyWithTimeout is like Notify() but with a different timeout than the
// default.
// PREVIEW
//
// Implements:
// int rados_notify2(rados_ioctx_t io, const char* o, const char* buf, int buf_len,
@ -246,7 +234,6 @@ func (ioctx *IOContext) NotifyWithTimeout(obj string, data []byte, timeout time.
// Ack sends an acknowledgement with the specified response data to the notfier
// of the NotifyEvent. If a notify is not ack'ed, the originating Notify() call
// blocks and eventiually times out.
// PREVIEW
//
// Implements:
// int rados_notify_ack(rados_ioctx_t io, const char *o, uint64_t notify_id,
@ -276,7 +263,6 @@ func (ne *NotifyEvent) Ack(response []byte) error {
}
// WatcherFlush flushes all pending notifications of the cluster.
// PREVIEW
//
// Implements:
// int rados_watch_flush(rados_t cluster)