Class QueryOptions
- java.lang.Object
-
- io.streamthoughts.azkarra.api.query.QueryOptions
-
public class QueryOptions extends Object
TheQueryOptions
cane be used to set the options to be used for querying a state store.
-
-
Constructor Summary
Constructors Constructor Description QueryOptions(int retries, Duration retryBackoff, Duration queryTimeout, boolean remoteAccessAllowed, Long limit)
Creates a newQueryOptions
instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
int
hashCode()
static QueryOptions
immediately()
Helper method a create a newQueryOptions
with the a zerotimeout
.Long
limit()
Gets the maximum number of records to return.static QueryOptions
locally()
Helper method to create a newQueryOptions
with remote access disable.Duration
queryTimeout()
Gets the maximum duration for executing the execute.boolean
remoteAccessAllowed()
Gets whether remote access is allowed.int
retries()
Gets the maximum number of attempts.static QueryOptions
retries(int retries, Duration retryBackoff)
Duration
retryBackoff()
Gets the time interval before attempting a new operation.String
toString()
static QueryOptions
with(Duration timeout)
Helper method to create a newQueryOptions
with the giventimeout
.QueryOptions
withLimit(Long limit)
QueryOptions
withQueryTimeout(Duration timeout)
QueryOptions
withRemoteAccessAllowed(boolean remoteAccessAllowed)
QueryOptions
withRetries(int retries)
QueryOptions
withRetryBackoffMs(Duration retryBackoff)
-
-
-
Constructor Detail
-
QueryOptions
public QueryOptions(int retries, Duration retryBackoff, Duration queryTimeout, boolean remoteAccessAllowed, Long limit)
Creates a newQueryOptions
instance.- Parameters:
retries
-retries
.retryBackoff
-retryBackoff
.queryTimeout
-queryTimeout
.remoteAccessAllowed
-retryBackoff
.limit
-limit
.
-
-
Method Detail
-
with
public static QueryOptions with(Duration timeout)
Helper method to create a newQueryOptions
with the giventimeout
.- Parameters:
timeout
- the total time of state store execute.- Returns:
- a new
QueryOptions
instance.
-
locally
public static QueryOptions locally()
Helper method to create a newQueryOptions
with remote access disable.- Returns:
- a new
QueryOptions
instance.
-
immediately
public static QueryOptions immediately()
Helper method a create a newQueryOptions
with the a zerotimeout
.- Returns:
- a new
QueryOptions
instance.
-
retries
public static QueryOptions retries(int retries, Duration retryBackoff)
- Parameters:
retries
- number of attempts to run after failed access.retryBackoff
- time to wait before attempting to retry a failed access.- Returns:
- a new
QueryOptions
instance.
-
withRemoteAccessAllowed
public QueryOptions withRemoteAccessAllowed(boolean remoteAccessAllowed)
-
withQueryTimeout
public QueryOptions withQueryTimeout(Duration timeout)
-
withRetries
public QueryOptions withRetries(int retries)
-
withRetryBackoffMs
public QueryOptions withRetryBackoffMs(Duration retryBackoff)
-
withLimit
public QueryOptions withLimit(Long limit)
-
retries
public int retries()
Gets the maximum number of attempts.- Returns:
- the number retries.
-
retryBackoff
public Duration retryBackoff()
Gets the time interval before attempting a new operation.- Returns:
- the retry backoff.
-
remoteAccessAllowed
public boolean remoteAccessAllowed()
Gets whether remote access is allowed.- Returns:
true
if remote access if allowed,false
otherwise.
-
queryTimeout
public Duration queryTimeout()
Gets the maximum duration for executing the execute.- Returns:
- the timeout.
-
limit
public Long limit()
Gets the maximum number of records to return. -1 is infinite.- Returns:
- the limit.
-
-