mirror of
https://github.com/ceph/go-ceph
synced 2024-12-22 06:10:09 +00:00
5f38b5422e
Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com>
39 lines
1.0 KiB
Go
39 lines
1.0 KiB
Go
//go:build ceph_preview
|
|
// +build ceph_preview
|
|
|
|
package rados
|
|
|
|
// #cgo LDFLAGS: -lrados
|
|
// #include <rados/librados.h>
|
|
// #include <stdlib.h>
|
|
//
|
|
import "C"
|
|
|
|
import (
|
|
"unsafe"
|
|
)
|
|
|
|
// SetAllocationHint sets allocation hint for an object. This is an advisory
|
|
// operation, it will always succeed (as if it was submitted with a
|
|
// LIBRADOS_OP_FLAG_FAILOK flag set) and is not guaranteed to do anything on
|
|
// the backend.
|
|
//
|
|
// Implements:
|
|
// int rados_set_alloc_hint2(rados_ioctx_t io,
|
|
// const char *o,
|
|
// uint64_t expected_object_size,
|
|
// uint64_t expected_write_size,
|
|
// uint32_t flags);
|
|
func (ioctx *IOContext) SetAllocationHint(oid string, expectedObjectSize uint64, expectedWriteSize uint64, flags AllocHintFlags) error {
|
|
coid := C.CString(oid)
|
|
defer C.free(unsafe.Pointer(coid))
|
|
|
|
return getError(C.rados_set_alloc_hint2(
|
|
ioctx.ioctx,
|
|
coid,
|
|
(C.uint64_t)(expectedObjectSize),
|
|
(C.uint64_t)(expectedWriteSize),
|
|
(C.uint32_t)(flags),
|
|
))
|
|
}
|