mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
[JAVA] Add java binding for Options.block_cache.
Summary: Add java bindings for Options.block_cache and allow DbBenchmark to set cache_size. Test Plan: make rocksdbjava make jtest make jdb_Bench Reviewers: haobo, sdong, ankgup87 Reviewed By: ankgup87 CC: leveldb, dhruba Differential Revision: https://reviews.facebook.net/D17481
This commit is contained in:
@@ -33,7 +33,12 @@ public class RocksDB {
|
||||
*/
|
||||
public static RocksDB open(String path) throws RocksDBException {
|
||||
RocksDB db = new RocksDB();
|
||||
db.open0(path);
|
||||
|
||||
// This allows to use the rocksjni default Options instead of
|
||||
// the c++ one.
|
||||
Options options = new Options();
|
||||
db.open(options.nativeHandle_, options.cacheSize_, path);
|
||||
options.dispose();
|
||||
return db;
|
||||
}
|
||||
|
||||
@@ -44,7 +49,7 @@ public class RocksDB {
|
||||
public static RocksDB open(Options options, String path)
|
||||
throws RocksDBException {
|
||||
RocksDB db = new RocksDB();
|
||||
db.open(options.nativeHandle_, path);
|
||||
db.open(options.nativeHandle_, options.cacheSize_, path);
|
||||
return db;
|
||||
}
|
||||
|
||||
@@ -145,9 +150,8 @@ public class RocksDB {
|
||||
}
|
||||
|
||||
// native methods
|
||||
private native void open0(String path) throws RocksDBException;
|
||||
private native void open(
|
||||
long optionsHandle, String path) throws RocksDBException;
|
||||
long optionsHandle, long cacheSize, String path) throws RocksDBException;
|
||||
private native void put(
|
||||
long handle, byte[] key, int keyLen,
|
||||
byte[] value, int valueLen) throws RocksDBException;
|
||||
|
||||
Reference in New Issue
Block a user