mirror of
https://github.com/ceph/go-ceph
synced 2024-12-11 08:57:13 +00:00
c8d8d8c364
Add Write implementing rados_write_op_write. Add WriteFull implementing rados_write_op_write_full. Add WriteSame implementing rados_write_op_writesame. These are some of the basic functions needed to write data to a rados object using a WriteOp. Signed-off-by: John Mulligan <jmulligan@redhat.com>
34 lines
569 B
Go
34 lines
569 B
Go
package rados
|
|
|
|
// #include <stdint.h>
|
|
import "C"
|
|
|
|
import (
|
|
"unsafe"
|
|
)
|
|
|
|
type writeStep struct {
|
|
withoutUpdate
|
|
withoutFree
|
|
// the c pointer utilizes the Go byteslice data and no free is needed
|
|
|
|
// inputs:
|
|
b []byte
|
|
|
|
// arguments:
|
|
cBuffer *C.char
|
|
cDataLen C.size_t
|
|
cWriteLen C.size_t
|
|
cOffset C.uint64_t
|
|
}
|
|
|
|
func newWriteStep(b []byte, writeLen, offset uint64) *writeStep {
|
|
return &writeStep{
|
|
b: b,
|
|
cBuffer: (*C.char)(unsafe.Pointer(&b[0])),
|
|
cDataLen: C.size_t(len(b)),
|
|
cWriteLen: C.size_t(writeLen),
|
|
cOffset: C.uint64_t(offset),
|
|
}
|
|
}
|