mirror of https://github.com/ceph/go-ceph
rados: make ioctx create internally based on WriteOp Create
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
926e101171
commit
557390fb1d
|
@ -128,15 +128,10 @@ func (ioctx *IOContext) SetNamespace(namespace string) {
|
|||
// void rados_write_op_create(rados_write_op_t write_op, int exclusive,
|
||||
// const char* category)
|
||||
func (ioctx *IOContext) Create(oid string, exclusive CreateOption) error {
|
||||
c_oid := C.CString(oid)
|
||||
defer C.free(unsafe.Pointer(c_oid))
|
||||
|
||||
op := C.rados_create_write_op()
|
||||
C.rados_write_op_create(op, C.int(exclusive), nil)
|
||||
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.Create(exclusive)
|
||||
return op.operateCompat(ioctx, oid)
|
||||
}
|
||||
|
||||
// Write writes len(data) bytes to the object with key oid starting at byte
|
||||
|
|
Loading…
Reference in New Issue