Ejemplo n.º 1
0
func (b *Bitcask) Set(key string, value []byte, flag, version int32) error {
	ckey := C.CString(key)
	defer C.free(unsafe.Pointer(ckey))
	cv := C.CString(string(value))
	defer C.free(unsafe.Pointer(cv))
	if !(0 != (C.bc_set(b.bc, ckey, cv, C.size_t(len(value)),
		C.int(flag), C.int(version)))) {
		return errors.New("set failed")
	}
	return nil
}
Ejemplo n.º 2
0
func (b *Bitcask) Set(key string, value []byte, flag, version int32) os.Error {
	ckey := C.CString(key)
	defer C.free(unsafe.Pointer(ckey))
	cv := C.CString(string(value))
	defer C.free(unsafe.Pointer(cv))
	if !bool(C.bc_set(b.bc, ckey, cv, _Ctype_int(len(value)),
		_Ctype_int(flag), _Ctype_int(version))) {
		return os.NewError("set failed")
	}
	return nil
}