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 IsolationLevelprotected final intstatic final ExecutePropertiesA basic set of properties for an unlimited query/scan execution with serializable isolation.protected final intstatic final longA 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 newExecutePropertieswith an empty state.protected ExecutePropertiescopy(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 defaultCursorStreamingModefor newScanProperties.intGet the limit on the number of rows that will be returned as it would be passed to FDB.intGet the limit on the number of rows that will be returned as could be used for counting.longGet the maximum number of bytes a query with this execute properties will scan.intGet the maximum number of records a query with this execute properties will scan.intgetSkip()getState()longGet the time limit for query execution.booleanisDryRun()booleanGet whether reaching the scan limit throws an exception.static ExecuteProperties.BuilderReset the stateful parts of the properties to their "original" values, creating an independent mutable state.setDefaultCursorStreamingMode(CursorStreamingMode defaultCursorStreamingMode) Set the defaultCursorStreamingModefor newScanProperties.setDryRun(boolean isDryRun) setFailOnScanLimitReached(boolean failOnScanLimitReached) setLimitsFrom(ExecuteProperties other) Merge these limits with the ones specified inother, using the limit specified byotherexcept where it is unlimited, in which case the limit from thisExecutePropertiesis 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 newExecutePropertieswith 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_UNLIMITEDif there is no limit.
-
setReturnedRowLimit
Set the limit on the number of rows that will be returned.- Parameters:
rowLimit- the limit orReadTransaction.ROW_LIMIT_UNLIMITEDorInteger.MAX_VALUEfor no limit- Returns:
- a new
ExecutePropertieswith the given limit
-
getTimeLimit
public long getTimeLimit()Get the time limit for query execution. This will returnUNLIMITED_TIMEif 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_VALUEif 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_VALUEif 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 newExecutePropertieswith the givenExecuteState.- Parameters:
newState- the new state- Returns:
- a new properties object with the new state
-
clearState
Build a newExecutePropertieswith 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:
trueif the scan limit throws an exception when reached,falseif 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
ExecutePropertieswithout the returned row and time limits
-
clearSkipAndLimit
Clear the skip and returned row limit, but no other limits.- Returns:
- a new
ExecutePropertieswithout 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_VALUEif there is no limit.
-
setLimitsFrom
Merge these limits with the ones specified inother, using the limit specified byotherexcept where it is unlimited, in which case the limit from thisExecutePropertiesis used instead.- Parameters:
other- theExecutePropertiesto the take the limits from- Returns:
- an
ExecutePropertieswith limits merged as described above
-
getDefaultCursorStreamingMode
Get the defaultCursorStreamingModefor newScanProperties.- Returns:
- the default streaming mode
-
setDefaultCursorStreamingMode
public ExecuteProperties setDefaultCursorStreamingMode(CursorStreamingMode defaultCursorStreamingMode) Set the defaultCursorStreamingModefor newScanProperties.- Parameters:
defaultCursorStreamingMode- default streaming mode- Returns:
- a new
ExecutePropertieswith the given default streaming mode
-
resetState
Reset the stateful parts of the properties to their "original" values, creating an independent mutable state.- Returns:
- an
ExecutePropertieswith 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
-