@ -2189,68 +2189,94 @@ public class RocksDB extends RocksObject {
/ * *
/ * *
* If the key definitely does not exist in the database , then this method
* If the key definitely does not exist in the database , then this method
* returns false , else true .
* returns null , else it returns an instance of KeyMayExistResult
*
*
* This check is potentially lighter - weight than invoking DB : : Get ( ) . One way
* If the caller wants to obtain value when the key
* to make this lighter weight is to avoid doing any IOs .
* is found in memory , then { @code valueHolder } must be set .
*
* This check is potentially lighter - weight than invoking
* { @link # get ( byte [ ] ) } . One way to make this lighter weight is to avoid
* doing any IOs .
*
*
* @param key byte array of a key to search for
* @param key byte array of a key to search for
* @param value StringBuilder instance which is a out parameter if a value is
* @param valueHolder non - null to retrieve the value if it is found , or null
* found in block - cache .
* if the value is not needed . If non - null , upon return of the function ,
* @return boolean value indicating if key does not exist or might exist .
* the { @code value } will be set if it could be retrieved .
*
* @return false if the key definitely does not exist in the database ,
* otherwise true .
* /
* /
public boolean keyMayExist ( final byte [ ] key , final StringBuilder value ) {
public boolean keyMayExist ( final byte [ ] key ,
return keyMayExist ( nativeHandle_ , key , 0 , key . length , value ) ;
/* @Nullable */ final Holder < byte [ ] > valueHolder ) {
return keyMayExist ( key , 0 , key . length , valueHolder ) ;
}
}
/ * *
/ * *
* If the key definitely does not exist in the database , then this method
* If the key definitely does not exist in the database , then this method
* returns false , else true .
* returns null , else it returns an instance of KeyMayExistResult
*
*
* This check is potentially lighter - weight than invoking DB : : Get ( ) . One way
* If the caller wants to obtain value when the key
* to make this lighter weight is to avoid doing any IOs .
* is found in memory , then { @code valueHolder } must be set .
*
* This check is potentially lighter - weight than invoking
* { @link # get ( byte [ ] , int , int ) } . One way to make this lighter weight is to
* avoid doing any IOs .
*
*
* @param key byte array of a key to search for
* @param key byte array of a key to search for
* @param offset the offset of the "key" array to be used , must be
* @param offset the offset of the "key" array to be used , must be
* non - negative and no larger than "key" . length
* non - negative and no larger than "key" . length
* @param len the length of the "key" array to be used , must be non - negative
* @param len the length of the "key" array to be used , must be non - negative
* and no larger than "key" . length
* and no larger than "key" . length
* @param value StringBuilder instance which is a out parameter if a value is
* @param valueHolder non - null to retrieve the value if it is found , or null
* found in block - cache .
* if the value is not needed . If non - null , upon return of the function ,
* the { @code value } will be set if it could be retrieved .
*
*
* @return boolean value indicating if key does not exist or might exist .
* @return false if the key definitely does not exist in the database ,
* otherwise true .
* /
* /
public boolean keyMayExist ( final byte [ ] key , final int offset , final int len ,
public boolean keyMayExist ( final byte [ ] key ,
final StringBuilder value ) {
final int offset , final int len ,
checkBounds ( offset , len , key . length ) ;
/* @Nullable */ final Holder < byte [ ] > valueHolder ) {
return keyMayExist ( nativeHandle_ , key , offset , len , value ) ;
return keyMayExist ( ( ColumnFamilyHandle ) null , key , offset , len , valueHolder ) ;
}
}
/ * *
/ * *
* If the key definitely does not exist in the database , then this method
* If the key definitely does not exist in the database , then this method
* returns false , else true .
* returns null , else it returns an instance of KeyMayExistResult
*
*
* This check is potentially lighter - weight than invoking DB : : Get ( ) . One way
* If the caller wants to obtain value when the key
* to make this lighter weight is to avoid doing any IOs .
* is found in memory , then { @code valueHolder } must be set .
*
* This check is potentially lighter - weight than invoking
* { @link # get ( ColumnFamilyHandle , byte [ ] ) } . One way to make this lighter
* weight is to avoid doing any IOs .
*
*
* @param columnFamilyHandle { @link ColumnFamilyHandle } instance
* @param columnFamilyHandle { @link ColumnFamilyHandle } instance
* @param key byte array of a key to search for
* @param key byte array of a key to search for
* @param value StringBuilder instance which is a out parameter if a value is
* @param valueHolder non - null to retrieve the value if it is found , or null
* found in block - cache .
* if the value is not needed . If non - null , upon return of the function ,
* @return boolean value indicating if key does not exist or might exist .
* the { @code value } will be set if it could be retrieved .
*
* @return false if the key definitely does not exist in the database ,
* otherwise true .
* /
* /
public boolean keyMayExist ( final ColumnFamilyHandle columnFamilyHandle ,
public boolean keyMayExist (
final byte [ ] key , final StringBuilder value ) {
final ColumnFamilyHandle columnFamilyHandle , final byte [ ] key ,
return keyMayExist ( nativeHandle_ , key , 0 , key . length ,
/* @Nullable */ final Holder < byte [ ] > valueHolder ) {
columnFamilyHandle . nativeHandle_ , value ) ;
return keyMayExist ( columnFamilyHandle , key , 0 , key . length ,
valueHolder ) ;
}
}
/ * *
/ * *
* If the key definitely does not exist in the database , then this method
* If the key definitely does not exist in the database , then this method
* returns false , else true .
* returns null , else it returns an instance of KeyMayExistResult
*
* If the caller wants to obtain value when the key
* is found in memory , then { @code valueHolder } must be set .
*
*
* This check is potentially lighter - weight than invoking DB : : Get ( ) . One way
* This check is potentially lighter - weight than invoking
* to make this lighter weight is to avoid doing any IOs .
* { @link # get ( ColumnFamilyHandle , byte [ ] , int , int ) } . One way to make this
* lighter weight is to avoid doing any IOs .
*
*
* @param columnFamilyHandle { @link ColumnFamilyHandle } instance
* @param columnFamilyHandle { @link ColumnFamilyHandle } instance
* @param key byte array of a key to search for
* @param key byte array of a key to search for
@ -2258,42 +2284,58 @@ public class RocksDB extends RocksObject {
* non - negative and no larger than "key" . length
* non - negative and no larger than "key" . length
* @param len the length of the "key" array to be used , must be non - negative
* @param len the length of the "key" array to be used , must be non - negative
* and no larger than "key" . length
* and no larger than "key" . length
* @param value StringBuilder instance which is a out parameter if a value is
* @param valueHolder non - null to retrieve the value if it is found , or null
* found in block - cache .
* if the value is not needed . If non - null , upon return of the function ,
* @return boolean value indicating if key does not exist or might exist .
* the { @code value } will be set if it could be retrieved .
*
* @return false if the key definitely does not exist in the database ,
* otherwise true .
* /
* /
public boolean keyMayExist ( final ColumnFamilyHandle columnFamilyHandle ,
public boolean keyMayExist (
final byte [ ] key , int offset , int len , final StringBuilder value ) {
final ColumnFamilyHandle columnFamilyHandle ,
checkBounds ( offset , len , key . length ) ;
final byte [ ] key , int offset , int len ,
return keyMayExist ( nativeHandle_ , key , offset , len ,
/* @Nullable */ final Holder < byte [ ] > valueHolder ) {
columnFamilyHandle . nativeHandle_ , value ) ;
return keyMayExist ( columnFamilyHandle , null , key , offset , len ,
valueHolder ) ;
}
}
/ * *
/ * *
* If the key definitely does not exist in the database , then this method
* If the key definitely does not exist in the database , then this method
* returns false , else true .
* returns null , else it returns an instance of KeyMayExistResult
*
*
* This check is potentially lighter - weight than invoking DB : : Get ( ) . One way
* If the caller wants to obtain value when the key
* to make this lighter weight is to avoid doing any IOs .
* is found in memory , then { @code valueHolder } must be set .
*
* This check is potentially lighter - weight than invoking
* { @link # get ( ReadOptions , byte [ ] ) } . One way to make this
* lighter weight is to avoid doing any IOs .
*
*
* @param readOptions { @link ReadOptions } instance
* @param readOptions { @link ReadOptions } instance
* @param key byte array of a key to search for
* @param key byte array of a key to search for
* @param value StringBuilder instance which is a out parameter if a value is
* @param valueHolder non - null to retrieve the value if it is found , or null
* found in block - cache .
* if the value is not needed . If non - null , upon return of the function ,
* @return boolean value indicating if key does not exist or might exist .
* the { @code value } will be set if it could be retrieved .
*
* @return false if the key definitely does not exist in the database ,
* otherwise true .
* /
* /
public boolean keyMayExist ( final ReadOptions readOptions ,
public boolean keyMayExist (
final byte [ ] key , final StringBuilder value ) {
final ReadOptions readOptions , final byte [ ] key ,
return keyMayExist ( nativeHandle_ , readOptions . nativeHandle_ ,
/* @Nullable */ final Holder < byte [ ] > valueHolder ) {
key , 0 , key . length , value ) ;
return keyMayExist ( readOptions , key , 0 , key . length ,
valueHolder ) ;
}
}
/ * *
/ * *
* If the key definitely does not exist in the database , then this method
* If the key definitely does not exist in the database , then this method
* returns false , else true .
* returns null , else it returns an instance of KeyMayExistResult
*
*
* This check is potentially lighter - weight than invoking DB : : Get ( ) . One way
* If the caller wants to obtain value when the key
* to make this lighter weight is to avoid doing any IOs .
* is found in memory , then { @code valueHolder } must be set .
*
* This check is potentially lighter - weight than invoking
* { @link # get ( ReadOptions , byte [ ] , int , int ) } . One way to make this
* lighter weight is to avoid doing any IOs .
*
*
* @param readOptions { @link ReadOptions } instance
* @param readOptions { @link ReadOptions } instance
* @param key byte array of a key to search for
* @param key byte array of a key to search for
@ -2301,65 +2343,103 @@ public class RocksDB extends RocksObject {
* non - negative and no larger than "key" . length
* non - negative and no larger than "key" . length
* @param len the length of the "key" array to be used , must be non - negative
* @param len the length of the "key" array to be used , must be non - negative
* and no larger than "key" . length
* and no larger than "key" . length
* @param value StringBuilder instance which is a out parameter if a value is
* @param valueHolder non - null to retrieve the value if it is found , or null
* found in block - cache .
* if the value is not needed . If non - null , upon return of the function ,
* @return boolean value indicating if key does not exist or might exist .
* the { @code value } will be set if it could be retrieved .
*
* @return false if the key definitely does not exist in the database ,
* otherwise true .
* /
* /
public boolean keyMayExist ( final ReadOptions readOptions ,
public boolean keyMayExist (
final ReadOptions readOptions ,
final byte [ ] key , final int offset , final int len ,
final byte [ ] key , final int offset , final int len ,
final StringBuilder value ) {
/* @Nullable */ final Holder < byte [ ] > valueHolder ) {
checkBounds ( offset , len , key . length ) ;
return keyMayExist ( null , readOptions ,
return keyMayExist ( nativeHandle_ , readOptions . nativeHandle_ ,
key , offset , len , valueHolder ) ;
key , offset , len , value ) ;
}
}
/ * *
/ * *
* If the key definitely does not exist in the database , then this method
* If the key definitely does not exist in the database , then this method
* returns false , else true .
* returns null , else it returns an instance of KeyMayExistResult
*
*
* This check is potentially lighter - weight than invoking DB : : Get ( ) . One way
* If the caller wants to obtain value when the key
* to make this lighter weight is to avoid doing any IOs .
* is found in memory , then { @code valueHolder } must be set .
*
* This check is potentially lighter - weight than invoking
* { @link # get ( ColumnFamilyHandle , ReadOptions , byte [ ] ) } . One way to make this
* lighter weight is to avoid doing any IOs .
*
*
* @param readOptions { @link ReadOptions } instance
* @param columnFamilyHandle { @link ColumnFamilyHandle } instance
* @param columnFamilyHandle { @link ColumnFamilyHandle } instance
* @param readOptions { @link ReadOptions } instance
* @param key byte array of a key to search for
* @param key byte array of a key to search for
* @param value StringBuilder instance which is a out parameter if a value is
* @param valueHolder non - null to retrieve the value if it is found , or null
* found in block - cache .
* if the value is not needed . If non - null , upon return of the function ,
* @return boolean value indicating if key does not exist or might exist .
* the { @code value } will be set if it could be retrieved .
*
* @return false if the key definitely does not exist in the database ,
* otherwise true .
* /
* /
public boolean keyMayExist ( final ReadOptions readOptions ,
public boolean keyMayExist (
final ColumnFamilyHandle columnFamilyHandle , final byte [ ] key ,
final ColumnFamilyHandle columnFamilyHandle ,
final StringBuilder value ) {
final ReadOptions readOptions , final byte [ ] key ,
return keyMayExist ( nativeHandle_ , readOptions . nativeHandle_ ,
/* @Nullable */ final Holder < byte [ ] > valueHolder ) {
key , 0 , key . length , columnFamilyHandle . nativeHandle_ ,
return keyMayExist ( columnFamilyHandle , readOptions ,
value ) ;
key , 0 , key . length , valueHolder ) ;
}
}
/ * *
/ * *
* If the key definitely does not exist in the database , then this method
* If the key definitely does not exist in the database , then this method
* returns false , else true .
* returns null , else it returns an instance of KeyMayExistResult
*
*
* This check is potentially lighter - weight than invoking DB : : Get ( ) . One way
* If the caller wants to obtain value when the key
* to make this lighter weight is to avoid doing any IOs .
* is found in memory , then { @code valueHolder } must be set .
*
* This check is potentially lighter - weight than invoking
* { @link # get ( ColumnFamilyHandle , ReadOptions , byte [ ] , int , int ) } .
* One way to make this lighter weight is to avoid doing any IOs .
*
*
* @param readOptions { @link ReadOptions } instance
* @param columnFamilyHandle { @link ColumnFamilyHandle } instance
* @param columnFamilyHandle { @link ColumnFamilyHandle } instance
* @param readOptions { @link ReadOptions } instance
* @param key byte array of a key to search for
* @param key byte array of a key to search for
* @param offset the offset of the "key" array to be used , must be
* @param offset the offset of the "key" array to be used , must be
* non - negative and no larger than "key" . length
* non - negative and no larger than "key" . length
* @param len the length of the "key" array to be used , must be non - negative
* @param len the length of the "key" array to be used , must be non - negative
* and no larger than "key" . length
* and no larger than "key" . length
* @param value StringBuilder instance which is a out parameter if a value is
* @param valueHolder non - null to retrieve the value if it is found , or null
* found in block - cache .
* if the value is not needed . If non - null , upon return of the function ,
* @return boolean value indicating if key does not exist or might exist .
* the { @code value } will be set if it could be retrieved .
*
* @return false if the key definitely does not exist in the database ,
* otherwise true .
* /
* /
public boolean keyMayExist ( final ReadOptions readOptions ,
public boolean keyMayExist (
final ColumnFamilyHandle columnFamilyHandle , final byte [ ] key ,
final ColumnFamilyHandle columnFamilyHandle ,
final int offset , final int len , final StringBuilder value ) {
final ReadOptions readOptions ,
final byte [ ] key , final int offset , final int len ,
/* @Nullable */ final Holder < byte [ ] > valueHolder ) {
checkBounds ( offset , len , key . length ) ;
checkBounds ( offset , len , key . length ) ;
return keyMayExist ( nativeHandle_ , readOptions . nativeHandle_ ,
if ( valueHolder = = null ) {
key , offset , len , columnFamilyHandle . nativeHandle_ ,
return keyMayExist ( nativeHandle_ ,
value ) ;
columnFamilyHandle = = null ? 0 : columnFamilyHandle . nativeHandle_ ,
readOptions = = null ? 0 : readOptions . nativeHandle_ ,
key , offset , len ) ;
} else {
final byte [ ] [ ] result = keyMayExistFoundValue (
nativeHandle_ ,
columnFamilyHandle = = null ? 0 : columnFamilyHandle . nativeHandle_ ,
readOptions = = null ? 0 : readOptions . nativeHandle_ ,
key , offset , len ) ;
if ( result [ 0 ] [ 0 ] = = 0x0 ) {
valueHolder . setValue ( null ) ;
return false ;
} else if ( result [ 0 ] [ 0 ] = = 0x1 ) {
valueHolder . setValue ( null ) ;
return true ;
} else {
valueHolder . setValue ( result [ 1 ] ) ;
return true ;
}
}
}
}
/ * *
/ * *
@ -4158,19 +4238,12 @@ public class RocksDB extends RocksObject {
private native byte [ ] [ ] multiGet ( final long dbHandle , final long rOptHandle ,
private native byte [ ] [ ] multiGet ( final long dbHandle , final long rOptHandle ,
final byte [ ] [ ] keys , final int [ ] keyOffsets , final int [ ] keyLengths ,
final byte [ ] [ ] keys , final int [ ] keyOffsets , final int [ ] keyLengths ,
final long [ ] columnFamilyHandles ) ;
final long [ ] columnFamilyHandles ) ;
private native boolean keyMayExist ( final long handle , final byte [ ] key ,
private native boolean keyMayExist (
final int keyOffset , final int keyLength ,
final long handle , final long cfHandle , final long readOptHandle ,
final StringBuilder stringBuilder ) ;
final byte [ ] key , final int keyOffset , final int keyLength ) ;
private native boolean keyMayExist ( final long handle , final byte [ ] key ,
private native byte [ ] [ ] keyMayExistFoundValue (
final int keyOffset , final int keyLength , final long cfHandle ,
final long handle , final long cfHandle , final long readOptHandle ,
final StringBuilder stringBuilder ) ;
final byte [ ] key , final int keyOffset , final int keyLength ) ;
private native boolean keyMayExist ( final long handle ,
final long optionsHandle , final byte [ ] key , final int keyOffset ,
final int keyLength , final StringBuilder stringBuilder ) ;
private native boolean keyMayExist ( final long handle ,
final long optionsHandle , final byte [ ] key , final int keyOffset ,
final int keyLength , final long cfHandle ,
final StringBuilder stringBuilder ) ;
private native long iterator ( final long handle ) ;
private native long iterator ( final long handle ) ;
private native long iterator ( final long handle , final long readOptHandle ) ;
private native long iterator ( final long handle , final long readOptHandle ) ;
private native long iteratorCF ( final long handle , final long cfHandle ) ;
private native long iteratorCF ( final long handle , final long cfHandle ) ;