Esempio n. 1
0
// Err returns nil if no errors happened during iteration, or the actual
// error otherwise.
func (iter *Iterator) Err() error {
	var cErr *C.char
	C.rocksdb_iter_get_error(iter.c, &cErr)
	if cErr != nil {
		defer C.rocksdb_free(unsafe.Pointer(cErr))
		return errors.New(C.GoString(cErr))
	}
	return nil
}
Esempio n. 2
0
File: ext.go Progetto: unigraph/rdb
func (db *DB) KeyMayExist(opts *ReadOptions, key []byte) bool {
	var cErr *C.char
	cKey := byteToChar(key)
	ret := C.rocksdb_key_may_exist(db.c, opts.c, cKey, C.size_t(len(key)), &cErr)
	if cErr != nil {
		defer C.rocksdb_free(unsafe.Pointer(cErr))
		return false
	}
	return ret != 0
}
Esempio n. 3
0
func (self *Slice) Free() {
	if !self.freed {
		C.rocksdb_free(unsafe.Pointer(self.data))
		self.freed = true
	}
}