Package com.apple.foundationdb.record
Class ExecuteState
- java.lang.Object
-
- com.apple.foundationdb.record.ExecuteState
-
@API(MAINTAINED) public class ExecuteState extends Object
An encapsulation of the mutable state of query or scan execution. In general, parameters that affect a query/scan execution (as opposed to a query plan) belong here if they involve mutable state and inExecuteProperties
otherwise. In general, the state object should be constructed by as part of a "root"ExecuteProperties
rather than directly by the client.
-
-
Field Summary
Fields Modifier and Type Field Description static ExecuteState
NO_LIMITS
An execute state with no scan limits.static ExecuteState
NO_SCANNED_RECORDS_LIMIT
Deprecated.in favor of NO_LIMITS when the byte scan limit was added
-
Constructor Summary
Constructors Constructor Description ExecuteState()
ExecuteState(RecordScanLimiter recordScanLimiter)
Deprecated.in favor of the constructor that takes multiple limitersExecuteState(RecordScanLimiter recordScanLimiter, ByteScanLimiter byteScanLimiter)
Creates an execute state with a supplied set of resource limiters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteScanLimiter
getByteScanLimiter()
Get a limiter for the maximum number of bytes that can be retrieved from the database.long
getBytesScanned()
Return the number of bytes that have been scanned.RecordScanLimiter
getRecordScanLimiter()
Get a limiter for the maximum number of records that can be retrieved from the database.int
getRecordsScanned()
Return the number of records that have been scanned.ExecuteState
reset()
Create a newExecuteState
that represents the same properties of the execution that this state represented when it was first created, but with an independent set of mutable objects.String
toString()
-
-
-
Field Detail
-
NO_LIMITS
public static final ExecuteState NO_LIMITS
An execute state with no scan limits.
-
NO_SCANNED_RECORDS_LIMIT
@API(DEPRECATED) @Deprecated public static final ExecuteState NO_SCANNED_RECORDS_LIMIT
Deprecated.in favor of NO_LIMITS when the byte scan limit was addedAn empty execute state with no scan limits.
-
-
Constructor Detail
-
ExecuteState
public ExecuteState(@Nullable RecordScanLimiter recordScanLimiter, @Nullable ByteScanLimiter byteScanLimiter)
Creates an execute state with a supplied set of resource limiters.- Parameters:
recordScanLimiter
- a record scan limiter ornull
to indicate an unlimited number of records may be scannedbyteScanLimiter
- a byte scan limiter ornull
to indicate an unlimited number of bytes may be scanned
-
ExecuteState
@API(DEPRECATED) @Deprecated public ExecuteState(@Nullable RecordScanLimiter recordScanLimiter)
Deprecated.in favor of the constructor that takes multiple limitersA deprecated constructor that takes only aRecordScanLimiter
and not aByteScanLimiter
.- Parameters:
recordScanLimiter
- aRecordScanLimiter
to use in this state
-
ExecuteState
public ExecuteState()
-
-
Method Detail
-
reset
@Nonnull public ExecuteState reset()
Create a newExecuteState
that represents the same properties of the execution that this state represented when it was first created, but with an independent set of mutable objects. For example, theRecordScanLimiter
of the returnedExecuteState
has a limit equal to the original limit that was used to create this state'sRecordScanLimiter
. It is up to the implementor to ensure that all components of the state are reset in a meaningful way, since this might vary depending on that piece of state.- Returns:
- a new state that represents the same properties but does not share mutable state with this
ExecuteState
-
getRecordScanLimiter
@Nonnull public RecordScanLimiter getRecordScanLimiter()
Get a limiter for the maximum number of records that can be retrieved from the database. Note that this limit is not strictly enforced, depending on the underlyingBaseCursor
implementation. All base cursors are always permitted to load at least one key-value entry before it is stopped by the record scan limit to ensure that cursors with multiple child cursors (such asUnionCursor
) can always make progress. Thus, a query execution might overrun its scanned records limit by up to the number of base cursors in the cursor tree. Particular base cursors may exceed the record scan limit in other ways, which are documented in their Javadocs.- Returns:
- the record scan limiter
-
getByteScanLimiter
@Nonnull public ByteScanLimiter getByteScanLimiter()
Get a limiter for the maximum number of bytes that can be retrieved from the database. Note that this limit is not strictly enforced, depending on the underlyingBaseCursor
implementation. All base cursors are always permitted to load at least one entry before it is stopped by the byte scan limit to ensure that cursors with multiple child cursors (such asUnionCursor
) can always make progress. Thus, a query execution might overrun the byte scan limit by an effectively arbitrary amount. Particular base cursors may exceed the record scan limit in other ways which are documented in their Javadocs.- Returns:
- the byte scan limiter
-
getRecordsScanned
public int getRecordsScanned()
Return the number of records that have been scanned.- Returns:
- the number of records that have been scanned
-
getBytesScanned
public long getBytesScanned()
Return the number of bytes that have been scanned.- Returns:
- the number of bytes that have been scanned
-
-