Esempio n. 1
0
// Remove an xattr with key `name` from object `oid`
func (ioctx *IOContext) RmXattr(oid string, name string) error {
	c_oid := C.CString(oid)
	c_name := C.CString(name)
	defer C.free(unsafe.Pointer(c_oid))
	defer C.free(unsafe.Pointer(c_name))

	ret := C.rados_rmxattr(
		ioctx.ioctx,
		c_oid,
		c_name)

	return GetRadosError(ret)
}
Esempio n. 2
0
// RemoveAttribute removes an attribute of the object.
func (o *Object) RemoveAttribute(attributeName string) error {
	object := C.CString(o.name)
	attribute := C.CString(attributeName)
	defer freeString(object)
	defer freeString(attribute)

	ret := C.rados_rmxattr(o.ioContext, object, attribute)
	if err := toRadosError(ret); err != nil {
		err.Message = fmt.Sprintf("Unable to get attribute %s of object %s.", attributeName, o.name)
		return err
	}
	return nil
}
Esempio n. 3
0
func (r *RadosIoCtx) RmXattr(oid, name string) error {
	cname := C.CString(name)
	coid := C.CString(oid)
	defer func() {
		C.free(unsafe.Pointer(cname))
		C.free(unsafe.Pointer(coid))
	}()
	cerr := C.rados_rmxattr(*r.ctx, coid, cname)
	if cerr < 0 {
		return errors.New("delete xattr failed")
	}

	return nil
}