Skip to content

Commit

Permalink
exec_profile/docs: query -> statement
Browse files Browse the repository at this point in the history
  • Loading branch information
muzarski committed May 6, 2024
1 parent 6a47d1f commit 2aa7ce8
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions scylla/src/transport/execution_profile.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `ExecutionProfile` is a grouping of configurable options regarding query execution.
//! `ExecutionProfile` is a grouping of configurable options regarding statement execution.
//!
//! Profiles can be created to represent different workloads, which thanks to them
//! can be run conveniently on a single session.
Expand Down Expand Up @@ -37,12 +37,12 @@
//! ```
//!
//! ### Example
//! To create an `ExecutionProfile` and attach it to a `Query`:
//! To create an `ExecutionProfile` and attach it to an `UnpreparedStatement`:
//! ```
//! # extern crate scylla;
//! # use std::error::Error;
//! # async fn check_only_compiles() -> Result<(), Box<dyn Error>> {
//! use scylla::query::Query;
//! use scylla::unprepared_statement::UnpreparedStatement;
//! use scylla::statement::Consistency;
//! use scylla::transport::ExecutionProfile;
//! use std::time::Duration;
Expand All @@ -54,10 +54,10 @@
//!
//! let handle = profile.into_handle();
//!
//! let mut query1 = Query::from("SELECT * FROM ks.table");
//! let mut query1 = UnpreparedStatement::from("SELECT * FROM ks.table");
//! query1.set_execution_profile_handle(Some(handle.clone()));
//!
//! let mut query2 = Query::from("SELECT pk FROM ks.table WHERE pk = ?");
//! let mut query2 = UnpreparedStatement::from("SELECT pk FROM ks.table WHERE pk = ?");
//! query2.set_execution_profile_handle(Some(handle));
//! # Ok(())
//! # }
Expand Down Expand Up @@ -110,7 +110,7 @@
//! # use std::error::Error;
//! # async fn check_only_compiles() -> Result<(), Box<dyn Error>> {
//! use scylla::{Session, SessionBuilder};
//! use scylla::query::Query;
//! use scylla::unprepared_statement::UnpreparedStatement;
//! use scylla::statement::Consistency;
//! use scylla::transport::ExecutionProfile;
//!
Expand All @@ -131,8 +131,8 @@
//! .build()
//! .await?;
//!
//! let mut query1 = Query::from("SELECT * FROM ks.table");
//! let mut query2 = Query::from("SELECT pk FROM ks.table WHERE pk = ?");
//! let mut query1 = UnpreparedStatement::from("SELECT * FROM ks.table");
//! let mut query2 = UnpreparedStatement::from("SELECT pk FROM ks.table WHERE pk = ?");
//!
//! query1.set_execution_profile_handle(Some(handle1.clone()));
//! query2.set_execution_profile_handle(Some(handle2.clone()));
Expand Down Expand Up @@ -256,16 +256,16 @@ impl ExecutionProfileBuilder {
self
}

/// Specify a default consistency to be used for queries.
/// It's possible to override it by explicitly setting a consistency on the chosen query.
/// Specify a default consistency to be used for statements.
/// It's possible to override it by explicitly setting a consistency on the chosen statement.
pub fn consistency(mut self, consistency: Consistency) -> Self {
self.consistency = Some(consistency);
self
}

/// Specify a default serial consistency to be used for queries.
/// Specify a default serial consistency to be used for statements.
/// It's possible to override it by explicitly setting a serial consistency
/// on the chosen query.
/// on the chosen statement.
pub fn serial_consistency(mut self, serial_consistency: Option<SerialConsistency>) -> Self {
self.serial_consistency = Some(serial_consistency);
self
Expand Down Expand Up @@ -294,7 +294,7 @@ impl ExecutionProfileBuilder {
self
}

/// Sets the [`RetryPolicy`] to use by default on queries.
/// Sets the [`RetryPolicy`] to use by default on statements.
/// The default is [DefaultRetryPolicy](crate::transport::retry_policy::DefaultRetryPolicy).
/// It is possible to implement a custom retry policy by implementing the trait [`RetryPolicy`].
///
Expand Down Expand Up @@ -385,11 +385,11 @@ impl Default for ExecutionProfileBuilder {
}
}

/// A profile that groups configurable options regarding query execution.
/// A profile that groups configurable options regarding statement execution.
///
/// Execution profile is immutable as such, but the driver implements double indirection of form:
/// query/Session -> ExecutionProfileHandle -> ExecutionProfile
/// which enables on-fly changing the actual profile associated with all entities (query/Session)
/// statement/Session -> ExecutionProfileHandle -> ExecutionProfile
/// which enables on-fly changing the actual profile associated with all entities (statement/Session)
/// by the same handle.
#[derive(Debug, Clone)]
pub struct ExecutionProfile(pub(crate) Arc<ExecutionProfileInner>);
Expand Down Expand Up @@ -458,7 +458,7 @@ impl ExecutionProfile {

/// A handle that points to an ExecutionProfile.
///
/// Its goal is to enable remapping all associated entities (query/Session)
/// Its goal is to enable remapping all associated entities (statement/Session)
/// to another execution profile at once.
/// Note: Cloned handles initially point to the same Arc'ed execution profile.
/// However, as the mapping has yet another level of indirection - through
Expand All @@ -481,7 +481,7 @@ impl ExecutionProfileHandle {
}

/// Makes the handle point to a new execution profile.
/// All entities (queries/Session) holding this handle will reflect the change.
/// All entities (statement/Session) holding this handle will reflect the change.
pub fn map_to_another_profile(&mut self, profile: ExecutionProfile) {
self.0 .0.store(profile.0)
}
Expand Down

0 comments on commit 2aa7ce8

Please sign in to comment.