mirror of
https://github.com/ceph/go-ceph
synced 2024-12-12 09:26:52 +00:00
937f8d8164
This commit implements binding for rados_read_op_read RADOS Read operation. Includes a unit test. Signed-off-by: Robert Vasek <robert.vasek@cern.ch>
32 lines
519 B
Go
32 lines
519 B
Go
package rados
|
|
|
|
// #include <stdint.h>
|
|
import "C"
|
|
|
|
import (
|
|
"unsafe"
|
|
)
|
|
|
|
type readStep struct {
|
|
withoutUpdate
|
|
withoutFree
|
|
// the c pointer utilizes the Go byteslice data and no free is needed
|
|
|
|
// inputs:
|
|
b []byte
|
|
|
|
// arguments:
|
|
cBuffer *C.char
|
|
cReadLen C.size_t
|
|
cOffset C.uint64_t
|
|
}
|
|
|
|
func newReadStep(b []byte, offset uint64) *readStep {
|
|
return &readStep{
|
|
b: b,
|
|
cBuffer: (*C.char)(unsafe.Pointer(&b[0])), // TODO: must be pinned
|
|
cReadLen: C.size_t(len(b)),
|
|
cOffset: C.uint64_t(offset),
|
|
}
|
|
}
|