Package com.apple.foundationdb.record
Class ExecuteProperties
java.lang.Object
com.apple.foundationdb.record.ExecuteProperties
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 -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final IsolationLevel
protected final int
static final ExecuteProperties
A basic set of properties for an unlimited query/scan execution with serializable isolation.protected final int
static final long
A constant representing that no time limit is set. -
Method Summary
Modifier and TypeMethodDescriptionasScanProperties
(boolean reverse) Clear the returned row limit and time limit.Remove any skip count and adjust the limit to include enough rows that we can skip those and then apply the current limit.Clear the skip and returned row limit, but no other limits.Build a newExecuteProperties
with an empty state.protected ExecuteProperties
copy
(int skip, int rowLimit, long timeLimit, IsolationLevel isolationLevel, ExecuteState state, boolean failOnScanLimitReached, CursorStreamingMode defaultCursorStreamingMode, boolean isDryRun) Create a new instance with these fields, copying any additional fields from subclasses.Get the defaultCursorStreamingMode
for newScanProperties
.int
Get the limit on the number of rows that will be returned as it would be passed to FDB.int
Get the limit on the number of rows that will be returned as could be used for counting.long
Get the maximum number of bytes a query with this execute properties will scan.int
Get the maximum number of records a query with this execute properties will scan.int
getSkip()
getState()
long
Get the time limit for query execution.boolean
isDryRun()
boolean
Get whether reaching the scan limit throws an exception.static ExecuteProperties.Builder
Reset the stateful parts of the properties to their "original" values, creating an independent mutable state.setDefaultCursorStreamingMode
(CursorStreamingMode defaultCursorStreamingMode) Set the defaultCursorStreamingMode
for newScanProperties
.setDryRun
(boolean isDryRun) setFailOnScanLimitReached
(boolean failOnScanLimitReached) 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.setReturnedRowLimit
(int rowLimit) Set the limit on the number of rows that will be returned.setSkip
(int skip) setState
(ExecuteState newState) Build a newExecuteProperties
with the givenExecuteState
.toString()
-
Field Details
-
UNLIMITED_TIME
public static final long UNLIMITED_TIMEA constant representing that no time limit is set.- See Also:
-
SERIAL_EXECUTE
A basic set of properties for an unlimited query/scan execution with serializable isolation. -
isolationLevel
-
skip
protected final int skip -
rowLimit
protected final int rowLimit
-
-
Method Details
-
getIsolationLevel
-
getSkip
public int getSkip() -
setSkip
-
isDryRun
public boolean isDryRun() -
setDryRun
-
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
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
-
setState
Build a newExecuteProperties
with the givenExecuteState
.- Parameters:
newState
- the new state- Returns:
- a new properties object with the new state
-
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
-
clearReturnedRowLimit
-
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
Clear the skip and returned row limit, but no other limits.- Returns:
- a new
ExecuteProperties
without the skip and returned row limit
-
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
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
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
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:
-
copy
@Nonnull protected ExecuteProperties copy(int skip, int rowLimit, long timeLimit, @Nonnull IsolationLevel isolationLevel, @Nonnull ExecuteState state, boolean failOnScanLimitReached, CursorStreamingMode defaultCursorStreamingMode, boolean isDryRun) 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 modeisDryRun
- whether it is dry run- Returns:
- a new properties with the given fields changed and other fields copied from this properties
-
asScanProperties
-
newBuilder
-
toBuilder
-
toString
-