Package com.apple.foundationdb.record
Class ExecuteProperties
- java.lang.Object
-
- com.apple.foundationdb.record.ExecuteProperties
-
@API(MAINTAINED) public class ExecuteProperties extends Object
Limits on the execution of a query.- number of records to skip
- limit on number of records returned
- time limit for execution
- limit on number of key-value pairs scanned
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExecuteProperties.Builder
A builder forExecuteProperties
.
-
Field Summary
Fields Modifier and Type Field 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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 newExecuteProperties
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 defaultCursorStreamingMode
for newScanProperties
.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 defaultCursorStreamingMode
for newScanProperties
.ExecuteProperties
setFailOnScanLimitReached(boolean failOnScanLimitReached)
ExecuteProperties
setLimitsFrom(ExecuteProperties other)
Merge these limits with the ones specified inother
, using the limit specified byother
except where it is unlimited, in which case the limit from thisExecuteProperties
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 newExecuteProperties
with the givenExecuteState
.ExecuteProperties.Builder
toBuilder()
String
toString()
-
-
-
Field Detail
-
UNLIMITED_TIME
public static final long UNLIMITED_TIME
A constant representing that no time limit is set.- See Also:
- Constant Field Values
-
SERIAL_EXECUTE
public static final ExecuteProperties SERIAL_EXECUTE
A basic set of properties for an unlimited query/scan execution with serializable isolation.
-
isolationLevel
@Nonnull protected final IsolationLevel isolationLevel
-
skip
protected final int skip
-
rowLimit
protected final int rowLimit
-
-
Method Detail
-
getIsolationLevel
@Nonnull public IsolationLevel getIsolationLevel()
-
getSkip
public int getSkip()
-
setSkip
@Nonnull public ExecuteProperties setSkip(int skip)
-
getReturnedRowLimit
public int getReturnedRowLimit()
Get the limit on the number of rows that will be returned as it would be passed to FDB.- Returns:
- the limit or
ReadTransaction.ROW_LIMIT_UNLIMITED
if there is no limit.
-
setReturnedRowLimit
@Nonnull public ExecuteProperties setReturnedRowLimit(int rowLimit)
Set the limit on the number of rows that will be returned.- Parameters:
rowLimit
- the limit orReadTransaction.ROW_LIMIT_UNLIMITED
orInteger.MAX_VALUE
for no limit- Returns:
- a new
ExecuteProperties
with the given limit
-
getTimeLimit
public long getTimeLimit()
Get the time limit for query execution. This will returnUNLIMITED_TIME
if there is no time-limit imposed on a query.- Returns:
- the maximum time for query execution
-
getScannedRecordsLimit
public int getScannedRecordsLimit()
Get the maximum number of records a query with this execute properties will scan. This will returnInteger.MAX_VALUE
if there is no limit to the number of records scanned by a query.- Returns:
- the maximum number of records a query will scan
-
getScannedBytesLimit
public long getScannedBytesLimit()
Get the maximum number of bytes a query with this execute properties will scan. This will returnLong.MAX_VALUE
if there is no limit to the number of bytes scanned by a query.- Returns:
- the maximum number of bytes a query will scan
-
getState
@Nonnull public ExecuteState getState()
-
setState
@Nonnull public ExecuteProperties setState(@Nonnull ExecuteState newState)
Build a newExecuteProperties
with the givenExecuteState
.- Parameters:
newState
- the new state- Returns:
- a new properties object with the new state
-
clearState
@Nonnull public ExecuteProperties clearState()
Build a newExecuteProperties
with an empty state.- Returns:
- a new properties object with an empty state
-
isFailOnScanLimitReached
public boolean isFailOnScanLimitReached()
Get whether reaching the scan limit throws an exception.- Returns:
true
if the scan limit throws an exception when reached,false
if the scan returns early withRecordCursor.NoNextReason.SCAN_LIMIT_REACHED
-
setFailOnScanLimitReached
public ExecuteProperties setFailOnScanLimitReached(boolean failOnScanLimitReached)
-
clearReturnedRowLimit
@Nonnull public ExecuteProperties clearReturnedRowLimit()
-
clearRowAndTimeLimits
@Nonnull public ExecuteProperties clearRowAndTimeLimits()
Clear the returned row limit and time limit. Does not clear the skip.- Returns:
- a new
ExecuteProperties
without the returned row and time limits
-
clearSkipAndLimit
@Nonnull public ExecuteProperties clearSkipAndLimit()
Clear the skip and returned row limit, but no other limits.- Returns:
- a new
ExecuteProperties
without the skip and returned row limit
-
clearSkipAndAdjustLimit
@Nonnull public 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.- Returns:
- a new properties without skip and with an adjusted limit
-
getReturnedRowLimitOrMax
public int getReturnedRowLimitOrMax()
Get the limit on the number of rows that will be returned as could be used for counting.- Returns:
- the limit or
Integer.MAX_VALUE
if there is no limit.
-
setLimitsFrom
@Nonnull public ExecuteProperties setLimitsFrom(@Nonnull ExecuteProperties other)
Merge these limits with the ones specified inother
, using the limit specified byother
except where it is unlimited, in which case the limit from thisExecuteProperties
is used instead.- Parameters:
other
- theExecuteProperties
to the take the limits from- Returns:
- an
ExecuteProperties
with limits merged as described above
-
getDefaultCursorStreamingMode
public CursorStreamingMode getDefaultCursorStreamingMode()
Get the defaultCursorStreamingMode
for newScanProperties
.- Returns:
- the default streaming mode
-
setDefaultCursorStreamingMode
public ExecuteProperties setDefaultCursorStreamingMode(CursorStreamingMode defaultCursorStreamingMode)
Set the defaultCursorStreamingMode
for newScanProperties
.- Parameters:
defaultCursorStreamingMode
- default streaming mode- Returns:
- a new
ExecuteProperties
with the given default streaming mode
-
resetState
@Nonnull public ExecuteProperties resetState()
Reset the stateful parts of the properties to their "original" values, creating an independent mutable state.- Returns:
- an
ExecuteProperties
with an independent mutable state - See Also:
ExecuteState.reset()
-
copy
@Nonnull protected ExecuteProperties copy(int skip, int rowLimit, long timeLimit, @Nonnull IsolationLevel isolationLevel, @Nonnull ExecuteState state, boolean failOnScanLimitReached, CursorStreamingMode defaultCursorStreamingMode)
Create a new instance with these fields, copying any additional fields from subclasses.- Parameters:
skip
- skip countrowLimit
- returned row limittimeLimit
- time limitisolationLevel
- isolation levelstate
- execute statefailOnScanLimitReached
- fail on scan limit reacheddefaultCursorStreamingMode
- default streaming mode- Returns:
- a new properties with the given fields changed and other fields copied from this properties
-
asScanProperties
@Nonnull public ScanProperties asScanProperties(boolean reverse)
-
newBuilder
@Nonnull public static ExecuteProperties.Builder newBuilder()
-
toBuilder
@Nonnull public ExecuteProperties.Builder toBuilder()
-
-