|
|
|
@ -37,6 +37,8 @@ public class ReadOptions extends RocksObject { |
|
|
|
|
super(copyReadOptions(other.nativeHandle_)); |
|
|
|
|
this.iterateLowerBoundSlice_ = other.iterateLowerBoundSlice_; |
|
|
|
|
this.iterateUpperBoundSlice_ = other.iterateUpperBoundSlice_; |
|
|
|
|
this.timestampSlice_ = other.timestampSlice_; |
|
|
|
|
this.iterStartTs_ = other.iterStartTs_; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -560,6 +562,233 @@ public class ReadOptions extends RocksObject { |
|
|
|
|
return iterStartSeqnum(nativeHandle_); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* When true, by default use total_order_seek = true, and RocksDB can |
|
|
|
|
* selectively enable prefix seek mode if won't generate a different result |
|
|
|
|
* from total_order_seek, based on seek key, and iterator upper bound. |
|
|
|
|
* Not supported in ROCKSDB_LITE mode, in the way that even with value true |
|
|
|
|
* prefix mode is not used. |
|
|
|
|
* Default: false |
|
|
|
|
* |
|
|
|
|
* @return true if auto prefix mode is set. |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public boolean autoPrefixMode() { |
|
|
|
|
assert (isOwningHandle()); |
|
|
|
|
return autoPrefixMode(nativeHandle_); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* When true, by default use total_order_seek = true, and RocksDB can |
|
|
|
|
* selectively enable prefix seek mode if won't generate a different result |
|
|
|
|
* from total_order_seek, based on seek key, and iterator upper bound. |
|
|
|
|
* Not supported in ROCKSDB_LITE mode, in the way that even with value true |
|
|
|
|
* prefix mode is not used. |
|
|
|
|
* Default: false |
|
|
|
|
* @param mode auto prefix mode |
|
|
|
|
* @return the reference to the current ReadOptions. |
|
|
|
|
*/ |
|
|
|
|
public ReadOptions setAutoPrefixMode(final boolean mode) { |
|
|
|
|
assert (isOwningHandle()); |
|
|
|
|
setAutoPrefixMode(nativeHandle_, mode); |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Timestamp of operation. Read should return the latest data visible to the |
|
|
|
|
* specified timestamp. All timestamps of the same database must be of the |
|
|
|
|
* same length and format. The user is responsible for providing a customized |
|
|
|
|
* compare function via Comparator to order >key, timestamp> tuples. |
|
|
|
|
* For iterator, iter_start_ts is the lower bound (older) and timestamp |
|
|
|
|
* serves as the upper bound. Versions of the same record that fall in |
|
|
|
|
* the timestamp range will be returned. If iter_start_ts is nullptr, |
|
|
|
|
* only the most recent version visible to timestamp is returned. |
|
|
|
|
* The user-specified timestamp feature is still under active development, |
|
|
|
|
* and the API is subject to change. |
|
|
|
|
* |
|
|
|
|
* Default: null |
|
|
|
|
* @see #iterStartTs() |
|
|
|
|
* @return Reference to timestamp or null if there is no timestamp defined. |
|
|
|
|
*/ |
|
|
|
|
public Slice timestamp() { |
|
|
|
|
assert (isOwningHandle()); |
|
|
|
|
final long timestampSliceHandle = timestamp(nativeHandle_); |
|
|
|
|
if (timestampSliceHandle != 0) { |
|
|
|
|
return new Slice(timestampSliceHandle); |
|
|
|
|
} else { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Timestamp of operation. Read should return the latest data visible to the |
|
|
|
|
* specified timestamp. All timestamps of the same database must be of the |
|
|
|
|
* same length and format. The user is responsible for providing a customized |
|
|
|
|
* compare function via Comparator to order {@code <key, timestamp>} tuples. |
|
|
|
|
* For iterator, {@code iter_start_ts} is the lower bound (older) and timestamp |
|
|
|
|
* serves as the upper bound. Versions of the same record that fall in |
|
|
|
|
* the timestamp range will be returned. If iter_start_ts is nullptr, |
|
|
|
|
* only the most recent version visible to timestamp is returned. |
|
|
|
|
* The user-specified timestamp feature is still under active development, |
|
|
|
|
* and the API is subject to change. |
|
|
|
|
* |
|
|
|
|
* Default: null |
|
|
|
|
* @see #setIterStartTs(AbstractSlice) |
|
|
|
|
* @param timestamp Slice representing the timestamp |
|
|
|
|
* @return the reference to the current ReadOptions. |
|
|
|
|
*/ |
|
|
|
|
public ReadOptions setTimestamp(final AbstractSlice<?> timestamp) { |
|
|
|
|
assert (isOwningHandle()); |
|
|
|
|
setTimestamp(nativeHandle_, timestamp == null ? 0 : timestamp.getNativeHandle()); |
|
|
|
|
timestampSlice_ = timestamp; |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Timestamp of operation. Read should return the latest data visible to the |
|
|
|
|
* specified timestamp. All timestamps of the same database must be of the |
|
|
|
|
* same length and format. The user is responsible for providing a customized |
|
|
|
|
* compare function via Comparator to order {@code <key, timestamp>} tuples. |
|
|
|
|
* For iterator, {@code iter_start_ts} is the lower bound (older) and timestamp |
|
|
|
|
* serves as the upper bound. Versions of the same record that fall in |
|
|
|
|
* the timestamp range will be returned. If iter_start_ts is nullptr, |
|
|
|
|
* only the most recent version visible to timestamp is returned. |
|
|
|
|
* The user-specified timestamp feature is still under active development, |
|
|
|
|
* and the API is subject to change. |
|
|
|
|
* |
|
|
|
|
* Default: null |
|
|
|
|
* @return Reference to lower bound timestamp or null if there is no lower bound timestamp |
|
|
|
|
* defined. |
|
|
|
|
*/ |
|
|
|
|
public Slice iterStartTs() { |
|
|
|
|
assert (isOwningHandle()); |
|
|
|
|
final long iterStartTsHandle = iterStartTs(nativeHandle_); |
|
|
|
|
if (iterStartTsHandle != 0) { |
|
|
|
|
return new Slice(iterStartTsHandle); |
|
|
|
|
} else { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Timestamp of operation. Read should return the latest data visible to the |
|
|
|
|
* specified timestamp. All timestamps of the same database must be of the |
|
|
|
|
* same length and format. The user is responsible for providing a customized |
|
|
|
|
* compare function via Comparator to order {@code <key, timestamp>} tuples. |
|
|
|
|
* For iterator, {@code iter_start_ts} is the lower bound (older) and timestamp |
|
|
|
|
* serves as the upper bound. Versions of the same record that fall in |
|
|
|
|
* the timestamp range will be returned. If iter_start_ts is nullptr, |
|
|
|
|
* only the most recent version visible to timestamp is returned. |
|
|
|
|
* The user-specified timestamp feature is still under active development, |
|
|
|
|
* and the API is subject to change. |
|
|
|
|
* |
|
|
|
|
* Default: null |
|
|
|
|
* |
|
|
|
|
* @param iterStartTs Reference to lower bound timestamp or null if there is no lower bound |
|
|
|
|
* timestamp defined |
|
|
|
|
* @return the reference to the current ReadOptions. |
|
|
|
|
*/ |
|
|
|
|
public ReadOptions setIterStartTs(final AbstractSlice<?> iterStartTs) { |
|
|
|
|
assert (isOwningHandle()); |
|
|
|
|
setIterStartTs(nativeHandle_, iterStartTs == null ? 0 : iterStartTs.getNativeHandle()); |
|
|
|
|
iterStartTs_ = iterStartTs; |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Deadline for completing an API call (Get/MultiGet/Seek/Next for now) |
|
|
|
|
* in microseconds. |
|
|
|
|
* It should be set to microseconds since epoch, i.e, {@code gettimeofday} or |
|
|
|
|
* equivalent plus allowed duration in microseconds. The best way is to use |
|
|
|
|
* {@code env->NowMicros() + some timeout}. |
|
|
|
|
* This is best efforts. The call may exceed the deadline if there is IO |
|
|
|
|
* involved and the file system doesn't support deadlines, or due to |
|
|
|
|
* checking for deadline periodically rather than for every key if |
|
|
|
|
* processing a batch |
|
|
|
|
* |
|
|
|
|
* @return deadline time in microseconds |
|
|
|
|
*/ |
|
|
|
|
public long deadline() { |
|
|
|
|
assert (isOwningHandle()); |
|
|
|
|
return deadline(nativeHandle_); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Deadline for completing an API call (Get/MultiGet/Seek/Next for now) |
|
|
|
|
* in microseconds. |
|
|
|
|
* It should be set to microseconds since epoch, i.e, {@code gettimeofday} or |
|
|
|
|
* equivalent plus allowed duration in microseconds. The best way is to use |
|
|
|
|
* {@code env->NowMicros() + some timeout}. |
|
|
|
|
* This is best efforts. The call may exceed the deadline if there is IO |
|
|
|
|
* involved and the file system doesn't support deadlines, or due to |
|
|
|
|
* checking for deadline periodically rather than for every key if |
|
|
|
|
* processing a batch |
|
|
|
|
* |
|
|
|
|
* @param deadlineTime deadline time in microseconds. |
|
|
|
|
* @return the reference to the current ReadOptions. |
|
|
|
|
*/ |
|
|
|
|
public ReadOptions setDeadline(final long deadlineTime) { |
|
|
|
|
assert (isOwningHandle()); |
|
|
|
|
setDeadline(nativeHandle_, deadlineTime); |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* A timeout in microseconds to be passed to the underlying FileSystem for |
|
|
|
|
* reads. As opposed to deadline, this determines the timeout for each |
|
|
|
|
* individual file read request. If a MultiGet/Get/Seek/Next etc call |
|
|
|
|
* results in multiple reads, each read can last up to io_timeout us. |
|
|
|
|
* @return ioTimeout time in microseconds |
|
|
|
|
*/ |
|
|
|
|
public long ioTimeout() { |
|
|
|
|
assert (isOwningHandle()); |
|
|
|
|
return ioTimeout(nativeHandle_); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* A timeout in microseconds to be passed to the underlying FileSystem for |
|
|
|
|
* reads. As opposed to deadline, this determines the timeout for each |
|
|
|
|
* individual file read request. If a MultiGet/Get/Seek/Next etc call |
|
|
|
|
* results in multiple reads, each read can last up to io_timeout us. |
|
|
|
|
* |
|
|
|
|
* @param ioTimeout time in microseconds. |
|
|
|
|
* @return the reference to the current ReadOptions. |
|
|
|
|
*/ |
|
|
|
|
public ReadOptions setIoTimeout(final long ioTimeout) { |
|
|
|
|
assert (isOwningHandle()); |
|
|
|
|
setIoTimeout(nativeHandle_, ioTimeout); |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* It limits the maximum cumulative value size of the keys in batch while |
|
|
|
|
* reading through MultiGet. Once the cumulative value size exceeds this |
|
|
|
|
* soft limit then all the remaining keys are returned with status Aborted. |
|
|
|
|
* |
|
|
|
|
* Default: {@code std::numeric_limits<uint64_t>::max()} |
|
|
|
|
* @return actual valueSizeSofLimit |
|
|
|
|
*/ |
|
|
|
|
public long valueSizeSoftLimit() { |
|
|
|
|
assert (isOwningHandle()); |
|
|
|
|
return valueSizeSoftLimit(nativeHandle_); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* It limits the maximum cumulative value size of the keys in batch while |
|
|
|
|
* reading through MultiGet. Once the cumulative value size exceeds this |
|
|
|
|
* soft limit then all the remaining keys are returned with status Aborted. |
|
|
|
|
* |
|
|
|
|
* Default: {@code std::numeric_limits<uint64_t>::max()} |
|
|
|
|
* |
|
|
|
|
* @param valueSizeSofLimit |
|
|
|
|
* @return the reference to the current ReadOptions |
|
|
|
|
*/ |
|
|
|
|
public ReadOptions setValueSizeSoftLimit(final long valueSizeSofLimit) { |
|
|
|
|
assert (isOwningHandle()); |
|
|
|
|
setValueSizeSoftLimit(nativeHandle_, valueSizeSofLimit); |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// instance variables
|
|
|
|
|
// NOTE: If you add new member variables, please update the copy constructor above!
|
|
|
|
|
//
|
|
|
|
@ -570,6 +799,8 @@ public class ReadOptions extends RocksObject { |
|
|
|
|
// it's possibly (likely) to be an owning handle.
|
|
|
|
|
private AbstractSlice<?> iterateLowerBoundSlice_; |
|
|
|
|
private AbstractSlice<?> iterateUpperBoundSlice_; |
|
|
|
|
private AbstractSlice<?> timestampSlice_; |
|
|
|
|
private AbstractSlice<?> iterStartTs_; |
|
|
|
|
|
|
|
|
|
private native static long newReadOptions(); |
|
|
|
|
private native static long newReadOptions(final boolean verifyChecksums, |
|
|
|
@ -617,4 +848,16 @@ public class ReadOptions extends RocksObject { |
|
|
|
|
final long tableFilterHandle); |
|
|
|
|
private native void setIterStartSeqnum(final long handle, final long seqNum); |
|
|
|
|
private native long iterStartSeqnum(final long handle); |
|
|
|
|
private native boolean autoPrefixMode(final long handle); |
|
|
|
|
private native void setAutoPrefixMode(final long handle, final boolean autoPrefixMode); |
|
|
|
|
private native long timestamp(final long handle); |
|
|
|
|
private native void setTimestamp(final long handle, final long timestampSliceHandle); |
|
|
|
|
private native long iterStartTs(final long handle); |
|
|
|
|
private native void setIterStartTs(final long handle, final long iterStartTsHandle); |
|
|
|
|
private native long deadline(final long handle); |
|
|
|
|
private native void setDeadline(final long handle, final long deadlineTime); |
|
|
|
|
private native long ioTimeout(final long handle); |
|
|
|
|
private native void setIoTimeout(final long handle, final long ioTimeout); |
|
|
|
|
private native long valueSizeSoftLimit(final long handle); |
|
|
|
|
private native void setValueSizeSoftLimit(final long handle, final long softLimit); |
|
|
|
|
} |
|
|
|
|