summaryrefslogtreecommitdiffstats
path: root/src/pybind/rados/rados.pyx
diff options
context:
space:
mode:
authorzhangjiao <zhangjiao@cmss.chinamobile.com>2019-11-23 10:38:44 +0100
committerzhangjiao <zhangjiao@cmss.chinamobile.com>2019-12-18 08:58:39 +0100
commite58737cfff1c07741f8474b5a346c08a3834bad3 (patch)
tree627b433a0626095f9e8804726823c0b1e89e8e77 /src/pybind/rados/rados.pyx
parentpybind/rados: add WriteOp::set_xattr() (diff)
downloadceph-e58737cfff1c07741f8474b5a346c08a3834bad3.tar.xz
ceph-e58737cfff1c07741f8474b5a346c08a3834bad3.zip
test/pybind/test_rados.py: add WriteOp::rm_xattr() and test rm_xattr()
Signed-off-by: Zhang Jiao <zhangjiao@cmss.chinamobile.com>
Diffstat (limited to 'src/pybind/rados/rados.pyx')
-rw-r--r--src/pybind/rados/rados.pyx16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/pybind/rados/rados.pyx b/src/pybind/rados/rados.pyx
index 36f41aaf6cb..87110da445e 100644
--- a/src/pybind/rados/rados.pyx
+++ b/src/pybind/rados/rados.pyx
@@ -295,7 +295,8 @@ cdef extern from "rados/librados.h" nogil:
void rados_write_op_omap_clear(rados_write_op_t write_op)
void rados_write_op_set_flags(rados_write_op_t write_op, int flags)
void rados_write_op_setxattr(rados_write_op_t write_op, const char *name, const char *value, size_t value_len)
-
+ void rados_write_op_rmxattr(rados_write_op_t write_op, const char *name)
+
void rados_write_op_create(rados_write_op_t write_op, int exclusive, const char *category)
void rados_write_op_append(rados_write_op_t write_op, const char *buffer, size_t len)
void rados_write_op_write_full(rados_write_op_t write_op, const char *buffer, size_t len)
@@ -2064,6 +2065,19 @@ cdef class WriteOp(object):
with nogil:
rados_write_op_setxattr(self.write_op, _xattr_name, _xattr_value, _xattr_value_len)
+ @requires(('xattr_name', str_type))
+ def rm_xattr(self, xattr_name):
+ """
+ Removes an extended attribute on from an object.
+ :param xattr_name: name of the xattr to remove
+ :type xattr_name: str
+ """
+ xattr_name = cstr(xattr_name, 'xattr_name')
+ cdef:
+ char *_xattr_name = xattr_name
+ with nogil:
+ rados_write_op_rmxattr(self.write_op, _xattr_name)
+
@requires(('to_write', bytes))
def append(self, to_write):
"""