Exemplo n.º 1
0
// Data returns a slice of the data in the batch. The data
// is not copied and the slice is only valid while the
// WriteBatch is open.
func (w *WriteBatch) Data() []byte {
	var size C.size_t
	p := C.rocksdb_writebatch_data(w.wbatch, &size)
	sliceHeader := &reflect.SliceHeader{
		Data: uintptr(unsafe.Pointer(p)),
		Len:  int(size),
		Cap:  int(size),
	}
	return *(*[]byte)(unsafe.Pointer(sliceHeader))
}
Exemplo n.º 2
0
// Data returns the serialized version of this batch.
func (w *WriteBatch) Data() []byte {
	var cSize C.size_t
	cValue := C.rocksdb_writebatch_data(w.c, &cSize)
	return charToByte(cValue, cSize)
}
Exemplo n.º 3
0
func (w *WriteBatch) Data() []byte {
	var vallen C.size_t
	value := C.rocksdb_writebatch_data(w.wbatch, &vallen)

	return slice(unsafe.Pointer(value), int(vallen))
}