pybind: make the binding aware about rados_nobjects_list_next2().

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
This commit is contained in:
Radoslaw Zarzynski 2021-02-04 20:32:40 +00:00
parent 05dca8aa33
commit da5d4c813f
3 changed files with 18 additions and 4 deletions

View File

@ -191,6 +191,13 @@ cdef extern from "rados/librados.h" nogil:
int rados_nobjects_list_open(rados_ioctx_t io, rados_list_ctx_t *ctx)
int rados_nobjects_list_next(rados_list_ctx_t ctx, const char **entry, const char **key, const char **nspace)
int rados_nobjects_list_next2(rados_list_ctx_t ctx,
const char **entry,
const char **key,
const char **nspace,
size_t *entry_size,
size_t *key_size,
size_t *nspace)
void rados_nobjects_list_close(rados_list_ctx_t ctx)
int rados_ioctx_pool_requires_alignment2(rados_ioctx_t io, int * requires)

View File

@ -267,6 +267,9 @@ cdef nogil:
pass
int rados_nobjects_list_next(rados_list_ctx_t ctx, const char **entry, const char **key, const char **nspace):
pass
int rados_nobjects_list_next2(rados_list_ctx_t ctx, const char **entry, const char **key, const char **nspace,
size_t *entry_size, size_t *key_size, size_t *nspace_size):
pass
void rados_nobjects_list_close(rados_list_ctx_t ctx):
pass

View File

@ -1420,16 +1420,20 @@ cdef class ObjectIterator(object):
const char *key_ = NULL
const char *locator_ = NULL
const char *nspace_ = NULL
size_t key_size_ = 0
size_t locator_size_ = 0
size_t nspace_size_ = 0
with nogil:
ret = rados_nobjects_list_next(self.ctx, &key_, &locator_, &nspace_)
ret = rados_nobjects_list_next2(self.ctx, &key_, &locator_, &nspace_,
&key_size_, &locator_size_, &nspace_size_)
if ret < 0:
raise StopIteration()
key = decode_cstr(key_)
locator = decode_cstr(locator_) if locator_ != NULL else None
nspace = decode_cstr(nspace_) if nspace_ != NULL else None
key = decode_cstr(key_[:key_size_])
locator = decode_cstr(locator_[:locator_size_]) if locator_ != NULL else None
nspace = decode_cstr(nspace_[:nspace_size_]) if nspace_ != NULL else None
return Object(self.ioctx, key, locator, nspace)
def __dealloc__(self):