@API(value=MAINTAINED) public class ExecuteProperties extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ExecuteProperties.Builder
A builder for
ExecuteProperties . |
Modifier and Type | Field and Description |
---|---|
protected IsolationLevel |
isolationLevel |
protected int |
rowLimit |
static ExecuteProperties |
SERIAL_EXECUTE
A basic set of properties for an unlimited query/scan execution with serializable isolation.
|
protected int |
skip |
static long |
UNLIMITED_TIME
A constant representing that no time limit is set.
|
Modifier and Type | Method and Description |
---|---|
ScanProperties |
asScanProperties(boolean reverse) |
ExecuteProperties |
clearReturnedRowLimit() |
ExecuteProperties |
clearRowAndTimeLimits()
Clear the returned row limit and time limit.
|
ExecuteProperties |
clearSkipAndAdjustLimit()
Remove any skip count and adjust the limit to include enough rows that we can skip those and then apply the current limit.
|
ExecuteProperties |
clearSkipAndLimit()
Clear the skip and returned row limit, but no other limits.
|
ExecuteProperties |
clearState()
Build a new
ExecuteProperties with an empty state. |
protected ExecuteProperties |
copy(int skip,
int rowLimit,
long timeLimit,
IsolationLevel isolationLevel,
ExecuteState state,
boolean failOnScanLimitReached,
CursorStreamingMode defaultCursorStreamingMode)
Create a new instance with these fields, copying any additional fields from subclasses.
|
CursorStreamingMode |
getDefaultCursorStreamingMode()
Get the default
CursorStreamingMode for new ScanProperties . |
IsolationLevel |
getIsolationLevel() |
int |
getReturnedRowLimit()
Get the limit on the number of rows that will be returned as it would be passed to FDB.
|
int |
getReturnedRowLimitOrMax()
Get the limit on the number of rows that will be returned as could be used for counting.
|
long |
getScannedBytesLimit()
Get the maximum number of bytes a query with this execute properties will scan.
|
int |
getScannedRecordsLimit()
Get the maximum number of records a query with this execute properties will scan.
|
int |
getSkip() |
ExecuteState |
getState() |
long |
getTimeLimit()
Get the time limit for query execution.
|
boolean |
isFailOnScanLimitReached()
Get whether reaching the scan limit throws an exception.
|
static ExecuteProperties.Builder |
newBuilder() |
ExecuteProperties |
resetState()
Reset the stateful parts of the properties to their "original" values, creating an independent mutable state.
|
ExecuteProperties |
setDefaultCursorStreamingMode(CursorStreamingMode defaultCursorStreamingMode)
Set the default
CursorStreamingMode for new ScanProperties . |
ExecuteProperties |
setFailOnScanLimitReached(boolean failOnScanLimitReached) |
ExecuteProperties |
setLimitsFrom(ExecuteProperties other)
Merge these limits with the ones specified in
other , using the limit specified by other
except where it is unlimited, in which case the limit from this ExecuteProperties is used instead. |
ExecuteProperties |
setReturnedRowLimit(int rowLimit)
Set the limit on the number of rows that will be returned.
|
ExecuteProperties |
setSkip(int skip) |
ExecuteProperties |
setState(ExecuteState newState)
Build a new
ExecuteProperties with the given ExecuteState . |
ExecuteProperties.Builder |
toBuilder() |
String |
toString() |
public static final long UNLIMITED_TIME
public static final ExecuteProperties SERIAL_EXECUTE
@Nonnull protected final IsolationLevel isolationLevel
protected final int skip
protected final int rowLimit
@Nonnull public IsolationLevel getIsolationLevel()
public int getSkip()
@Nonnull public ExecuteProperties setSkip(int skip)
public int getReturnedRowLimit()
ReadTransaction.ROW_LIMIT_UNLIMITED
if there is no limit.@Nonnull public ExecuteProperties setReturnedRowLimit(int rowLimit)
rowLimit
- the limit or ReadTransaction.ROW_LIMIT_UNLIMITED
or Integer.MAX_VALUE
for no limitExecuteProperties
with the given limitpublic long getTimeLimit()
UNLIMITED_TIME
if there is no time-limit
imposed on a query.public int getScannedRecordsLimit()
Integer.MAX_VALUE
if there is no limit to the number of records scanned by a query.public long getScannedBytesLimit()
Long.MAX_VALUE
if there is no limit to the number of bytes scanned by a query.@Nonnull public ExecuteState getState()
@Nonnull public ExecuteProperties setState(@Nonnull ExecuteState newState)
ExecuteProperties
with the given ExecuteState
.newState
- the new state@Nonnull public ExecuteProperties clearState()
ExecuteProperties
with an empty state.public boolean isFailOnScanLimitReached()
true
if the scan limit throws an exception when reached,
false
if the scan returns early with RecordCursor.NoNextReason.SCAN_LIMIT_REACHED
public ExecuteProperties setFailOnScanLimitReached(boolean failOnScanLimitReached)
@Nonnull public ExecuteProperties clearReturnedRowLimit()
@Nonnull public ExecuteProperties clearRowAndTimeLimits()
ExecuteProperties
without the returned row and time limits@Nonnull public ExecuteProperties clearSkipAndLimit()
ExecuteProperties
without the skip and returned row limit@Nonnull public ExecuteProperties clearSkipAndAdjustLimit()
public int getReturnedRowLimitOrMax()
Integer.MAX_VALUE
if there is no limit.@Nonnull public ExecuteProperties setLimitsFrom(@Nonnull ExecuteProperties other)
other
, using the limit specified by other
except where it is unlimited, in which case the limit from this ExecuteProperties
is used instead.other
- the ExecuteProperties
to the take the limits fromExecuteProperties
with limits merged as described abovepublic CursorStreamingMode getDefaultCursorStreamingMode()
CursorStreamingMode
for new ScanProperties
.public ExecuteProperties setDefaultCursorStreamingMode(CursorStreamingMode defaultCursorStreamingMode)
CursorStreamingMode
for new ScanProperties
.defaultCursorStreamingMode
- default streaming modeExecuteProperties
with the given default streaming mode@Nonnull public ExecuteProperties resetState()
ExecuteProperties
with an independent mutable stateExecuteState.reset()
@Nonnull protected ExecuteProperties copy(int skip, int rowLimit, long timeLimit, @Nonnull IsolationLevel isolationLevel, @Nonnull ExecuteState state, boolean failOnScanLimitReached, CursorStreamingMode defaultCursorStreamingMode)
skip
- skip countrowLimit
- returned row limittimeLimit
- time limitisolationLevel
- isolation levelstate
- execute statefailOnScanLimitReached
- fail on scan limit reacheddefaultCursorStreamingMode
- default streaming mode@Nonnull public ScanProperties asScanProperties(boolean reverse)
@Nonnull public static ExecuteProperties.Builder newBuilder()
@Nonnull public ExecuteProperties.Builder toBuilder()