mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: use v1.17.0 of go-ceph library
new version of go ceph is available and this commit make use of the same. Ref # https://github.com/ceph/go-ceph/releases/tag/v0.17.0 Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
19e4146fab
commit
483181aec2
37
vendor/github.com/ceph/go-ceph/rados/alloc_hint_flags.go
generated
vendored
Normal file
37
vendor/github.com/ceph/go-ceph/rados/alloc_hint_flags.go
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
//go:build ceph_preview
|
||||
// +build ceph_preview
|
||||
|
||||
package rados
|
||||
|
||||
// #cgo LDFLAGS: -lrados
|
||||
// #include <rados/librados.h>
|
||||
//
|
||||
import "C"
|
||||
|
||||
// AllocHintFlags control the behavior of read and write operations.
|
||||
type AllocHintFlags uint32
|
||||
|
||||
const (
|
||||
// AllocHintNoHint indicates no predefined behavior
|
||||
AllocHintNoHint = AllocHintFlags(0)
|
||||
// AllocHintSequentialWrite TODO
|
||||
AllocHintSequentialWrite = AllocHintFlags(C.LIBRADOS_ALLOC_HINT_FLAG_SEQUENTIAL_WRITE)
|
||||
// AllocHintRandomWrite TODO
|
||||
AllocHintRandomWrite = AllocHintFlags(C.LIBRADOS_ALLOC_HINT_FLAG_RANDOM_WRITE)
|
||||
// AllocHintSequentialRead TODO
|
||||
AllocHintSequentialRead = AllocHintFlags(C.LIBRADOS_ALLOC_HINT_FLAG_SEQUENTIAL_READ)
|
||||
// AllocHintRandomRead TODO
|
||||
AllocHintRandomRead = AllocHintFlags(C.LIBRADOS_ALLOC_HINT_FLAG_RANDOM_READ)
|
||||
// AllocHintAppendOnly TODO
|
||||
AllocHintAppendOnly = AllocHintFlags(C.LIBRADOS_ALLOC_HINT_FLAG_APPEND_ONLY)
|
||||
// AllocHintImmutable TODO
|
||||
AllocHintImmutable = AllocHintFlags(C.LIBRADOS_ALLOC_HINT_FLAG_IMMUTABLE)
|
||||
// AllocHintShortlived TODO
|
||||
AllocHintShortlived = AllocHintFlags(C.LIBRADOS_ALLOC_HINT_FLAG_SHORTLIVED)
|
||||
// AllocHintLonglived TODO
|
||||
AllocHintLonglived = AllocHintFlags(C.LIBRADOS_ALLOC_HINT_FLAG_LONGLIVED)
|
||||
// AllocHintCompressible TODO
|
||||
AllocHintCompressible = AllocHintFlags(C.LIBRADOS_ALLOC_HINT_FLAG_COMPRESSIBLE)
|
||||
// AllocHintIncompressible TODO
|
||||
AllocHintIncompressible = AllocHintFlags(C.LIBRADOS_ALLOC_HINT_FLAG_INCOMPRESSIBLE)
|
||||
)
|
2
vendor/github.com/ceph/go-ceph/rados/conn.go
generated
vendored
2
vendor/github.com/ceph/go-ceph/rados/conn.go
generated
vendored
@ -100,7 +100,7 @@ func (c *Conn) ReadDefaultConfigFile() error {
|
||||
func (c *Conn) OpenIOContext(pool string) (*IOContext, error) {
|
||||
cPool := C.CString(pool)
|
||||
defer C.free(unsafe.Pointer(cPool))
|
||||
ioctx := &IOContext{}
|
||||
ioctx := &IOContext{conn: c}
|
||||
ret := C.rados_ioctx_create(c.cluster, cPool, &ioctx.ioctx)
|
||||
if ret == 0 {
|
||||
return ioctx, nil
|
||||
|
5
vendor/github.com/ceph/go-ceph/rados/ioctx.go
generated
vendored
5
vendor/github.com/ceph/go-ceph/rados/ioctx.go
generated
vendored
@ -99,6 +99,11 @@ type LockInfo struct {
|
||||
// IOContext represents a context for performing I/O within a pool.
|
||||
type IOContext struct {
|
||||
ioctx C.rados_ioctx_t
|
||||
|
||||
// Hold a reference back to the connection that the ioctx depends on so
|
||||
// that Go's GC doesn't trigger the Conn's finalizer before this
|
||||
// IOContext is destroyed.
|
||||
conn *Conn
|
||||
}
|
||||
|
||||
// validate returns an error if the ioctx is not ready to be used
|
||||
|
27
vendor/github.com/ceph/go-ceph/rados/ioctx_pool_alignment.go
generated
vendored
Normal file
27
vendor/github.com/ceph/go-ceph/rados/ioctx_pool_alignment.go
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
//go:build ceph_preview
|
||||
// +build ceph_preview
|
||||
|
||||
package rados
|
||||
|
||||
// #cgo LDFLAGS: -lrados
|
||||
// #include <rados/librados.h>
|
||||
// #include <stdlib.h>
|
||||
//
|
||||
import "C"
|
||||
|
||||
// Alignment returns the required stripe size in bytes for pools supporting/requiring it, or an error if unsuccessful.
|
||||
// For an EC pool, a buffer size multiple of its stripe size is required to call Append. To know if the pool requires
|
||||
// alignment or not, use RequiresAlignment.
|
||||
//
|
||||
// Implements:
|
||||
// int rados_ioctx_pool_required_alignment2(rados_ioctx_t io, uint64_t *alignment)
|
||||
func (ioctx *IOContext) Alignment() (uint64, error) {
|
||||
var alignSizeBytes C.uint64_t
|
||||
ret := C.rados_ioctx_pool_required_alignment2(
|
||||
ioctx.ioctx,
|
||||
&alignSizeBytes)
|
||||
if ret != 0 {
|
||||
return 0, getError(ret)
|
||||
}
|
||||
return uint64(alignSizeBytes), nil
|
||||
}
|
27
vendor/github.com/ceph/go-ceph/rados/ioctx_pool_requires_alignment.go
generated
vendored
Normal file
27
vendor/github.com/ceph/go-ceph/rados/ioctx_pool_requires_alignment.go
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
//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
|
||||
}
|
38
vendor/github.com/ceph/go-ceph/rados/ioctx_set_alloc_hint.go
generated
vendored
Normal file
38
vendor/github.com/ceph/go-ceph/rados/ioctx_set_alloc_hint.go
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
//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),
|
||||
))
|
||||
}
|
3
vendor/github.com/ceph/go-ceph/rados/operation.go
generated
vendored
3
vendor/github.com/ceph/go-ceph/rados/operation.go
generated
vendored
@ -7,6 +7,8 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"unsafe"
|
||||
|
||||
"github.com/ceph/go-ceph/internal/log"
|
||||
)
|
||||
|
||||
// The file operation.go exists to support both read op and write op types that
|
||||
@ -116,6 +118,7 @@ func (o *operation) update(kind opKind, ret C.int) error {
|
||||
|
||||
func opStepFinalizer(s opStep) {
|
||||
if s != nil {
|
||||
log.Warnf("unreachable opStep object found. Cleaning up.")
|
||||
s.free()
|
||||
}
|
||||
}
|
||||
|
3
vendor/github.com/ceph/go-ceph/rados/rados.go
generated
vendored
3
vendor/github.com/ceph/go-ceph/rados/rados.go
generated
vendored
@ -9,6 +9,8 @@ import "C"
|
||||
import (
|
||||
"runtime"
|
||||
"unsafe"
|
||||
|
||||
"github.com/ceph/go-ceph/internal/log"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -120,6 +122,7 @@ func NewConnWithClusterAndUser(clusterName string, userName string) (*Conn, erro
|
||||
// called.
|
||||
func freeConn(conn *Conn) {
|
||||
if conn.cluster != nil {
|
||||
log.Warnf("unreachable Conn object has not been shut down. Cleaning up.")
|
||||
C.rados_shutdown(conn.cluster)
|
||||
// prevent calling rados_shutdown() more than once
|
||||
conn.cluster = nil
|
||||
|
3
vendor/github.com/ceph/go-ceph/rados/rados_set_locator.go
generated
vendored
3
vendor/github.com/ceph/go-ceph/rados/rados_set_locator.go
generated
vendored
@ -1,6 +1,3 @@
|
||||
//go:build ceph_preview
|
||||
// +build ceph_preview
|
||||
|
||||
package rados
|
||||
|
||||
// #cgo LDFLAGS: -lrados
|
||||
|
28
vendor/github.com/ceph/go-ceph/rados/write_op_set_alloc_hint.go
generated
vendored
Normal file
28
vendor/github.com/ceph/go-ceph/rados/write_op_set_alloc_hint.go
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
//go:build ceph_preview
|
||||
// +build ceph_preview
|
||||
|
||||
package rados
|
||||
|
||||
// #cgo LDFLAGS: -lrados
|
||||
// #include <rados/librados.h>
|
||||
// #include <stdlib.h>
|
||||
//
|
||||
import "C"
|
||||
|
||||
// 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:
|
||||
// void rados_write_op_set_alloc_hint2(rados_write_op_t write_op,
|
||||
// uint64_t expected_object_size,
|
||||
// uint64_t expected_write_size,
|
||||
// uint32_t flags);
|
||||
func (w *WriteOp) SetAllocationHint(expectedObjectSize uint64, expectedWriteSize uint64, flags AllocHintFlags) {
|
||||
C.rados_write_op_set_alloc_hint2(
|
||||
w.op,
|
||||
C.uint64_t(expectedObjectSize),
|
||||
C.uint64_t(expectedWriteSize),
|
||||
C.uint32_t(flags))
|
||||
}
|
Reference in New Issue
Block a user