R - The result type of the query.public interface QueryResult<R>StateQueryRequest.| Modifier and Type | Method and Description |
|---|---|
void | addExecutionInfo(String message)Used by stores to add detailed execution information (if requested) during query execution. |
static <R> QueryResult<R> | forFailure(FailureReason failureReason, String failureMessage)Static factory method to create a result object for a failed query. |
static <R> QueryResult<R> | forResult(R result)Static factory method to create a result object for a successful query. |
static <R> QueryResult<R> | forUnknownQueryType(Query<R> query, StateStore store)Static factory method to create a failed query result object to indicate that the store does not know how to handle the query. |
List<String> | getExecutionInfo()If detailed execution information was requested in StateQueryRequest.enableExecutionInfo(), this method returned the execution details for this partition's result. |
String | getFailureMessage()If this partition failed to execute the query, returns the failure message. |
FailureReason | getFailureReason()If this partition failed to execute the query, returns the reason. |
Position | getPosition()This state partition's exact position in its history when this query was executed. |
R | getResult()Returns the result of executing the query on one partition. |
boolean | isFailure()True iff the query execution failed. |
boolean | isSuccess()True iff the query was successfully executed. |
static <R> QueryResult<R> | notUpToBound(Position currentPosition, PositionBound positionBound, Integer partition)Static factory method to create a failed query result object to indicate that the store has not yet caught up to the requested position bound. |
void | setPosition(Position position)Used by stores to report what exact position in the store's history it was at when it executed the query. |
static <R> QueryResult<R> forResult(R result)
StateStore.query(Query, PositionBound, QueryConfig).static <R> QueryResult<R> forFailure(FailureReason failureReason, String failureMessage)
StateStore.query(Query, PositionBound, QueryConfig).static <R> QueryResult<R> forUnknownQueryType(Query<R> query, StateStore store)
Used by StateStores to respond to a StateStore.query(Query, PositionBound, QueryConfig).
static <R> QueryResult<R> notUpToBound(Position currentPosition, PositionBound positionBound, Integer partition)
Used by StateStores to respond to a StateStore.query(Query, PositionBound, QueryConfig).
void addExecutionInfo(String message)
void setPosition(Position position)
boolean isSuccess()
getResult().boolean isFailure()
getFailureReason() and getFailureMessage().List<String> getExecutionInfo()
StateQueryRequest.enableExecutionInfo(), this method returned the execution details for this partition's result.Position getPosition()
StateQueryRequest.withPositionBound(PositionBound). Note: stores are encouraged, but not required to set this property.
FailureReason getFailureReason()
IllegalArgumentException - if this is not a failed result.String getFailureMessage()
IllegalArgumentException - if this is not a failed result.R getResult()
null for a successful query, so isSuccess() and isFailure() must be used to determine whether the query was successful of failed on this partition.IllegalArgumentException - if this is not a successful query.