SelfT
- the "self type" used for covariant returns in subtypes.public interface GraphStatement<SelfT extends GraphStatement<SelfT>> extends Request
Modifier and Type | Field and Description |
---|---|
static GenericType<CompletionStage<AsyncGraphResultSet>> |
ASYNC
The type returned when a graph statement is executed asynchronously.
|
static GenericType<GraphResultSet> |
SYNC
The type returned when a graph statement is executed synchronously.
|
Modifier and Type | Method and Description |
---|---|
ConsistencyLevel |
getConsistencyLevel()
Returns the consistency level to use for the statement.
|
String |
getGraphName()
The name of the graph to use for this statement.
|
default CqlIdentifier |
getKeyspace()
Graph statements do not have a per-query keyspace, this method always returns
null . |
ConsistencyLevel |
getReadConsistencyLevel()
The consistency level to use for the internal read queries that will be produced by this
statement.
|
default ByteBuffer |
getRoutingKey()
Graph statements can't be routed, this method always returns
null . |
default CqlIdentifier |
getRoutingKeyspace()
Graph statements can't be routed, this method always returns
null . |
default Token |
getRoutingToken()
Graph statements can't be routed, this method always returns
null . |
String |
getSubProtocol()
The DSE graph sub-protocol to use for this statement.
|
Duration |
getTimeout()
How long to wait for this request to complete.
|
long |
getTimestamp()
Get the timestamp set on the statement.
|
String |
getTraversalSource()
The name of the traversal source to use for this statement.
|
ConsistencyLevel |
getWriteConsistencyLevel()
The consistency level to use for the internal write queries that will be produced by this
statement.
|
default boolean |
isTracing()
Whether tracing information should be recorded for this statement.
|
SelfT |
setConsistencyLevel(ConsistencyLevel newConsistencyLevel)
Sets the consistency level to use for this statement.
|
SelfT |
setCustomPayload(Map<String,ByteBuffer> newCustomPayload)
Sets the custom payload to use for execution.
|
SelfT |
setExecutionProfile(DriverExecutionProfile executionProfile)
Sets the configuration profile to use for execution.
|
SelfT |
setExecutionProfileName(String name)
Sets the name of the driver configuration profile that will be used for execution.
|
SelfT |
setGraphName(String newGraphName)
Sets the graph name.
|
SelfT |
setIdempotent(Boolean idempotent)
Set the idempotence to use for execution.
|
SelfT |
setNode(Node newNode)
Sets the
Node that should handle this query. |
SelfT |
setReadConsistencyLevel(ConsistencyLevel newReadConsistencyLevel)
Sets the read consistency level.
|
SelfT |
setSubProtocol(String newSubProtocol)
Sets the sub-protocol.
|
SelfT |
setTimeout(Duration newTimeout)
Sets how long to wait for this request to complete.
|
SelfT |
setTimestamp(long timestamp)
Set the timestamp to use for execution.
|
SelfT |
setTraversalSource(String newTraversalSource)
Sets the traversal source.
|
SelfT |
setWriteConsistencyLevel(ConsistencyLevel newWriteConsistencyLevel)
Sets the write consistency level.
|
getCustomPayload, getExecutionProfile, getExecutionProfileName, getNode, isIdempotent
static final GenericType<GraphResultSet> SYNC
Most users won't use this explicitly. It is needed for the generic execute method (Session.execute(Request, GenericType)
), but graph statements will generally be run with one of
the DSE driver's built-in helper methods (such as GraphSession.execute(GraphStatement)
).
static final GenericType<CompletionStage<AsyncGraphResultSet>> ASYNC
Most users won't use this explicitly. It is needed for the generic execute method (Session.execute(Request, GenericType)
), but graph statements will generally be run with one of
the DSE driver's built-in helper methods (such as GraphSession.executeAsync(GraphStatement)
).
@NonNull @CheckReturnValue SelfT setIdempotent(@Nullable Boolean idempotent)
Idempotence defines whether it will be possible to speculatively re-execute the statement,
based on a SpeculativeExecutionPolicy
.
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
idempotent
- a boolean instance to set a statement-specific value, or null
to use
the default idempotence defined in the configuration.@Nullable Duration getTimeout()
Note that, if this method returns null
, graph statements fall back to a dedicated
configuration option: basic.graph.timeout
. See reference.conf
in the DSE driver
distribution for more details.
getTimeout
in interface Request
null
to use the default value defined in the
configuration.DefaultDriverOption.REQUEST_TIMEOUT
@NonNull @CheckReturnValue SelfT setTimeout(@Nullable Duration newTimeout)
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
newTimeout
- the timeout to use, or null
to use the default value defined in the
configuration.getTimeout()
@NonNull @CheckReturnValue SelfT setNode(@Nullable Node newNode)
Node
that should handle this query.
In the general case, use of this method is heavily discouraged and should only be used in specific cases, such as applying a series of schema changes, which may be advantageous to execute in sequence on the same node.
Configuring a specific node causes the configured LoadBalancingPolicy
to be
completely bypassed. However, if the load balancing policy dictates that the node is at
distance NodeDistance.IGNORED
or there is no active connectivity to the node, the
request will fail with a NoNodeAvailableException
.
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
newNode
- The node that should be used to handle executions of this statement or null to
delegate to the configured load balancing policy.long getTimestamp()
By default, if left unset, the value returned by this is Long.MIN_VALUE
, which means
that the timestamp will be set via the Timestamp Generator.
@CheckReturnValue SelfT setTimestamp(long timestamp)
By default the timestamp generator (see reference config file) will be used for timestamps, unless set explicitly via this method.
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
@NonNull @CheckReturnValue SelfT setExecutionProfile(@Nullable DriverExecutionProfile executionProfile)
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
@NonNull @CheckReturnValue SelfT setExecutionProfileName(@Nullable String name)
For all the driver's built-in implementations, this method has no effect if setExecutionProfile(com.datastax.oss.driver.api.core.config.DriverExecutionProfile)
has been called with a non-null argument.
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
@NonNull @CheckReturnValue SelfT setCustomPayload(@NonNull Map<String,ByteBuffer> newCustomPayload)
This is intended for advanced use cases, such as tools with very advanced knowledge of DSE Graph, and reserved for internal settings like transaction settings. Note that the driver also adds graph-related options to the payload, in addition to the ones provided here; it won't override any option that is already present.
All the driver's built-in statement implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
Note that it's your responsibility to provide a thread-safe map. This can be achieved with a concurrent or immutable implementation, or by making it effectively immutable (meaning that it's never modified after being set on the statement).
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
@Nullable String getGraphName()
This is the programmatic equivalent of the configuration option basic.graph.name
,
and takes precedence over it. That is, if this property is non-null, then the configuration
will be ignored.
@NonNull @CheckReturnValue SelfT setGraphName(@Nullable String newGraphName)
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
getGraphName()
@Nullable String getTraversalSource()
This is the programmatic equivalent of the configuration option basic.graph.traversal-source
, and takes precedence over it. That is, if this property is
non-null, then the configuration will be ignored.
@NonNull @CheckReturnValue SelfT setTraversalSource(@Nullable String newTraversalSource)
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
getTraversalSource()
@Nullable String getSubProtocol()
This is the programmatic equivalent of the configuration option advanced.graph.sub-protocol
, and takes precedence over it. That is, if this property is
non-null, then the configuration will be ignored.
@NonNull @CheckReturnValue SelfT setSubProtocol(@Nullable String newSubProtocol)
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
getSubProtocol()
@Nullable ConsistencyLevel getConsistencyLevel()
This is the programmatic equivalent of the configuration option basic.request.consistency
, and takes precedence over it. That is, if this property is
non-null, then the configuration will be ignored.
@CheckReturnValue SelfT setConsistencyLevel(@Nullable ConsistencyLevel newConsistencyLevel)
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
newConsistencyLevel
- the consistency level to use, or null to use the default value
defined in the configuration.getConsistencyLevel()
@Nullable ConsistencyLevel getReadConsistencyLevel()
This is the programmatic equivalent of the configuration option basic.graph.read-consistency-level
, and takes precedence over it. That is, if this property is
non-null, then the configuration will be ignored.
If this property isn't set here or in the configuration, the default consistency level will
be used (getConsistencyLevel()
or basic.request.consistency
).
@NonNull @CheckReturnValue SelfT setReadConsistencyLevel(@Nullable ConsistencyLevel newReadConsistencyLevel)
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
getReadConsistencyLevel()
@Nullable ConsistencyLevel getWriteConsistencyLevel()
This is the programmatic equivalent of the configuration option basic.graph.write-consistency-level
, and takes precedence over it. That is, if this property
is non-null, then the configuration will be ignored.
If this property isn't set here or in the configuration, the default consistency level will
be used (getConsistencyLevel()
or basic.request.consistency
).
@NonNull @CheckReturnValue SelfT setWriteConsistencyLevel(@Nullable ConsistencyLevel newWriteConsistencyLevel)
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
getWriteConsistencyLevel()
@Nullable default CqlIdentifier getKeyspace()
null
.getKeyspace
in interface Request
@Nullable default CqlIdentifier getRoutingKeyspace()
null
.getRoutingKeyspace
in interface Request
@Nullable default ByteBuffer getRoutingKey()
null
.getRoutingKey
in interface Request
@Nullable default Token getRoutingToken()
null
.getRoutingToken
in interface Request
default boolean isTracing()
This method is only exposed for future extensibility. At the time of writing, graph
statements do not support tracing, and this always returns false
.
Copyright © 2017–2020. All rights reserved.