cdrs_tokio/statement/statement_params.rs
1use cassandra_protocol::query::QueryParams;
2use cassandra_protocol::types::value::Value;
3use derivative::Derivative;
4use std::sync::Arc;
5
6use crate::cluster::Murmur3Token;
7use crate::retry::RetryPolicy;
8use crate::speculative_execution::SpeculativeExecutionPolicy;
9
10/// Parameters of Query for query operation.
11#[derive(Default, Clone, Derivative)]
12#[derivative(Debug)]
13pub struct StatementParams {
14 /// Protocol-level parameters.
15 pub query_params: QueryParams,
16 /// Is the query idempotent.
17 pub is_idempotent: bool,
18 /// Query keyspace. If not using a global one, setting it explicitly might help the load
19 /// balancer use more appropriate nodes. Note: prepared statements with keyspace information
20 /// take precedence over this field.
21 pub keyspace: Option<String>,
22 /// The token to use for token-aware routing. A load balancer may use this information to
23 /// determine which nodes to contact. Takes precedence over `routing_key`.
24 pub token: Option<Murmur3Token>,
25 /// The partition key to use for token-aware routing. A load balancer may use this information
26 /// to determine which nodes to contact. Alternative to `token`. Note: prepared statements
27 /// with bound primary key values take precedence over this field.
28 pub routing_key: Option<Vec<Value>>,
29 /// Should tracing be enabled.
30 pub tracing: bool,
31 /// Should warnings be enabled.
32 pub warnings: bool,
33 /// Custom statement speculative execution policy.
34 #[derivative(Debug = "ignore")]
35 pub speculative_execution_policy: Option<Arc<dyn SpeculativeExecutionPolicy + Send + Sync>>,
36 /// Custom statement retry policy.
37 #[derivative(Debug = "ignore")]
38 pub retry_policy: Option<Arc<dyn RetryPolicy + Send + Sync>>,
39 /// Enable beta protocol features. Server will respond with ERROR if protocol version is marked
40 /// as beta on server and client does not provide this flag.
41 pub beta_protocol: bool,
42}