diff --git a/scylla/src/lib.rs b/scylla/src/lib.rs index 7b942c85c..cbbf79525 100644 --- a/scylla/src/lib.rs +++ b/scylla/src/lib.rs @@ -17,15 +17,15 @@ //! `Session` is created by specifying a few known nodes and connecting to them: //! //! ```rust,no_run -//! use scylla::{LegacySession, SessionBuilder}; +//! use scylla::{Session, SessionBuilder}; //! use std::error::Error; //! //! #[tokio::main] //! async fn main() -> Result<(), Box> { -//! let session: LegacySession = SessionBuilder::new() +//! let session: Session = SessionBuilder::new() //! .known_node("127.0.0.1:9042") //! .known_node("1.2.3.4:9876") -//! .build_legacy() +//! .build() //! .await?; //! //! Ok(()) @@ -50,9 +50,9 @@ //! //! The easiest way to specify bound values in a query is using a tuple: //! ```rust -//! # use scylla::LegacySession; +//! # use scylla::Session; //! # use std::error::Error; -//! # async fn check_only_compiles(session: &LegacySession) -> Result<(), Box> { +//! # async fn check_only_compiles(session: &Session) -> Result<(), Box> { //! // Insert an int and text into the table //! session //! .query_unpaged( @@ -70,22 +70,20 @@ //! The easiest way to read rows returned by a query is to cast each row to a tuple of values: //! //! ```rust -//! # use scylla::LegacySession; +//! # use scylla::Session; //! # use std::error::Error; -//! # async fn check_only_compiles(session: &LegacySession) -> Result<(), Box> { -//! use scylla::IntoTypedRows; +//! # async fn check_only_compiles(session: &Session) -> Result<(), Box> { //! //! // Read rows containing an int and text //! // Keep in mind that all results come in one response (no paging is done!), //! // so the memory footprint and latency may be huge! //! // To prevent that, use `Session::query_iter` or `Session::query_single_page`. -//! let rows_opt = session -//! .query_unpaged("SELECT a, b FROM ks.tab", &[]) -//! .await? -//! .rows; +//! let query_result = session +//! .query_unpaged("SELECT a, b FROM ks.tab", &[]) +//! .await?; //! -//! if let Some(rows) = rows_opt { -//! for row in rows.into_typed::<(i32, String)>() { +//! if let Some(rows) = query_result.maybe_rows::<(i32, String)>()? { +//! for row in rows { //! // Parse row as int and text \ //! let (int_val, text_val): (i32, String) = row?; //! } diff --git a/scylla/src/transport/execution_profile.rs b/scylla/src/transport/execution_profile.rs index e977fe81a..7b7a14faa 100644 --- a/scylla/src/transport/execution_profile.rs +++ b/scylla/src/transport/execution_profile.rs @@ -16,7 +16,7 @@ //! # extern crate scylla; //! # use std::error::Error; //! # async fn check_only_compiles() -> Result<(), Box> { -//! use scylla::{LegacySession, SessionBuilder}; +//! use scylla::{Session, SessionBuilder}; //! use scylla::statement::Consistency; //! use scylla::transport::ExecutionProfile; //! @@ -27,10 +27,10 @@ //! //! let handle = profile.into_handle(); //! -//! let session: LegacySession = SessionBuilder::new() +//! let session: Session = SessionBuilder::new() //! .known_node("127.0.0.1:9042") //! .default_execution_profile_handle(handle) -//! .build_legacy() +//! .build() //! .await?; //! # Ok(()) //! # } @@ -109,7 +109,7 @@ //! # extern crate scylla; //! # use std::error::Error; //! # async fn check_only_compiles() -> Result<(), Box> { -//! use scylla::{LegacySession, SessionBuilder}; +//! use scylla::{Session, SessionBuilder}; //! use scylla::query::Query; //! use scylla::statement::Consistency; //! use scylla::transport::ExecutionProfile; @@ -125,10 +125,10 @@ //! let mut handle1 = profile1.clone().into_handle(); //! let mut handle2 = profile2.clone().into_handle(); //! -//! let session: LegacySession = SessionBuilder::new() +//! let session: Session = SessionBuilder::new() //! .known_node("127.0.0.1:9042") //! .default_execution_profile_handle(handle1.clone()) -//! .build_legacy() +//! .build() //! .await?; //! //! let mut query1 = Query::from("SELECT * FROM ks.table"); diff --git a/scylla/src/transport/session.rs b/scylla/src/transport/session.rs index 04107faf8..172a786f2 100644 --- a/scylla/src/transport/session.rs +++ b/scylla/src/transport/session.rs @@ -508,9 +508,9 @@ impl GenericSession { /// /// # Examples /// ```rust - /// # use scylla::LegacySession; + /// # use scylla::Session; /// # use std::error::Error; - /// # async fn check_only_compiles(session: &LegacySession) -> Result<(), Box> { + /// # async fn check_only_compiles(session: &Session) -> Result<(), Box> { /// // Insert an int and text into a table. /// session /// .query_unpaged( @@ -522,23 +522,22 @@ impl GenericSession { /// # } /// ``` /// ```rust - /// # use scylla::LegacySession; + /// # use scylla::Session; /// # use std::error::Error; - /// # async fn check_only_compiles(session: &LegacySession) -> Result<(), Box> { + /// # async fn check_only_compiles(session: &Session) -> Result<(), Box> { /// use scylla::IntoTypedRows; /// /// // Read rows containing an int and text. /// // Keep in mind that all results come in one response (no paging is done!), /// // so the memory footprint and latency may be huge! /// // To prevent that, use `Session::query_iter` or `Session::query_single_page`. - /// let rows_opt = session - /// .query_unpaged("SELECT a, b FROM ks.tab", &[]) - /// .await? - /// .rows; - /// - /// if let Some(rows) = rows_opt { - /// for row in rows.into_typed::<(i32, String)>() { - /// // Parse row as int and text \ + /// let query_result = session + /// .query_unpaged("SELECT a, b FROM ks.tab", &[]) + /// .await?; + /// + /// if let Some(rows) = query_result.maybe_rows::<(i32, String)>()? { + /// for row in rows { + /// // Parse row as int and text. /// let (int_val, text_val): (i32, String) = row?; /// } /// } @@ -632,16 +631,16 @@ impl GenericSession { /// # Example /// /// ```rust - /// # use scylla::LegacySession; + /// # use scylla::Session; /// # use std::error::Error; - /// # async fn check_only_compiles(session: &LegacySession) -> Result<(), Box> { + /// # async fn check_only_compiles(session: &Session) -> Result<(), Box> { /// use scylla::IntoTypedRows; /// use futures::stream::StreamExt; /// /// let mut rows_stream = session /// .query_iter("SELECT a, b FROM ks.t", &[]) /// .await? - /// .into_typed::<(i32, i32)>(); + /// .into_typed::<(i32, i32)>()?; /// /// while let Some(next_row_res) = rows_stream.next().await { /// let (a, b): (i32, i32) = next_row_res?; @@ -685,9 +684,9 @@ impl GenericSession { /// /// # Example /// ```rust - /// # use scylla::LegacySession; + /// # use scylla::Session; /// # use std::error::Error; - /// # async fn check_only_compiles(session: &LegacySession) -> Result<(), Box> { + /// # async fn check_only_compiles(session: &Session) -> Result<(), Box> { /// use scylla::prepared_statement::PreparedStatement; /// /// // Prepare the query for later execution @@ -789,12 +788,11 @@ impl GenericSession { /// # Example /// /// ```rust - /// # use scylla::LegacySession; + /// # use scylla::Session; /// # use std::error::Error; - /// # async fn check_only_compiles(session: &LegacySession) -> Result<(), Box> { + /// # async fn check_only_compiles(session: &Session) -> Result<(), Box> { /// use scylla::prepared_statement::PreparedStatement; /// use scylla::IntoTypedRows; - /// use futures::stream::StreamExt; /// /// // Prepare the query for later execution /// let prepared: PreparedStatement = session @@ -805,7 +803,7 @@ impl GenericSession { /// let mut rows_stream = session /// .execute_iter(prepared, &[]) /// .await? - /// .into_typed::<(i32, i32)>(); + /// .into_typed::<(i32, i32)>()?; /// /// while let Some(next_row_res) = rows_stream.next().await { /// let (a, b): (i32, i32) = next_row_res?; @@ -841,9 +839,9 @@ impl GenericSession { /// /// # Example /// ```rust - /// # use scylla::LegacySession; + /// # use scylla::Session; /// # use std::error::Error; - /// # async fn check_only_compiles(session: &LegacySession) -> Result<(), Box> { + /// # async fn check_only_compiles(session: &Session) -> Result<(), Box> { /// use scylla::batch::Batch; /// /// let mut batch: Batch = Default::default(); @@ -970,13 +968,13 @@ where /// ```rust /// # use std::error::Error; /// # async fn check_only_compiles() -> Result<(), Box> { - /// use scylla::{LegacySession, SessionConfig}; + /// use scylla::{Session, SessionConfig}; /// use scylla::transport::KnownNode; /// /// let mut config = SessionConfig::new(); /// config.known_nodes.push(KnownNode::Hostname("127.0.0.1:9042".to_string())); /// - /// let session: LegacySession = LegacySession::connect(config).await?; + /// let session: Session = Session::connect(config).await?; /// # Ok(()) /// # } /// ``` @@ -1303,9 +1301,9 @@ where /// /// # Example /// ```rust - /// # use scylla::LegacySession; + /// # use scylla::Session; /// # use std::error::Error; - /// # async fn check_only_compiles(session: &LegacySession) -> Result<(), Box> { + /// # async fn check_only_compiles(session: &Session) -> Result<(), Box> { /// use scylla::prepared_statement::PreparedStatement; /// /// // Prepare the query for later execution @@ -1631,9 +1629,9 @@ where /// /// # Example /// ```rust /// # extern crate scylla; - /// # use scylla::LegacySession; + /// # use scylla::Session; /// # use std::error::Error; - /// # async fn check_only_compiles(session: &LegacySession) -> Result<(), Box> { + /// # async fn check_only_compiles(session: &Session) -> Result<(), Box> { /// use scylla::batch::Batch; /// /// // Create a batch statement with unprepared statements @@ -1692,10 +1690,10 @@ where /// * `case_sensitive` - if set to true the generated query will put keyspace name in quotes /// # Example /// ```rust - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # use scylla::transport::Compression; /// # async fn example() -> Result<(), Box> { - /// # let session = SessionBuilder::new().known_node("127.0.0.1:9042").build_legacy().await?; + /// # let session = SessionBuilder::new().known_node("127.0.0.1:9042").build().await?; /// session /// .query_unpaged("INSERT INTO my_keyspace.tab (a) VALUES ('test1')", &[]) /// .await?; diff --git a/scylla/src/transport/session_builder.rs b/scylla/src/transport/session_builder.rs index 5a40fec65..ea6c24c58 100644 --- a/scylla/src/transport/session_builder.rs +++ b/scylla/src/transport/session_builder.rs @@ -58,13 +58,13 @@ pub type CloudSessionBuilder = GenericSessionBuilder; /// # Example /// /// ``` -/// # use scylla::{LegacySession, SessionBuilder}; +/// # use scylla::{Session, SessionBuilder}; /// # use scylla::transport::Compression; /// # async fn example() -> Result<(), Box> { -/// let session: LegacySession = SessionBuilder::new() +/// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .compression(Some(Compression::Snappy)) -/// .build_legacy() +/// .build() /// .await?; /// # Ok(()) /// # } @@ -93,22 +93,22 @@ impl GenericSessionBuilder { /// Add a known node with a hostname /// # Examples /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } /// ``` /// /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("db1.example.com") - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -121,12 +121,12 @@ impl GenericSessionBuilder { /// Add a known node with an IP address /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # use std::net::{SocketAddr, IpAddr, Ipv4Addr}; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node_addr(SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 9042)) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -139,11 +139,11 @@ impl GenericSessionBuilder { /// Add a list of known nodes with hostnames /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_nodes(["127.0.0.1:9042", "db1.example.com"]) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -156,15 +156,15 @@ impl GenericSessionBuilder { /// Add a list of known nodes with IP addresses /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # use std::net::{SocketAddr, IpAddr, Ipv4Addr}; /// # async fn example() -> Result<(), Box> { /// let addr1 = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(172, 17, 0, 3)), 9042); /// let addr2 = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(172, 17, 0, 4)), 9042); /// - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_nodes_addr([addr1, addr2]) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -182,14 +182,14 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # use scylla::transport::Compression; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .use_keyspace("my_keyspace_name", false) /// .user("cassandra", "cassandra") - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -208,7 +208,7 @@ impl GenericSessionBuilder { /// ``` /// # use std::sync::Arc; /// use bytes::Bytes; - /// use scylla::{LegacySession, SessionBuilder}; + /// use scylla::{Session, SessionBuilder}; /// use async_trait::async_trait; /// use scylla::authentication::{AuthenticatorProvider, AuthenticatorSession, AuthError}; /// # use scylla::transport::Compression; @@ -236,12 +236,12 @@ impl GenericSessionBuilder { /// } /// /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .use_keyspace("my_keyspace_name", false) /// .user("cassandra", "cassandra") /// .authenticator_provider(Arc::new(CustomAuthenticatorProvider)) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -262,7 +262,7 @@ impl GenericSessionBuilder { /// # use async_trait::async_trait; /// # use std::net::SocketAddr; /// # use std::sync::Arc; - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # use scylla::transport::session::{AddressTranslator, TranslationError}; /// # use scylla::transport::topology::UntranslatedPeer; /// struct IdentityTranslator; @@ -278,10 +278,10 @@ impl GenericSessionBuilder { /// } /// /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .address_translator(Arc::new(IdentityTranslator)) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -292,7 +292,7 @@ impl GenericSessionBuilder { /// # use std::sync::Arc; /// # use std::collections::HashMap; /// # use std::str::FromStr; - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # use scylla::transport::session::{AddressTranslator, TranslationError}; /// # /// # async fn example() -> Result<(), Box> { @@ -300,10 +300,10 @@ impl GenericSessionBuilder { /// let addr_before_translation = SocketAddr::from_str("192.168.0.42:19042").unwrap(); /// let addr_after_translation = SocketAddr::from_str("157.123.12.42:23203").unwrap(); /// translation_rules.insert(addr_before_translation, addr_after_translation); - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .address_translator(Arc::new(translation_rules)) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -323,7 +323,7 @@ impl GenericSessionBuilder { /// ``` /// # use std::fs; /// # use std::path::PathBuf; - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # use openssl::ssl::{SslContextBuilder, SslVerifyMode, SslMethod, SslFiletype}; /// # async fn example() -> Result<(), Box> { /// let certdir = fs::canonicalize(PathBuf::from("./examples/certs/scylla.crt"))?; @@ -331,10 +331,10 @@ impl GenericSessionBuilder { /// context_builder.set_certificate_file(certdir.as_path(), SslFiletype::PEM)?; /// context_builder.set_verify(SslVerifyMode::NONE); /// - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .ssl_context(Some(context_builder.build())) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -346,8 +346,8 @@ impl GenericSessionBuilder { } } -// NOTE: this `impl` block contains configuration options specific for **Cloud** [`LegacySession`]. -// This means that if an option fits both non-Cloud and Cloud `LegacySession`s, it should NOT be put +// NOTE: this `impl` block contains configuration options specific for **Cloud** [`Session`]. +// This means that if an option fits both non-Cloud and Cloud `Session`s, it should NOT be put // here, but rather in `impl GenericSessionBuilder` block. #[cfg(feature = "cloud")] impl CloudSessionBuilder { @@ -382,13 +382,13 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # use scylla::transport::Compression; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .compression(Some(Compression::Snappy)) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -403,13 +403,13 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # use std::time::Duration; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .schema_agreement_interval(Duration::from_secs(5)) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -423,17 +423,17 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{statement::Consistency, ExecutionProfile, LegacySession, SessionBuilder}; + /// # use scylla::{statement::Consistency, ExecutionProfile, Session, SessionBuilder}; /// # use std::time::Duration; /// # async fn example() -> Result<(), Box> { /// let execution_profile = ExecutionProfile::builder() /// .consistency(Consistency::All) /// .request_timeout(Some(Duration::from_secs(2))) /// .build(); - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .default_execution_profile_handle(execution_profile.into_handle()) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -451,12 +451,12 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .tcp_nodelay(true) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -474,12 +474,12 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .tcp_keepalive_interval(std::time::Duration::from_secs(42)) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -502,13 +502,13 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # use scylla::transport::Compression; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .use_keyspace("my_keyspace_name", false) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -532,7 +532,7 @@ impl GenericSessionBuilder { /// let session: LegacySession = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .compression(Some(Compression::Snappy)) - /// .build_legacy() // Turns SessionBuilder into Session + /// .build_legacy() // Turns SessionBuilder into LegacySession /// .await?; /// # Ok(()) /// # } @@ -546,7 +546,7 @@ impl GenericSessionBuilder { /// Builds the Session after setting all the options. /// /// The new session object uses the new deserialization API. If you wish - /// to use the old API, use [`SessionBuilder::build_legacy`]. + /// to use the old API, use [`SessionBuilder::build`]. /// /// # Example /// ``` @@ -573,13 +573,13 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # use std::time::Duration; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .connection_timeout(Duration::from_secs(30)) - /// .build_legacy() // Turns SessionBuilder into Session + /// .build() // Turns SessionBuilder into Session /// .await?; /// # Ok(()) /// # } @@ -594,17 +594,17 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # async fn example() -> Result<(), Box> { /// use std::num::NonZeroUsize; /// use scylla::transport::session::PoolSize; /// /// // This session will establish 4 connections to each node. /// // For Scylla clusters, this number will be divided across shards - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .pool_size(PoolSize::PerHost(NonZeroUsize::new(4).unwrap())) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -638,12 +638,12 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .disallow_shard_aware_port(true) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -658,12 +658,12 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .keyspaces_to_fetch(["my_keyspace"]) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -681,12 +681,12 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .fetch_schema_metadata(true) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -704,12 +704,12 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .keepalive_interval(std::time::Duration::from_secs(42)) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -734,12 +734,12 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .keepalive_timeout(std::time::Duration::from_secs(42)) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -761,12 +761,12 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .schema_agreement_timeout(std::time::Duration::from_secs(120)) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -781,12 +781,12 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .auto_await_schema_agreement(false) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -809,16 +809,16 @@ impl GenericSessionBuilder { /// # use async_trait::async_trait; /// # use std::net::SocketAddr; /// # use std::sync::Arc; - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # use scylla::transport::session::{AddressTranslator, TranslationError}; /// # use scylla::transport::host_filter::DcHostFilter; /// /// # async fn example() -> Result<(), Box> { /// // The session will only connect to nodes from "my-local-dc" - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .host_filter(Arc::new(DcHostFilter::new("my-local-dc".to_string()))) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -833,12 +833,12 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .refresh_metadata_on_auto_schema_agreement(true) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -861,13 +861,13 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # use std::num::NonZeroU32; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .tracing_info_fetch_attempts(NonZeroU32::new(10).unwrap()) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -890,13 +890,13 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # use std::time::Duration; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .tracing_info_fetch_interval(Duration::from_millis(50)) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -912,12 +912,12 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder, statement::Consistency}; + /// # use scylla::{Session, SessionBuilder, statement::Consistency}; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .tracing_info_fetch_consistency(Consistency::One) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -942,13 +942,13 @@ impl GenericSessionBuilder { /// /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # use scylla::transport::Compression; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .write_coalescing(false) // Enabled by default - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # } @@ -967,12 +967,12 @@ impl GenericSessionBuilder { /// means that the metadata is refreshed every 20 seconds. /// # Example /// ``` - /// # use scylla::{LegacySession, SessionBuilder}; + /// # use scylla::{Session, SessionBuilder}; /// # async fn example() -> Result<(), Box> { - /// let session: LegacySession = SessionBuilder::new() + /// let session: Session = SessionBuilder::new() /// .known_node("127.0.0.1:9042") /// .cluster_metadata_refresh_interval(std::time::Duration::from_secs(20)) - /// .build_legacy() + /// .build() /// .await?; /// # Ok(()) /// # }