public interface PrepareRequest extends Request
Driver clients should rarely have to deal directly with this type, it's used internally by
Session
's prepare methods. However a RetryPolicy
implementation might use it if
it needs a custom behavior for prepare requests.
A client may also provide their own implementation of this interface to customize which
attributes are propagated when preparing a simple statement; see SyncCqlSession.prepare(SimpleStatement)
for more explanations.
Modifier and Type | Field and Description |
---|---|
static GenericType<CompletionStage<PreparedStatement>> |
ASYNC
The type returned when a CQL statement is prepared asynchronously.
|
static GenericType<PreparedStatement> |
SYNC
The type returned when a CQL statement is prepared synchronously.
|
Modifier and Type | Method and Description |
---|---|
Boolean |
areBoundStatementsIdempotent()
Whether bound statements that will be created from the prepared statement are idempotent.
|
boolean |
areBoundStatementsTracing()
Whether bound statements that will be created from the prepared statement are tracing.
|
ConsistencyLevel |
getConsistencyLevelForBoundStatements()
The consistency level to use for the bound statements that will be created from the prepared
statement or
null to use the default value from the configuration. |
Map<String,ByteBuffer> |
getCustomPayloadForBoundStatements()
Returns the custom payload to send alongside the bound statements that will be created from the
prepared statement.
|
DriverExecutionProfile |
getExecutionProfileForBoundStatements()
The execution profile to use for the bound statements that will be created from the prepared
statement.
|
String |
getExecutionProfileNameForBoundStatements()
The name of the execution profile to use for the bound statements that will be created from the
prepared statement.
|
int |
getPageSizeForBoundStatements()
The page size to use for the bound statements that will be created from the prepared statement.
|
ByteBuffer |
getPagingStateForBoundStatements()
The paging state to use for the bound statements that will be created from the prepared
statement.
|
String |
getQuery()
The CQL query to prepare.
|
ByteBuffer |
getRoutingKeyForBoundStatements()
The routing key to use for the bound statements that will be created from the prepared
statement.
|
CqlIdentifier |
getRoutingKeyspaceForBoundStatements()
The routing keyspace to use for the bound statements that will be created from the prepared
statement.
|
Token |
getRoutingTokenForBoundStatements()
The routing key to use for the bound statements that will be created from the prepared
statement.
|
ConsistencyLevel |
getSerialConsistencyLevelForBoundStatements()
The serial consistency level to use for the bound statements that will be created from the
prepared statement or
null to use the default value from the configuration. |
Duration |
getTimeoutForBoundStatements()
The timeout to use for the bound statements that will be created from the prepared statement.
|
default Boolean |
isIdempotent()
Whether the request is idempotent; that is, whether applying the request twice leaves the
database in the same state.
|
getCustomPayload, getExecutionProfile, getExecutionProfileName, getKeyspace, getNode, getRoutingKey, getRoutingKeyspace, getRoutingToken, getTimeout
static final GenericType<PreparedStatement> SYNC
Most users won't use this explicitly. It is needed for the generic execute method (Session.execute(Request, GenericType)
), but CQL statements will generally be prepared with one
of the driver's built-in helper methods (such as SyncCqlSession.prepare(SimpleStatement)
).
static final GenericType<CompletionStage<PreparedStatement>> ASYNC
Most users won't use this explicitly. It is needed for the generic execute method (Session.execute(Request, GenericType)
), but CQL statements will generally be prepared with one
of the driver's built-in helper methods (such as AsyncCqlSession.prepareAsync(SimpleStatement)
.
@NonNull String getQuery()
@NonNull default Boolean isIdempotent()
This is used internally for retries and speculative executions: if a request is not idempotent, the driver will take extra care to ensure that it is not sent twice (for example, don't retry if there is the slightest chance that the request reached a coordinator).
Note that this refers to the prepare query itself, not to the bound statements that will be
created from the prepared statement (see areBoundStatementsIdempotent()
).
isIdempotent
in interface Request
null
to use the default value defined in the configuration.DefaultDriverOption.REQUEST_DEFAULT_IDEMPOTENCE
@Nullable String getExecutionProfileNameForBoundStatements()
Note that this will be ignored if getExecutionProfileForBoundStatements()
returns a
non-null value.
@Nullable DriverExecutionProfile getExecutionProfileForBoundStatements()
CqlIdentifier getRoutingKeyspaceForBoundStatements()
ByteBuffer getRoutingKeyForBoundStatements()
Token getRoutingTokenForBoundStatements()
If it's not null, it takes precedence over getRoutingKeyForBoundStatements()
.
@NonNull Map<String,ByteBuffer> getCustomPayloadForBoundStatements()
@Nullable Boolean areBoundStatementsIdempotent()
This follows the same semantics as isIdempotent()
.
@Nullable Duration getTimeoutForBoundStatements()
ByteBuffer getPagingStateForBoundStatements()
int getPageSizeForBoundStatements()
@Nullable ConsistencyLevel getConsistencyLevelForBoundStatements()
null
to use the default value from the configuration.@Nullable ConsistencyLevel getSerialConsistencyLevelForBoundStatements()
null
to use the default value from the configuration.boolean areBoundStatementsTracing()
Copyright © 2017–2020. All rights reserved.