|
|
@ -48,7 +48,8 @@ public class RocksDB extends RocksObject { |
|
|
|
} |
|
|
|
} |
|
|
|
catch (IOException e) |
|
|
|
catch (IOException e) |
|
|
|
{ |
|
|
|
{ |
|
|
|
throw new RuntimeException("Unable to load the RocksDB shared library" + e); |
|
|
|
throw new RuntimeException("Unable to load the RocksDB shared library" |
|
|
|
|
|
|
|
+ e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -78,7 +79,8 @@ public class RocksDB extends RocksObject { |
|
|
|
UnsatisfiedLinkError err = null; |
|
|
|
UnsatisfiedLinkError err = null; |
|
|
|
for (String path : paths) { |
|
|
|
for (String path : paths) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
System.load(path + "/" + Environment.getJniLibraryFileName("rocksdbjni")); |
|
|
|
System.load(path + "/" + |
|
|
|
|
|
|
|
Environment.getJniLibraryFileName("rocksdbjni")); |
|
|
|
success = true; |
|
|
|
success = true; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} catch (UnsatisfiedLinkError e) { |
|
|
|
} catch (UnsatisfiedLinkError e) { |
|
|
@ -116,8 +118,8 @@ public class RocksDB extends RocksObject { |
|
|
|
* the path to the database using the specified options and db path and a list |
|
|
|
* the path to the database using the specified options and db path and a list |
|
|
|
* of column family names. |
|
|
|
* of column family names. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* If opened in read write mode every existing column family name must be passed |
|
|
|
* If opened in read write mode every existing column family name must be |
|
|
|
* within the list to this method.</p> |
|
|
|
* passed within the list to this method.</p> |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* If opened in read-only mode only a subset of existing column families must |
|
|
|
* If opened in read-only mode only a subset of existing column families must |
|
|
|
* be passed to this method.</p> |
|
|
|
* be passed to this method.</p> |
|
|
@ -179,9 +181,7 @@ public class RocksDB extends RocksObject { |
|
|
|
// when non-default Options is used, keeping an Options reference
|
|
|
|
// when non-default Options is used, keeping an Options reference
|
|
|
|
// in RocksDB can prevent Java to GC during the life-time of
|
|
|
|
// in RocksDB can prevent Java to GC during the life-time of
|
|
|
|
// the currently-created RocksDB.
|
|
|
|
// the currently-created RocksDB.
|
|
|
|
RocksDB db = new RocksDB(); |
|
|
|
final RocksDB db = new RocksDB(open(options.nativeHandle_, path)); |
|
|
|
db.open(options.nativeHandle_, path); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db.storeOptionsInstance(options); |
|
|
|
db.storeOptionsInstance(options); |
|
|
|
return db; |
|
|
|
return db; |
|
|
|
} |
|
|
|
} |
|
|
@ -191,8 +191,8 @@ public class RocksDB extends RocksObject { |
|
|
|
* the path to the database using the specified options and db path and a list |
|
|
|
* the path to the database using the specified options and db path and a list |
|
|
|
* of column family names. |
|
|
|
* of column family names. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* If opened in read write mode every existing column family name must be passed |
|
|
|
* If opened in read write mode every existing column family name must be |
|
|
|
* within the list to this method.</p> |
|
|
|
* passed within the list to this method.</p> |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* If opened in read-only mode only a subset of existing column families must |
|
|
|
* If opened in read-only mode only a subset of existing column families must |
|
|
|
* be passed to this method.</p> |
|
|
|
* be passed to this method.</p> |
|
|
@ -206,7 +206,8 @@ public class RocksDB extends RocksObject { |
|
|
|
* with new Options instance as underlying native statistics instance does not |
|
|
|
* with new Options instance as underlying native statistics instance does not |
|
|
|
* use any locks to prevent concurrent updates.</p> |
|
|
|
* use any locks to prevent concurrent updates.</p> |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* ColumnFamily handles are disposed when the RocksDB instance is disposed.</p> |
|
|
|
* ColumnFamily handles are disposed when the RocksDB instance is disposed. |
|
|
|
|
|
|
|
* </p> |
|
|
|
* |
|
|
|
* |
|
|
|
* @param options {@link org.rocksdb.DBOptions} instance. |
|
|
|
* @param options {@link org.rocksdb.DBOptions} instance. |
|
|
|
* @param path the path to the rocksdb. |
|
|
|
* @param path the path to the rocksdb. |
|
|
@ -225,13 +226,25 @@ public class RocksDB extends RocksObject { |
|
|
|
final List<ColumnFamilyDescriptor> columnFamilyDescriptors, |
|
|
|
final List<ColumnFamilyDescriptor> columnFamilyDescriptors, |
|
|
|
final List<ColumnFamilyHandle> columnFamilyHandles) |
|
|
|
final List<ColumnFamilyHandle> columnFamilyHandles) |
|
|
|
throws RocksDBException { |
|
|
|
throws RocksDBException { |
|
|
|
RocksDB db = new RocksDB(); |
|
|
|
|
|
|
|
List<Long> cfReferences = db.open(options.nativeHandle_, path, |
|
|
|
final byte[][] cfNames = new byte[columnFamilyDescriptors.size()][]; |
|
|
|
columnFamilyDescriptors, columnFamilyDescriptors.size()); |
|
|
|
final long[] cfOptionHandles = new long[columnFamilyDescriptors.size()]; |
|
|
|
for (int i = 0; i < columnFamilyDescriptors.size(); i++) { |
|
|
|
for (int i = 0; i < columnFamilyDescriptors.size(); i++) { |
|
|
|
columnFamilyHandles.add(new ColumnFamilyHandle(db, cfReferences.get(i))); |
|
|
|
final ColumnFamilyDescriptor cfDescriptor = columnFamilyDescriptors |
|
|
|
|
|
|
|
.get(i); |
|
|
|
|
|
|
|
cfNames[i] = cfDescriptor.columnFamilyName(); |
|
|
|
|
|
|
|
cfOptionHandles[i] = cfDescriptor.columnFamilyOptions().nativeHandle_; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final long[] handles = open(options.nativeHandle_, path, cfNames, |
|
|
|
|
|
|
|
cfOptionHandles); |
|
|
|
|
|
|
|
final RocksDB db = new RocksDB(handles[0]); |
|
|
|
db.storeOptionsInstance(options); |
|
|
|
db.storeOptionsInstance(options); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i < handles.length; i++) { |
|
|
|
|
|
|
|
columnFamilyHandles.add(new ColumnFamilyHandle(db, handles[i])); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return db; |
|
|
|
return db; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -276,7 +289,7 @@ public class RocksDB extends RocksObject { |
|
|
|
throws RocksDBException { |
|
|
|
throws RocksDBException { |
|
|
|
// This allows to use the rocksjni default Options instead of
|
|
|
|
// This allows to use the rocksjni default Options instead of
|
|
|
|
// the c++ one.
|
|
|
|
// the c++ one.
|
|
|
|
DBOptions options = new DBOptions(); |
|
|
|
final DBOptions options = new DBOptions(); |
|
|
|
return openReadOnly(options, path, columnFamilyDescriptors, |
|
|
|
return openReadOnly(options, path, columnFamilyDescriptors, |
|
|
|
columnFamilyHandles); |
|
|
|
columnFamilyHandles); |
|
|
|
} |
|
|
|
} |
|
|
@ -303,9 +316,7 @@ public class RocksDB extends RocksObject { |
|
|
|
// when non-default Options is used, keeping an Options reference
|
|
|
|
// when non-default Options is used, keeping an Options reference
|
|
|
|
// in RocksDB can prevent Java to GC during the life-time of
|
|
|
|
// in RocksDB can prevent Java to GC during the life-time of
|
|
|
|
// the currently-created RocksDB.
|
|
|
|
// the currently-created RocksDB.
|
|
|
|
RocksDB db = new RocksDB(); |
|
|
|
final RocksDB db = new RocksDB(openROnly(options.nativeHandle_, path)); |
|
|
|
db.openROnly(options.nativeHandle_, path); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db.storeOptionsInstance(options); |
|
|
|
db.storeOptionsInstance(options); |
|
|
|
return db; |
|
|
|
return db; |
|
|
|
} |
|
|
|
} |
|
|
@ -339,14 +350,25 @@ public class RocksDB extends RocksObject { |
|
|
|
// when non-default Options is used, keeping an Options reference
|
|
|
|
// when non-default Options is used, keeping an Options reference
|
|
|
|
// in RocksDB can prevent Java to GC during the life-time of
|
|
|
|
// in RocksDB can prevent Java to GC during the life-time of
|
|
|
|
// the currently-created RocksDB.
|
|
|
|
// the currently-created RocksDB.
|
|
|
|
RocksDB db = new RocksDB(); |
|
|
|
|
|
|
|
List<Long> cfReferences = db.openROnly(options.nativeHandle_, path, |
|
|
|
final byte[][] cfNames = new byte[columnFamilyDescriptors.size()][]; |
|
|
|
columnFamilyDescriptors, columnFamilyDescriptors.size()); |
|
|
|
final long[] cfOptionHandles = new long[columnFamilyDescriptors.size()]; |
|
|
|
for (int i = 0; i < columnFamilyDescriptors.size(); i++) { |
|
|
|
for (int i = 0; i < columnFamilyDescriptors.size(); i++) { |
|
|
|
columnFamilyHandles.add(new ColumnFamilyHandle(db, cfReferences.get(i))); |
|
|
|
final ColumnFamilyDescriptor cfDescriptor = columnFamilyDescriptors |
|
|
|
|
|
|
|
.get(i); |
|
|
|
|
|
|
|
cfNames[i] = cfDescriptor.columnFamilyName(); |
|
|
|
|
|
|
|
cfOptionHandles[i] = cfDescriptor.columnFamilyOptions().nativeHandle_; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final long[] handles = openROnly(options.nativeHandle_, path, cfNames, |
|
|
|
|
|
|
|
cfOptionHandles); |
|
|
|
|
|
|
|
final RocksDB db = new RocksDB(handles[0]); |
|
|
|
db.storeOptionsInstance(options); |
|
|
|
db.storeOptionsInstance(options); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i < handles.length; i++) { |
|
|
|
|
|
|
|
columnFamilyHandles.add(new ColumnFamilyHandle(db, handles[i])); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return db; |
|
|
|
return db; |
|
|
|
} |
|
|
|
} |
|
|
|
/** |
|
|
|
/** |
|
|
@ -362,28 +384,14 @@ public class RocksDB extends RocksObject { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static List<byte[]> listColumnFamilies(final Options options, |
|
|
|
public static List<byte[]> listColumnFamilies(final Options options, |
|
|
|
final String path) throws RocksDBException { |
|
|
|
final String path) throws RocksDBException { |
|
|
|
return RocksDB.listColumnFamilies(options.nativeHandle_, path); |
|
|
|
return Arrays.asList(RocksDB.listColumnFamilies(options.nativeHandle_, |
|
|
|
|
|
|
|
path)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void storeOptionsInstance(DBOptionsInterface options) { |
|
|
|
private void storeOptionsInstance(DBOptionsInterface options) { |
|
|
|
options_ = options; |
|
|
|
options_ = options; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override protected void disposeInternal() { |
|
|
|
|
|
|
|
synchronized (this) { |
|
|
|
|
|
|
|
assert (isInitialized()); |
|
|
|
|
|
|
|
disposeInternal(nativeHandle_); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Close the RocksDB instance. |
|
|
|
|
|
|
|
* This function is equivalent to dispose(). |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void close() { |
|
|
|
|
|
|
|
dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set the database entry for "key" to "value". |
|
|
|
* Set the database entry for "key" to "value". |
|
|
|
* |
|
|
|
* |
|
|
@ -393,7 +401,8 @@ public class RocksDB extends RocksObject { |
|
|
|
* @throws RocksDBException thrown if error happens in underlying |
|
|
|
* @throws RocksDBException thrown if error happens in underlying |
|
|
|
* native library. |
|
|
|
* native library. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void put(final byte[] key, final byte[] value) throws RocksDBException { |
|
|
|
public void put(final byte[] key, final byte[] value) |
|
|
|
|
|
|
|
throws RocksDBException { |
|
|
|
put(nativeHandle_, key, key.length, value, value.length); |
|
|
|
put(nativeHandle_, key, key.length, value, value.length); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -452,8 +461,8 @@ public class RocksDB extends RocksObject { |
|
|
|
public void put(final ColumnFamilyHandle columnFamilyHandle, |
|
|
|
public void put(final ColumnFamilyHandle columnFamilyHandle, |
|
|
|
final WriteOptions writeOpts, final byte[] key, |
|
|
|
final WriteOptions writeOpts, final byte[] key, |
|
|
|
final byte[] value) throws RocksDBException { |
|
|
|
final byte[] value) throws RocksDBException { |
|
|
|
put(nativeHandle_, writeOpts.nativeHandle_, key, key.length, value, value.length, |
|
|
|
put(nativeHandle_, writeOpts.nativeHandle_, key, key.length, value, |
|
|
|
columnFamilyHandle.nativeHandle_); |
|
|
|
value.length, columnFamilyHandle.nativeHandle_); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -469,7 +478,7 @@ public class RocksDB extends RocksObject { |
|
|
|
* @return boolean value indicating if key does not exist or might exist. |
|
|
|
* @return boolean value indicating if key does not exist or might exist. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean keyMayExist(final byte[] key, final StringBuffer value){ |
|
|
|
public boolean keyMayExist(final byte[] key, final StringBuffer value){ |
|
|
|
return keyMayExist(key, key.length, value); |
|
|
|
return keyMayExist(nativeHandle_, key, key.length, value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -487,8 +496,8 @@ public class RocksDB extends RocksObject { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean keyMayExist(final ColumnFamilyHandle columnFamilyHandle, |
|
|
|
public boolean keyMayExist(final ColumnFamilyHandle columnFamilyHandle, |
|
|
|
final byte[] key, final StringBuffer value){ |
|
|
|
final byte[] key, final StringBuffer value){ |
|
|
|
return keyMayExist(key, key.length, columnFamilyHandle.nativeHandle_, |
|
|
|
return keyMayExist(nativeHandle_, key, key.length, |
|
|
|
value); |
|
|
|
columnFamilyHandle.nativeHandle_, value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -506,7 +515,7 @@ public class RocksDB extends RocksObject { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean keyMayExist(final ReadOptions readOptions, |
|
|
|
public boolean keyMayExist(final ReadOptions readOptions, |
|
|
|
final byte[] key, final StringBuffer value){ |
|
|
|
final byte[] key, final StringBuffer value){ |
|
|
|
return keyMayExist(readOptions.nativeHandle_, |
|
|
|
return keyMayExist(nativeHandle_, readOptions.nativeHandle_, |
|
|
|
key, key.length, value); |
|
|
|
key, key.length, value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -527,7 +536,7 @@ public class RocksDB extends RocksObject { |
|
|
|
public boolean keyMayExist(final ReadOptions readOptions, |
|
|
|
public boolean keyMayExist(final ReadOptions readOptions, |
|
|
|
final ColumnFamilyHandle columnFamilyHandle, final byte[] key, |
|
|
|
final ColumnFamilyHandle columnFamilyHandle, final byte[] key, |
|
|
|
final StringBuffer value){ |
|
|
|
final StringBuffer value){ |
|
|
|
return keyMayExist(readOptions.nativeHandle_, |
|
|
|
return keyMayExist(nativeHandle_, readOptions.nativeHandle_, |
|
|
|
key, key.length, columnFamilyHandle.nativeHandle_, |
|
|
|
key, key.length, columnFamilyHandle.nativeHandle_, |
|
|
|
value); |
|
|
|
value); |
|
|
|
} |
|
|
|
} |
|
|
@ -543,7 +552,7 @@ public class RocksDB extends RocksObject { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void write(final WriteOptions writeOpts, final WriteBatch updates) |
|
|
|
public void write(final WriteOptions writeOpts, final WriteBatch updates) |
|
|
|
throws RocksDBException { |
|
|
|
throws RocksDBException { |
|
|
|
write0(writeOpts.nativeHandle_, updates.nativeHandle_); |
|
|
|
write0(nativeHandle_, writeOpts.nativeHandle_, updates.nativeHandle_); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -557,7 +566,7 @@ public class RocksDB extends RocksObject { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void write(final WriteOptions writeOpts, |
|
|
|
public void write(final WriteOptions writeOpts, |
|
|
|
final WriteBatchWithIndex updates) throws RocksDBException { |
|
|
|
final WriteBatchWithIndex updates) throws RocksDBException { |
|
|
|
write1(writeOpts.nativeHandle_, updates.nativeHandle_); |
|
|
|
write1(nativeHandle_, writeOpts.nativeHandle_, updates.nativeHandle_); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -570,7 +579,8 @@ public class RocksDB extends RocksObject { |
|
|
|
* @throws RocksDBException thrown if error happens in underlying |
|
|
|
* @throws RocksDBException thrown if error happens in underlying |
|
|
|
* native library. |
|
|
|
* native library. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void merge(final byte[] key, final byte[] value) throws RocksDBException { |
|
|
|
public void merge(final byte[] key, final byte[] value) |
|
|
|
|
|
|
|
throws RocksDBException { |
|
|
|
merge(nativeHandle_, key, key.length, value, value.length); |
|
|
|
merge(nativeHandle_, key, key.length, value, value.length); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -745,9 +755,10 @@ public class RocksDB extends RocksObject { |
|
|
|
* @throws RocksDBException thrown if error happens in underlying |
|
|
|
* @throws RocksDBException thrown if error happens in underlying |
|
|
|
* native library. |
|
|
|
* native library. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public byte[] get(final ColumnFamilyHandle columnFamilyHandle, final byte[] key) |
|
|
|
public byte[] get(final ColumnFamilyHandle columnFamilyHandle, |
|
|
|
throws RocksDBException { |
|
|
|
final byte[] key) throws RocksDBException { |
|
|
|
return get(nativeHandle_, key, key.length, columnFamilyHandle.nativeHandle_); |
|
|
|
return get(nativeHandle_, key, key.length, |
|
|
|
|
|
|
|
columnFamilyHandle.nativeHandle_); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -803,16 +814,16 @@ public class RocksDB extends RocksObject { |
|
|
|
throws RocksDBException { |
|
|
|
throws RocksDBException { |
|
|
|
assert(keys.size() != 0); |
|
|
|
assert(keys.size() != 0); |
|
|
|
|
|
|
|
|
|
|
|
List<byte[]> values = multiGet( |
|
|
|
final byte[][] values = multiGet(nativeHandle_, |
|
|
|
nativeHandle_, keys, keys.size()); |
|
|
|
keys.toArray(new byte[keys.size()][])); |
|
|
|
|
|
|
|
|
|
|
|
Map<byte[], byte[]> keyValueMap = new HashMap<>(); |
|
|
|
Map<byte[], byte[]> keyValueMap = new HashMap<>(); |
|
|
|
for(int i = 0; i < values.size(); i++) { |
|
|
|
for(int i = 0; i < values.length; i++) { |
|
|
|
if(values.get(i) == null) { |
|
|
|
if(values[i] == null) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
keyValueMap.put(keys.get(i), values.get(i)); |
|
|
|
keyValueMap.put(keys.get(i), values[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return keyValueMap; |
|
|
|
return keyValueMap; |
|
|
@ -836,8 +847,10 @@ public class RocksDB extends RocksObject { |
|
|
|
* @throws IllegalArgumentException thrown if the size of passed keys is not |
|
|
|
* @throws IllegalArgumentException thrown if the size of passed keys is not |
|
|
|
* equal to the amount of passed column family handles. |
|
|
|
* equal to the amount of passed column family handles. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public Map<byte[], byte[]> multiGet(final List<ColumnFamilyHandle> columnFamilyHandleList, |
|
|
|
public Map<byte[], byte[]> multiGet( |
|
|
|
final List<byte[]> keys) throws RocksDBException, IllegalArgumentException { |
|
|
|
final List<ColumnFamilyHandle> columnFamilyHandleList, |
|
|
|
|
|
|
|
final List<byte[]> keys) throws RocksDBException, |
|
|
|
|
|
|
|
IllegalArgumentException { |
|
|
|
assert(keys.size() != 0); |
|
|
|
assert(keys.size() != 0); |
|
|
|
// Check if key size equals cfList size. If not a exception must be
|
|
|
|
// Check if key size equals cfList size. If not a exception must be
|
|
|
|
// thrown. If not a Segmentation fault happens.
|
|
|
|
// thrown. If not a Segmentation fault happens.
|
|
|
@ -845,15 +858,19 @@ public class RocksDB extends RocksObject { |
|
|
|
throw new IllegalArgumentException( |
|
|
|
throw new IllegalArgumentException( |
|
|
|
"For each key there must be a ColumnFamilyHandle."); |
|
|
|
"For each key there must be a ColumnFamilyHandle."); |
|
|
|
} |
|
|
|
} |
|
|
|
List<byte[]> values = multiGet(nativeHandle_, keys, keys.size(), |
|
|
|
final long[] cfHandles = new long[columnFamilyHandleList.size()]; |
|
|
|
columnFamilyHandleList); |
|
|
|
for (int i = 0; i < columnFamilyHandleList.size(); i++) { |
|
|
|
|
|
|
|
cfHandles[i] = columnFamilyHandleList.get(i).nativeHandle_; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
final byte[][] values = multiGet(nativeHandle_, |
|
|
|
|
|
|
|
keys.toArray(new byte[keys.size()][]), cfHandles); |
|
|
|
|
|
|
|
|
|
|
|
Map<byte[], byte[]> keyValueMap = new HashMap<>(); |
|
|
|
Map<byte[], byte[]> keyValueMap = new HashMap<>(); |
|
|
|
for(int i = 0; i < values.size(); i++) { |
|
|
|
for(int i = 0; i < values.length; i++) { |
|
|
|
if (values.get(i) == null) { |
|
|
|
if (values[i] == null) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
keyValueMap.put(keys.get(i), values.get(i)); |
|
|
|
keyValueMap.put(keys.get(i), values[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
return keyValueMap; |
|
|
|
return keyValueMap; |
|
|
|
} |
|
|
|
} |
|
|
@ -873,16 +890,16 @@ public class RocksDB extends RocksObject { |
|
|
|
final List<byte[]> keys) throws RocksDBException { |
|
|
|
final List<byte[]> keys) throws RocksDBException { |
|
|
|
assert(keys.size() != 0); |
|
|
|
assert(keys.size() != 0); |
|
|
|
|
|
|
|
|
|
|
|
List<byte[]> values = multiGet( |
|
|
|
final byte[][] values = multiGet(nativeHandle_, opt.nativeHandle_, |
|
|
|
nativeHandle_, opt.nativeHandle_, keys, keys.size()); |
|
|
|
keys.toArray(new byte[keys.size()][])); |
|
|
|
|
|
|
|
|
|
|
|
Map<byte[], byte[]> keyValueMap = new HashMap<>(); |
|
|
|
Map<byte[], byte[]> keyValueMap = new HashMap<>(); |
|
|
|
for(int i = 0; i < values.size(); i++) { |
|
|
|
for(int i = 0; i < values.length; i++) { |
|
|
|
if(values.get(i) == null) { |
|
|
|
if(values[i] == null) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
keyValueMap.put(keys.get(i), values.get(i)); |
|
|
|
keyValueMap.put(keys.get(i), values[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return keyValueMap; |
|
|
|
return keyValueMap; |
|
|
@ -917,16 +934,19 @@ public class RocksDB extends RocksObject { |
|
|
|
throw new IllegalArgumentException( |
|
|
|
throw new IllegalArgumentException( |
|
|
|
"For each key there must be a ColumnFamilyHandle."); |
|
|
|
"For each key there must be a ColumnFamilyHandle."); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
final long[] cfHandles = new long[columnFamilyHandleList.size()]; |
|
|
|
List<byte[]> values = multiGet(nativeHandle_, opt.nativeHandle_, |
|
|
|
for (int i = 0; i < columnFamilyHandleList.size(); i++) { |
|
|
|
keys, keys.size(), columnFamilyHandleList); |
|
|
|
cfHandles[i] = columnFamilyHandleList.get(i).nativeHandle_; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
final byte[][] values = multiGet(nativeHandle_, opt.nativeHandle_, |
|
|
|
|
|
|
|
keys.toArray(new byte[keys.size()][]), cfHandles); |
|
|
|
|
|
|
|
|
|
|
|
Map<byte[], byte[]> keyValueMap = new HashMap<>(); |
|
|
|
Map<byte[], byte[]> keyValueMap = new HashMap<>(); |
|
|
|
for(int i = 0; i < values.size(); i++) { |
|
|
|
for(int i = 0; i < values.length; i++) { |
|
|
|
if(values.get(i) == null) { |
|
|
|
if(values[i] == null) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
keyValueMap.put(keys.get(i), values.get(i)); |
|
|
|
keyValueMap.put(keys.get(i), values[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return keyValueMap; |
|
|
|
return keyValueMap; |
|
|
@ -958,8 +978,8 @@ public class RocksDB extends RocksObject { |
|
|
|
* @throws RocksDBException thrown if error happens in underlying |
|
|
|
* @throws RocksDBException thrown if error happens in underlying |
|
|
|
* native library. |
|
|
|
* native library. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void remove(final ColumnFamilyHandle columnFamilyHandle, final byte[] key) |
|
|
|
public void remove(final ColumnFamilyHandle columnFamilyHandle, |
|
|
|
throws RocksDBException { |
|
|
|
final byte[] key) throws RocksDBException { |
|
|
|
remove(nativeHandle_, key, key.length, columnFamilyHandle.nativeHandle_); |
|
|
|
remove(nativeHandle_, key, key.length, columnFamilyHandle.nativeHandle_); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1009,8 +1029,9 @@ public class RocksDB extends RocksObject { |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>Valid property names include: |
|
|
|
* <p>Valid property names include: |
|
|
|
* <ul> |
|
|
|
* <ul> |
|
|
|
* <li>"rocksdb.num-files-at-level<N>" - return the number of files at level <N>, |
|
|
|
* <li>"rocksdb.num-files-at-level<N>" - return the number of files at |
|
|
|
* where <N> is an ASCII representation of a level number (e.g. "0").</li> |
|
|
|
* level <N>, where <N> is an ASCII representation of a level |
|
|
|
|
|
|
|
* number (e.g. "0").</li> |
|
|
|
* <li>"rocksdb.stats" - returns a multi-line string that describes statistics |
|
|
|
* <li>"rocksdb.stats" - returns a multi-line string that describes statistics |
|
|
|
* about the internal operation of the DB.</li> |
|
|
|
* about the internal operation of the DB.</li> |
|
|
|
* <li>"rocksdb.sstables" - returns a multi-line string that describes all |
|
|
|
* <li>"rocksdb.sstables" - returns a multi-line string that describes all |
|
|
@ -1027,8 +1048,8 @@ public class RocksDB extends RocksObject { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public String getProperty(final ColumnFamilyHandle columnFamilyHandle, |
|
|
|
public String getProperty(final ColumnFamilyHandle columnFamilyHandle, |
|
|
|
final String property) throws RocksDBException { |
|
|
|
final String property) throws RocksDBException { |
|
|
|
return getProperty0(nativeHandle_, columnFamilyHandle.nativeHandle_, property, |
|
|
|
return getProperty0(nativeHandle_, columnFamilyHandle.nativeHandle_, |
|
|
|
property.length()); |
|
|
|
property, property.length()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -1039,8 +1060,9 @@ public class RocksDB extends RocksObject { |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>Valid property names include: |
|
|
|
* <p>Valid property names include: |
|
|
|
* <ul> |
|
|
|
* <ul> |
|
|
|
* <li>"rocksdb.num-files-at-level<N>" - return the number of files at level <N>, |
|
|
|
* <li>"rocksdb.num-files-at-level<N>" - return the number of files at |
|
|
|
* where <N> is an ASCII representation of a level number (e.g. "0").</li> |
|
|
|
* level <N>, where <N> is an ASCII representation of a level |
|
|
|
|
|
|
|
* number (e.g. "0").</li> |
|
|
|
* <li>"rocksdb.stats" - returns a multi-line string that describes statistics |
|
|
|
* <li>"rocksdb.stats" - returns a multi-line string that describes statistics |
|
|
|
* about the internal operation of the DB.</li> |
|
|
|
* about the internal operation of the DB.</li> |
|
|
|
* <li>"rocksdb.sstables" - returns a multi-line string that describes all |
|
|
|
* <li>"rocksdb.sstables" - returns a multi-line string that describes all |
|
|
@ -1058,8 +1080,8 @@ public class RocksDB extends RocksObject { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* <p> Similar to GetProperty(), but only works for a subset of properties whose |
|
|
|
* <p> Similar to GetProperty(), but only works for a subset of properties |
|
|
|
* return value is a numerical value. Return the value as long.</p> |
|
|
|
* whose return value is a numerical value. Return the value as long.</p> |
|
|
|
* |
|
|
|
* |
|
|
|
* <p><strong>Note</strong>: As the returned property is of type |
|
|
|
* <p><strong>Note</strong>: As the returned property is of type |
|
|
|
* {@code uint64_t} on C++ side the returning value can be negative |
|
|
|
* {@code uint64_t} on C++ side the returning value can be negative |
|
|
@ -1084,8 +1106,8 @@ public class RocksDB extends RocksObject { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* <p> Similar to GetProperty(), but only works for a subset of properties whose |
|
|
|
* <p> Similar to GetProperty(), but only works for a subset of properties |
|
|
|
* return value is a numerical value. Return the value as long.</p> |
|
|
|
* whose return value is a numerical value. Return the value as long.</p> |
|
|
|
* |
|
|
|
* |
|
|
|
* <p><strong>Note</strong>: As the returned property is of type |
|
|
|
* <p><strong>Note</strong>: As the returned property is of type |
|
|
|
* {@code uint64_t} on C++ side the returning value can be negative |
|
|
|
* {@code uint64_t} on C++ side the returning value can be negative |
|
|
@ -1109,8 +1131,8 @@ public class RocksDB extends RocksObject { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public long getLongProperty(final ColumnFamilyHandle columnFamilyHandle, |
|
|
|
public long getLongProperty(final ColumnFamilyHandle columnFamilyHandle, |
|
|
|
final String property) throws RocksDBException { |
|
|
|
final String property) throws RocksDBException { |
|
|
|
return getLongProperty(nativeHandle_, columnFamilyHandle.nativeHandle_, property, |
|
|
|
return getLongProperty(nativeHandle_, columnFamilyHandle.nativeHandle_, |
|
|
|
property.length()); |
|
|
|
property, property.length()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -1192,7 +1214,8 @@ public class RocksDB extends RocksObject { |
|
|
|
* instance |
|
|
|
* instance |
|
|
|
* @return instance of iterator object. |
|
|
|
* @return instance of iterator object. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public RocksIterator newIterator(final ColumnFamilyHandle columnFamilyHandle) { |
|
|
|
public RocksIterator newIterator( |
|
|
|
|
|
|
|
final ColumnFamilyHandle columnFamilyHandle) { |
|
|
|
return new RocksIterator(this, iteratorCF(nativeHandle_, |
|
|
|
return new RocksIterator(this, iteratorCF(nativeHandle_, |
|
|
|
columnFamilyHandle.nativeHandle_)); |
|
|
|
columnFamilyHandle.nativeHandle_)); |
|
|
|
} |
|
|
|
} |
|
|
@ -1232,7 +1255,8 @@ public class RocksDB extends RocksObject { |
|
|
|
* native library. |
|
|
|
* native library. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public List<RocksIterator> newIterators( |
|
|
|
public List<RocksIterator> newIterators( |
|
|
|
final List<ColumnFamilyHandle> columnFamilyHandleList) throws RocksDBException { |
|
|
|
final List<ColumnFamilyHandle> columnFamilyHandleList) |
|
|
|
|
|
|
|
throws RocksDBException { |
|
|
|
return newIterators(columnFamilyHandleList, new ReadOptions()); |
|
|
|
return newIterators(columnFamilyHandleList, new ReadOptions()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1253,11 +1277,17 @@ public class RocksDB extends RocksObject { |
|
|
|
public List<RocksIterator> newIterators( |
|
|
|
public List<RocksIterator> newIterators( |
|
|
|
final List<ColumnFamilyHandle> columnFamilyHandleList, |
|
|
|
final List<ColumnFamilyHandle> columnFamilyHandleList, |
|
|
|
final ReadOptions readOptions) throws RocksDBException { |
|
|
|
final ReadOptions readOptions) throws RocksDBException { |
|
|
|
List<RocksIterator> iterators = |
|
|
|
|
|
|
|
new ArrayList<>(columnFamilyHandleList.size()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long[] iteratorRefs = iterators(nativeHandle_, columnFamilyHandleList, |
|
|
|
final long[] columnFamilyHandles = new long[columnFamilyHandleList.size()]; |
|
|
|
|
|
|
|
for (int i = 0; i < columnFamilyHandleList.size(); i++) { |
|
|
|
|
|
|
|
columnFamilyHandles[i] = columnFamilyHandleList.get(i).nativeHandle_; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final long[] iteratorRefs = iterators(nativeHandle_, columnFamilyHandles, |
|
|
|
readOptions.nativeHandle_); |
|
|
|
readOptions.nativeHandle_); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final List<RocksIterator> iterators = new ArrayList<>( |
|
|
|
|
|
|
|
columnFamilyHandleList.size()); |
|
|
|
for (int i=0; i<columnFamilyHandleList.size(); i++){ |
|
|
|
for (int i=0; i<columnFamilyHandleList.size(); i++){ |
|
|
|
iterators.add(new RocksIterator(this, iteratorRefs[i])); |
|
|
|
iterators.add(new RocksIterator(this, iteratorRefs[i])); |
|
|
|
} |
|
|
|
} |
|
|
@ -1291,7 +1321,8 @@ public class RocksDB extends RocksObject { |
|
|
|
final ColumnFamilyDescriptor columnFamilyDescriptor) |
|
|
|
final ColumnFamilyDescriptor columnFamilyDescriptor) |
|
|
|
throws RocksDBException { |
|
|
|
throws RocksDBException { |
|
|
|
return new ColumnFamilyHandle(this, createColumnFamily(nativeHandle_, |
|
|
|
return new ColumnFamilyHandle(this, createColumnFamily(nativeHandle_, |
|
|
|
columnFamilyDescriptor)); |
|
|
|
columnFamilyDescriptor.columnFamilyName(), |
|
|
|
|
|
|
|
columnFamilyDescriptor.columnFamilyOptions().nativeHandle_)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -1310,7 +1341,7 @@ public class RocksDB extends RocksObject { |
|
|
|
// throws RocksDBException if something goes wrong
|
|
|
|
// throws RocksDBException if something goes wrong
|
|
|
|
dropColumnFamily(nativeHandle_, columnFamilyHandle.nativeHandle_); |
|
|
|
dropColumnFamily(nativeHandle_, columnFamilyHandle.nativeHandle_); |
|
|
|
// After the drop the native handle is not valid anymore
|
|
|
|
// After the drop the native handle is not valid anymore
|
|
|
|
columnFamilyHandle.nativeHandle_ = 0; |
|
|
|
columnFamilyHandle.disOwnNativeHandle(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -1672,26 +1703,55 @@ public class RocksDB extends RocksObject { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Private constructor. |
|
|
|
* Private constructor. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param nativeHandle The native handle of the C++ RocksDB object |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected RocksDB() { |
|
|
|
protected RocksDB(final long nativeHandle) { |
|
|
|
super(); |
|
|
|
super(nativeHandle); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// native methods
|
|
|
|
// native methods
|
|
|
|
protected native void open( |
|
|
|
protected native static long open(final long optionsHandle, |
|
|
|
long optionsHandle, String path) throws RocksDBException; |
|
|
|
final String path) throws RocksDBException; |
|
|
|
protected native List<Long> open(long optionsHandle, String path, |
|
|
|
|
|
|
|
List<ColumnFamilyDescriptor> columnFamilyDescriptors, |
|
|
|
/** |
|
|
|
int columnFamilyDescriptorsLength) |
|
|
|
* @param optionsHandle Native handle pointing to an Options object |
|
|
|
throws RocksDBException; |
|
|
|
* @param path The directory path for the database files |
|
|
|
protected native static List<byte[]> listColumnFamilies( |
|
|
|
* @param columnFamilyNames An array of column family names |
|
|
|
long optionsHandle, String path) throws RocksDBException; |
|
|
|
* @param columnFamilyOptions An array of native handles pointing to |
|
|
|
protected native void openROnly( |
|
|
|
* ColumnFamilyOptions objects |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return An array of native handles, [0] is the handle of the RocksDB object |
|
|
|
|
|
|
|
* [1..1+n] are handles of the ColumnFamilyReferences |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @throws RocksDBException thrown if the database could not be opened |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected native static long[] open(final long optionsHandle, |
|
|
|
|
|
|
|
final String path, final byte[][] columnFamilyNames, |
|
|
|
|
|
|
|
final long[] columnFamilyOptions) throws RocksDBException; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected native static long openROnly(final long optionsHandle, |
|
|
|
|
|
|
|
final String path) throws RocksDBException; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @param optionsHandle Native handle pointing to an Options object |
|
|
|
|
|
|
|
* @param path The directory path for the database files |
|
|
|
|
|
|
|
* @param columnFamilyNames An array of column family names |
|
|
|
|
|
|
|
* @param columnFamilyOptions An array of native handles pointing to |
|
|
|
|
|
|
|
* ColumnFamilyOptions objects |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return An array of native handles, [0] is the handle of the RocksDB object |
|
|
|
|
|
|
|
* [1..1+n] are handles of the ColumnFamilyReferences |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @throws RocksDBException thrown if the database could not be opened |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected native static long[] openROnly(final long optionsHandle, |
|
|
|
|
|
|
|
final String path, final byte[][] columnFamilyNames, |
|
|
|
|
|
|
|
final long[] columnFamilyOptions |
|
|
|
|
|
|
|
) throws RocksDBException; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected native static byte[][] listColumnFamilies( |
|
|
|
long optionsHandle, String path) throws RocksDBException; |
|
|
|
long optionsHandle, String path) throws RocksDBException; |
|
|
|
protected native List<Long> openROnly( |
|
|
|
|
|
|
|
long optionsHandle, String path, |
|
|
|
|
|
|
|
List<ColumnFamilyDescriptor> columnFamilyDescriptors, |
|
|
|
|
|
|
|
int columnFamilyDescriptorsLength) throws RocksDBException; |
|
|
|
|
|
|
|
protected native void put( |
|
|
|
protected native void put( |
|
|
|
long handle, byte[] key, int keyLen, |
|
|
|
long handle, byte[] key, int keyLen, |
|
|
|
byte[] value, int valueLen) throws RocksDBException; |
|
|
|
byte[] value, int valueLen) throws RocksDBException; |
|
|
@ -1706,18 +1766,20 @@ public class RocksDB extends RocksObject { |
|
|
|
long handle, long writeOptHandle, |
|
|
|
long handle, long writeOptHandle, |
|
|
|
byte[] key, int keyLen, |
|
|
|
byte[] key, int keyLen, |
|
|
|
byte[] value, int valueLen, long cfHandle) throws RocksDBException; |
|
|
|
byte[] value, int valueLen, long cfHandle) throws RocksDBException; |
|
|
|
protected native void write0( |
|
|
|
protected native void write0(final long handle, long writeOptHandle, |
|
|
|
long writeOptHandle, long wbHandle) throws RocksDBException; |
|
|
|
long wbHandle) throws RocksDBException; |
|
|
|
protected native void write1( |
|
|
|
protected native void write1(final long handle, long writeOptHandle, |
|
|
|
long writeOptHandle, long wbwiHandle) throws RocksDBException; |
|
|
|
long wbwiHandle) throws RocksDBException; |
|
|
|
protected native boolean keyMayExist(byte[] key, int keyLen, |
|
|
|
protected native boolean keyMayExist(final long handle, final byte[] key, |
|
|
|
StringBuffer stringBuffer); |
|
|
|
final int keyLen, final StringBuffer stringBuffer); |
|
|
|
protected native boolean keyMayExist(byte[] key, int keyLen, |
|
|
|
protected native boolean keyMayExist(final long handle, final byte[] key, |
|
|
|
long cfHandle, StringBuffer stringBuffer); |
|
|
|
final int keyLen, final long cfHandle, final StringBuffer stringBuffer); |
|
|
|
protected native boolean keyMayExist(long optionsHandle, byte[] key, int keyLen, |
|
|
|
protected native boolean keyMayExist(final long handle, |
|
|
|
StringBuffer stringBuffer); |
|
|
|
final long optionsHandle, final byte[] key, final int keyLen, |
|
|
|
protected native boolean keyMayExist(long optionsHandle, byte[] key, int keyLen, |
|
|
|
final StringBuffer stringBuffer); |
|
|
|
long cfHandle, StringBuffer stringBuffer); |
|
|
|
protected native boolean keyMayExist(final long handle, |
|
|
|
|
|
|
|
final long optionsHandle, final byte[] key, final int keyLen, |
|
|
|
|
|
|
|
final long cfHandle, final StringBuffer stringBuffer); |
|
|
|
protected native void merge( |
|
|
|
protected native void merge( |
|
|
|
long handle, byte[] key, int keyLen, |
|
|
|
long handle, byte[] key, int keyLen, |
|
|
|
byte[] value, int valueLen) throws RocksDBException; |
|
|
|
byte[] value, int valueLen) throws RocksDBException; |
|
|
@ -1744,20 +1806,18 @@ public class RocksDB extends RocksObject { |
|
|
|
protected native int get( |
|
|
|
protected native int get( |
|
|
|
long handle, long readOptHandle, byte[] key, int keyLen, |
|
|
|
long handle, long readOptHandle, byte[] key, int keyLen, |
|
|
|
byte[] value, int valueLen, long cfHandle) throws RocksDBException; |
|
|
|
byte[] value, int valueLen, long cfHandle) throws RocksDBException; |
|
|
|
protected native List<byte[]> multiGet( |
|
|
|
protected native byte[][] multiGet(final long dbHandle, final byte[][] keys); |
|
|
|
long dbHandle, List<byte[]> keys, int keysCount); |
|
|
|
protected native byte[][] multiGet(final long dbHandle, final byte[][] keys, |
|
|
|
protected native List<byte[]> multiGet( |
|
|
|
final long[] columnFamilyHandles); |
|
|
|
long dbHandle, List<byte[]> keys, int keysCount, List<ColumnFamilyHandle> |
|
|
|
protected native byte[][] multiGet(final long dbHandle, final long rOptHandle, |
|
|
|
cfHandles); |
|
|
|
final byte[][] keys); |
|
|
|
protected native List<byte[]> multiGet( |
|
|
|
protected native byte[][] multiGet(final long dbHandle, final long rOptHandle, |
|
|
|
long dbHandle, long rOptHandle, List<byte[]> keys, int keysCount); |
|
|
|
final byte[][] keys, final long[] columnFamilyHandles); |
|
|
|
protected native List<byte[]> multiGet( |
|
|
|
|
|
|
|
long dbHandle, long rOptHandle, List<byte[]> keys, int keysCount, |
|
|
|
|
|
|
|
List<ColumnFamilyHandle> cfHandles); |
|
|
|
|
|
|
|
protected native byte[] get( |
|
|
|
protected native byte[] get( |
|
|
|
long handle, byte[] key, int keyLen) throws RocksDBException; |
|
|
|
long handle, byte[] key, int keyLen) throws RocksDBException; |
|
|
|
protected native byte[] get( |
|
|
|
protected native byte[] get( |
|
|
|
long handle, byte[] key, int keyLen, long cfHandle) throws RocksDBException; |
|
|
|
long handle, byte[] key, int keyLen, long cfHandle) |
|
|
|
|
|
|
|
throws RocksDBException; |
|
|
|
protected native byte[] get( |
|
|
|
protected native byte[] get( |
|
|
|
long handle, long readOptHandle, |
|
|
|
long handle, long readOptHandle, |
|
|
|
byte[] key, int keyLen) throws RocksDBException; |
|
|
|
byte[] key, int keyLen) throws RocksDBException; |
|
|
@ -1767,7 +1827,8 @@ public class RocksDB extends RocksObject { |
|
|
|
protected native void remove( |
|
|
|
protected native void remove( |
|
|
|
long handle, byte[] key, int keyLen) throws RocksDBException; |
|
|
|
long handle, byte[] key, int keyLen) throws RocksDBException; |
|
|
|
protected native void remove( |
|
|
|
protected native void remove( |
|
|
|
long handle, byte[] key, int keyLen, long cfHandle) throws RocksDBException; |
|
|
|
long handle, byte[] key, int keyLen, long cfHandle) |
|
|
|
|
|
|
|
throws RocksDBException; |
|
|
|
protected native void remove( |
|
|
|
protected native void remove( |
|
|
|
long handle, long writeOptHandle, |
|
|
|
long handle, long writeOptHandle, |
|
|
|
byte[] key, int keyLen) throws RocksDBException; |
|
|
|
byte[] key, int keyLen) throws RocksDBException; |
|
|
@ -1787,34 +1848,36 @@ public class RocksDB extends RocksObject { |
|
|
|
protected native long iteratorCF(long handle, long cfHandle); |
|
|
|
protected native long iteratorCF(long handle, long cfHandle); |
|
|
|
protected native long iteratorCF(long handle, long cfHandle, |
|
|
|
protected native long iteratorCF(long handle, long cfHandle, |
|
|
|
long readOptHandle); |
|
|
|
long readOptHandle); |
|
|
|
protected native long[] iterators(long handle, |
|
|
|
protected native long[] iterators(final long handle, |
|
|
|
List<ColumnFamilyHandle> columnFamilyNames, long readOptHandle) |
|
|
|
final long[] columnFamilyHandles, final long readOptHandle) |
|
|
|
throws RocksDBException; |
|
|
|
throws RocksDBException; |
|
|
|
protected native long getSnapshot(long nativeHandle); |
|
|
|
protected native long getSnapshot(long nativeHandle); |
|
|
|
protected native void releaseSnapshot( |
|
|
|
protected native void releaseSnapshot( |
|
|
|
long nativeHandle, long snapshotHandle); |
|
|
|
long nativeHandle, long snapshotHandle); |
|
|
|
private native void disposeInternal(long handle); |
|
|
|
@Override protected final native void disposeInternal(final long handle); |
|
|
|
private native long getDefaultColumnFamily(long handle); |
|
|
|
private native long getDefaultColumnFamily(long handle); |
|
|
|
private native long createColumnFamily(long handle, |
|
|
|
private native long createColumnFamily(final long handle, |
|
|
|
ColumnFamilyDescriptor columnFamilyDescriptor) throws RocksDBException; |
|
|
|
final byte[] columnFamilyName, final long columnFamilyOptions) |
|
|
|
private native void dropColumnFamily(long handle, long cfHandle) throws RocksDBException; |
|
|
|
throws RocksDBException; |
|
|
|
|
|
|
|
private native void dropColumnFamily(long handle, long cfHandle) |
|
|
|
|
|
|
|
throws RocksDBException; |
|
|
|
private native void flush(long handle, long flushOptHandle) |
|
|
|
private native void flush(long handle, long flushOptHandle) |
|
|
|
throws RocksDBException; |
|
|
|
throws RocksDBException; |
|
|
|
private native void flush(long handle, long flushOptHandle, |
|
|
|
private native void flush(long handle, long flushOptHandle, |
|
|
|
long cfHandle) throws RocksDBException; |
|
|
|
long cfHandle) throws RocksDBException; |
|
|
|
private native void compactRange0(long handle, boolean reduce_level, int target_level, |
|
|
|
private native void compactRange0(long handle, boolean reduce_level, |
|
|
|
|
|
|
|
int target_level, int target_path_id) throws RocksDBException; |
|
|
|
|
|
|
|
private native void compactRange0(long handle, byte[] begin, int beginLen, |
|
|
|
|
|
|
|
byte[] end, int endLen, boolean reduce_level, int target_level, |
|
|
|
int target_path_id) throws RocksDBException; |
|
|
|
int target_path_id) throws RocksDBException; |
|
|
|
private native void compactRange0(long handle, byte[] begin, int beginLen, byte[] end, |
|
|
|
private native void compactRange(long handle, boolean reduce_level, |
|
|
|
int endLen, boolean reduce_level, int target_level, int target_path_id) |
|
|
|
int target_level, int target_path_id, long cfHandle) |
|
|
|
throws RocksDBException; |
|
|
|
throws RocksDBException; |
|
|
|
private native void compactRange(long handle, boolean reduce_level, int target_level, |
|
|
|
private native void compactRange(long handle, byte[] begin, int beginLen, |
|
|
|
|
|
|
|
byte[] end, int endLen, boolean reduce_level, int target_level, |
|
|
|
int target_path_id, long cfHandle) throws RocksDBException; |
|
|
|
int target_path_id, long cfHandle) throws RocksDBException; |
|
|
|
private native void compactRange(long handle, byte[] begin, int beginLen, byte[] end, |
|
|
|
|
|
|
|
int endLen, boolean reduce_level, int target_level, int target_path_id, |
|
|
|
|
|
|
|
long cfHandle) throws RocksDBException; |
|
|
|
|
|
|
|
private native long getLatestSequenceNumber(long handle); |
|
|
|
private native long getLatestSequenceNumber(long handle); |
|
|
|
private native void disableFileDeletions(long handle) |
|
|
|
private native void disableFileDeletions(long handle) throws RocksDBException; |
|
|
|
throws RocksDBException; |
|
|
|
|
|
|
|
private native void enableFileDeletions(long handle, |
|
|
|
private native void enableFileDeletions(long handle, |
|
|
|
boolean force) throws RocksDBException; |
|
|
|
boolean force) throws RocksDBException; |
|
|
|
private native long getUpdatesSince(long handle, long sequenceNumber) |
|
|
|
private native long getUpdatesSince(long handle, long sequenceNumber) |
|
|
|