package ezdb.rocksdb;

import java.io.File;
import java.io.IOException;

import org.rocksdb.Options;
import org.rocksdb.RocksDB;
import org.rocksdb.RocksDBException;

import ezdb.rocksdb.util.FileUtils;

public class EzRocksDbJniFactory implements EzRocksDbFactory {
	@Override
	public RocksDB open(File path, Options options) throws IOException {
		try {
			return RocksDB.open(options, path.getAbsolutePath());
		} catch (RocksDBException e) {
			throw new IOException(e);
		}
	}

	@Override
	public void destroy(File path, Options options) throws IOException {
		//implementation taken from java port of leveldb
		try {
			RocksDB.destroyDB(path.getAbsolutePath(), options);
		} catch (RocksDBException e) {
			throw new IOException(e);
		}
	}
}

@@ -561,16 +561,17 @@
 n %7B%0A%09%09//
+ 
 implemen
@@ -615,134 +615,42 @@
 b%0A%09%09
-try %7B%0A%09%09%09RocksDB.destroyDB(path.getAbsolutePath(), options);%0A%09%09%7D catch (RocksDBException e) %7B%0A%09%09%09throw new IOException(e);%0A%09%09%7D
+FileUtils.deleteRecursively(path);
 %0A%09%7D%0A

revert destroy impl