Esempio n. 1
0
// DestroyDB removes a database entirely, removing everything from the
// filesystem.
func DestroyDB(name string, opts *Options) error {
	var (
		cErr  *C.char
		cName = C.CString(name)
	)
	defer C.free(unsafe.Pointer(cName))
	C.rocksdb_destroy_db(opts.c, cName, &cErr)
	return convertErr(cErr)
}
Esempio n. 2
0
// DestroyDb removes a database entirely, removing everything from the
// filesystem.
func DestroyDb(name string, opts *Options) error {
	var cErr *C.char
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	C.rocksdb_destroy_db(opts.c, cname, &cErr)
	if cErr != nil {
		defer C.free(unsafe.Pointer(cErr))

		return errors.New(C.GoString(cErr))
	}

	return nil
}
Esempio n. 3
0
// destroy destroys the underlying filesystem data associated with the database.
func (r *RocksDB) destroy() error {
	cDir := C.CString(r.dir)
	defer C.free(unsafe.Pointer(cDir))

	defer r.destroyOptions()

	var cErr *C.char
	C.rocksdb_destroy_db(r.opts, cDir, &cErr)
	if cErr != nil {
		return charToErr(cErr)
	}
	return nil
}
Esempio n. 4
0
// DestroyDatabase removes a database entirely, removing everything from the
// filesystem.
func DestroyDatabase(dbname string, o *Options) error {
	var errStr *C.char
	ldbname := C.CString(dbname)
	defer C.free(unsafe.Pointer(ldbname))

	C.rocksdb_destroy_db(o.Opt, ldbname, &errStr)
	if errStr != nil {
		gs := C.GoString(errStr)
		C.free(unsafe.Pointer(errStr))
		return DatabaseError(gs)
	}
	return nil
}