rados: add CleanOmap WriteOp function

Reimplement CleanOmap in term of a new CleanOmap function on the
WriteOp.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2020-12-01 16:59:08 -05:00 committed by mergify[bot]
parent f4e0730b8f
commit 570738b24c
2 changed files with 9 additions and 10 deletions

View File

@ -320,14 +320,8 @@ func (ioctx *IOContext) RmOmapKeys(oid string, keys []string) error {
// CleanOmap clears the omap `oid`
func (ioctx *IOContext) CleanOmap(oid string) error {
c_oid := C.CString(oid)
defer C.free(unsafe.Pointer(c_oid))
op := C.rados_create_write_op()
C.rados_write_op_omap_clear(op)
ret := C.rados_write_op_operate(op, ioctx.ioctx, c_oid, nil, 0)
C.rados_release_write_op(op)
return getError(ret)
op := CreateWriteOp()
defer op.Release()
op.CleanOmap()
return op.operateCompat(ioctx, oid)
}

View File

@ -111,3 +111,8 @@ func (w *WriteOp) RmOmapKeys(keys []string) {
roks.cKeys,
roks.cNum)
}
// CleanOmap clears the omap `oid`.
func (w *WriteOp) CleanOmap() {
C.rados_write_op_omap_clear(w.op)
}