Merge pull request #25766 from tchaikov/wip-rgw-readdir-flags

pybind/rgw: pass the flags to callback function

Reviewed-by: Matt Benjamin <mbenjami@redhat.com>
This commit is contained in:
Kefu Chai 2019-01-03 23:01:29 +08:00 committed by GitHub
commit a3e37c2019
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -154,6 +154,9 @@
* librados::IoCtx::nobjects_begin() and librados::NObjectIterator now communicate
errors by throwing a std::system_error exception instead of std::runtime_error.
* the callback function passed to LibRGWFS.readdir() now accepts a ``flags``
parameter. it will be the last parameter passed to ``readdir()` method.
>=13.1.0
--------

View File

@ -144,7 +144,7 @@ cdef extern from "rados/rgw_file.h" nogil:
int rgw_readdir(rgw_fs *fs,
rgw_file_handle *parent_fh, uint64_t *offset,
bool (*cb)(const char *name, void *arg, uint64_t offset) nogil except? -9000,
bool (*cb)(const char *name, void *arg, uint64_t offset, uint32_t flags) nogil except? -9000,
void *cb_arg, bool *eof, uint32_t flags) except? -9000
int rgw_getattr(rgw_fs *fs,
@ -314,11 +314,11 @@ cdef make_ex(ret, msg):
return Error(msg + (": error code %d" % ret))
cdef bool readdir_cb(const char *name, void *arg, uint64_t offset) \
cdef bool readdir_cb(const char *name, void *arg, uint64_t offset, uint32_t flags) \
except? -9000 with gil:
if exc.PyErr_Occurred():
return False
(<object>arg)(name, offset)
(<object>arg)(name, offset, flags)
return True

View File

@ -29,7 +29,7 @@ def setup_test():
except Exception:
root_dir_handler = rgwfs.mkdir(root_handler, b"bucket", 0)
def cb(name, offset):
def cb(name, offset, flags):
names.append(name)
rgwfs.readdir(root_dir_handler, cb, 0, 0)
for name in names: