mirror of
https://github.com/ceph/go-ceph
synced 2025-01-31 02:21:52 +00:00
f06baa43e5
Add support for getting the alignment (stripe size) in bytes for pools that require/support it. Fixes #739 This commit adds two new API calls to IOContext, one to know if the pool requires alignment and the second one to get the stripe size in bytes: RequiresAlignment() (bool, error) Alignment() (uint64, error) Signed-off-by: Daniel M. Lambea <dmlambea@tenerife.es>
28 lines
768 B
Go
28 lines
768 B
Go
//go:build ceph_preview
|
|
// +build ceph_preview
|
|
|
|
package rados
|
|
|
|
// #cgo LDFLAGS: -lrados
|
|
// #include <rados/librados.h>
|
|
// #include <stdlib.h>
|
|
//
|
|
import "C"
|
|
|
|
// RequiresAlignment returns true if the pool supports/requires alignment or an error if not successful.
|
|
// For an EC pool, a buffer size multiple of its stripe size is required to call Append. See
|
|
// Alignment to know how to get the stripe size for pools requiring it.
|
|
//
|
|
// Implements:
|
|
// int rados_ioctx_pool_requires_alignment2(rados_ioctx_t io, int *req)
|
|
func (ioctx *IOContext) RequiresAlignment() (bool, error) {
|
|
var alignRequired C.int
|
|
ret := C.rados_ioctx_pool_requires_alignment2(
|
|
ioctx.ioctx,
|
|
&alignRequired)
|
|
if ret != 0 {
|
|
return false, getError(ret)
|
|
}
|
|
return (alignRequired != 0), nil
|
|
}
|