@ -16,6 +16,19 @@ public class ReadOptions extends RocksObject {
super ( newReadOptions ( ) ) ;
super ( newReadOptions ( ) ) ;
}
}
/ * *
* Copy constructor .
*
* NOTE : This does a shallow copy , which means snapshot , iterate_upper_bound
* and other pointers will be cloned !
*
* @param other The ReadOptions to copy .
* /
public ReadOptions ( ReadOptions other ) {
super ( copyReadOptions ( other . nativeHandle_ ) ) ;
iterateUpperBoundSlice_ = other . iterateUpperBoundSlice_ ;
}
/ * *
/ * *
* If true , all data read from underlying storage will be
* If true , all data read from underlying storage will be
* verified against corresponding checksums .
* verified against corresponding checksums .
@ -363,7 +376,62 @@ public class ReadOptions extends RocksObject {
return this ;
return this ;
}
}
/ * *
* Defines the extent upto which the forward iterator can returns entries .
* Once the bound is reached , Valid ( ) will be false . iterate_upper_bound
* is exclusive ie the bound value is not a valid entry . If
* iterator_extractor is not null , the Seek target and iterator_upper_bound
* need to have the same prefix . This is because ordering is not guaranteed
* outside of prefix domain . There is no lower bound on the iterator .
*
* Default : nullptr
*
* @param iterateUpperBound Slice representing the upper bound
* @return the reference to the current ReadOptions .
* /
public ReadOptions setIterateUpperBound ( final Slice iterateUpperBound ) {
assert ( isOwningHandle ( ) ) ;
if ( iterateUpperBound ! = null ) {
// Hold onto a reference so it doesn't get garbaged collected out from under us.
iterateUpperBoundSlice_ = iterateUpperBound ;
setIterateUpperBound ( nativeHandle_ , iterateUpperBoundSlice_ . getNativeHandle ( ) ) ;
}
return this ;
}
/ * *
* Defines the extent upto which the forward iterator can returns entries .
* Once the bound is reached , Valid ( ) will be false . iterate_upper_bound
* is exclusive ie the bound value is not a valid entry . If
* iterator_extractor is not null , the Seek target and iterator_upper_bound
* need to have the same prefix . This is because ordering is not guaranteed
* outside of prefix domain . There is no lower bound on the iterator .
*
* Default : nullptr
*
* @return Slice representing current iterate_upper_bound setting , or null if
* one does not exist .
* /
public Slice iterateUpperBound ( ) {
assert ( isOwningHandle ( ) ) ;
long upperBoundSliceHandle = iterateUpperBound ( nativeHandle_ ) ;
if ( upperBoundSliceHandle ! = 0 ) {
// Disown the new slice - it's owned by the C++ side of the JNI boundary
// from the perspective of this method.
return new Slice ( upperBoundSliceHandle , false ) ;
}
return null ;
}
// Hold a reference to any iterate upper bound that was set on this object
// until we're destroyed or it's overwritten. That way the caller can freely
// leave scope without us losing the Java Slice object, which during close()
// would also reap its associated rocksdb::Slice native object since it's
// possibly (likely) to be an owning handle.
protected Slice iterateUpperBoundSlice_ ;
private native static long newReadOptions ( ) ;
private native static long newReadOptions ( ) ;
private native static long copyReadOptions ( long handle ) ;
private native boolean verifyChecksums ( long handle ) ;
private native boolean verifyChecksums ( long handle ) ;
private native void setVerifyChecksums ( long handle , boolean verifyChecksums ) ;
private native void setVerifyChecksums ( long handle , boolean verifyChecksums ) ;
private native boolean fillCache ( long handle ) ;
private native boolean fillCache ( long handle ) ;
@ -391,6 +459,9 @@ public class ReadOptions extends RocksObject {
private native boolean ignoreRangeDeletions ( final long handle ) ;
private native boolean ignoreRangeDeletions ( final long handle ) ;
private native void setIgnoreRangeDeletions ( final long handle ,
private native void setIgnoreRangeDeletions ( final long handle ,
final boolean ignoreRangeDeletions ) ;
final boolean ignoreRangeDeletions ) ;
private native void setIterateUpperBound ( final long handle ,
final long upperBoundSliceHandle ) ;
private native long iterateUpperBound ( final long handle ) ;
@Override protected final native void disposeInternal ( final long handle ) ;
@Override protected final native void disposeInternal ( final long handle ) ;