diff --git a/scylla-cql/src/frame/response/cql_to_rust.rs b/scylla-cql/src/frame/response/cql_to_rust.rs index a2a450ea9..89330c6e4 100644 --- a/scylla-cql/src/frame/response/cql_to_rust.rs +++ b/scylla-cql/src/frame/response/cql_to_rust.rs @@ -10,6 +10,11 @@ use std::net::IpAddr; use thiserror::Error; use uuid::Uuid; +#[deprecated( + since = "0.15.1", + note = "Legacy deserialization API is inefficient and is going to be removed soon" +)] +#[allow(deprecated)] #[derive(Error, Debug, Clone, PartialEq, Eq)] pub enum FromRowError { #[error("{err} in the column with index {column}")] @@ -29,6 +34,10 @@ pub trait FromCqlVal: Sized { fn from_cql(cql_val: T) -> Result; } +#[deprecated( + since = "0.15.1", + note = "Legacy deserialization API is inefficient and is going to be removed soon" +)] #[derive(Error, Debug, Clone, PartialEq, Eq)] pub enum FromCqlValError { #[error("Bad CQL type")] @@ -99,6 +108,10 @@ impl> FromCqlVal> for Option { /// /// impl_from_cql_value_from_method!(MyBytes, into_my_bytes); /// ``` +#[deprecated( + since = "0.15.1", + note = "Legacy deserialization API is inefficient and is going to be removed soon" +)] #[macro_export] macro_rules! impl_from_cql_value_from_method { ($T:ty, $convert_func:ident) => { diff --git a/scylla/src/transport/errors.rs b/scylla/src/transport/errors.rs index 778f33f29..668fa94df 100644 --- a/scylla/src/transport/errors.rs +++ b/scylla/src/transport/errors.rs @@ -34,15 +34,15 @@ use thiserror::Error; use crate::{authentication::AuthError, frame::response}; -use super::{ - iterator::NextRowError, - legacy_query_result::IntoLegacyQueryResultError, - query_result::{IntoRowsResultError, SingleRowError}, -}; +use super::iterator::NextRowError; +#[allow(deprecated)] +use super::legacy_query_result::IntoLegacyQueryResultError; +use super::query_result::{IntoRowsResultError, SingleRowError}; /// Error that occurred during query execution #[derive(Error, Debug, Clone)] #[non_exhaustive] +#[allow(deprecated)] pub enum QueryError { /// Database sent a response containing some error with a message #[error("Database returned an error: {0}, Error message: {1}")] @@ -115,6 +115,11 @@ pub enum QueryError { /// Failed to convert [`QueryResult`][crate::transport::query_result::QueryResult] /// into [`LegacyQueryResult`][crate::transport::legacy_query_result::LegacyQueryResult]. + #[deprecated( + since = "0.15.1", + note = "Legacy deserialization API is inefficient and is going to be removed soon" + )] + #[allow(deprecated)] #[error("Failed to convert `QueryResult` into `LegacyQueryResult`: {0}")] IntoLegacyQueryResultError(#[from] IntoLegacyQueryResultError), } @@ -181,6 +186,7 @@ impl From for NewSessionError { QueryError::BrokenConnection(e) => NewSessionError::BrokenConnection(e), QueryError::UnableToAllocStreamId => NewSessionError::UnableToAllocStreamId, QueryError::RequestTimeout(msg) => NewSessionError::RequestTimeout(msg), + #[allow(deprecated)] QueryError::IntoLegacyQueryResultError(e) => { NewSessionError::IntoLegacyQueryResultError(e) } @@ -204,6 +210,7 @@ impl From for QueryError { /// Error that occurred during session creation #[derive(Error, Debug, Clone)] #[non_exhaustive] +#[allow(deprecated)] pub enum NewSessionError { /// Failed to resolve hostname passed in Session creation #[error("Couldn't resolve any hostname: {0:?}")] @@ -286,6 +293,11 @@ pub enum NewSessionError { /// Failed to convert [`QueryResult`][crate::transport::query_result::QueryResult] /// into [`LegacyQueryResult`][crate::transport::legacy_query_result::LegacyQueryResult]. + #[deprecated( + since = "0.15.1", + note = "Legacy deserialization API is inefficient and is going to be removed soon" + )] + #[allow(deprecated)] #[error("Failed to convert `QueryResult` into `LegacyQueryResult`: {0}")] IntoLegacyQueryResultError(#[from] IntoLegacyQueryResultError), } diff --git a/scylla/src/transport/iterator.rs b/scylla/src/transport/iterator.rs index 8d7c07be3..f11d9dd73 100644 --- a/scylla/src/transport/iterator.rs +++ b/scylla/src/transport/iterator.rs @@ -1154,6 +1154,10 @@ mod legacy { } /// Couldn't get next typed row from the iterator + #[deprecated( + since = "0.15.1", + note = "Legacy deserialization API is inefficient and is going to be removed soon" + )] #[derive(Error, Debug, Clone)] pub enum LegacyNextRowError { /// Query to fetch next page has failed diff --git a/scylla/src/transport/legacy_query_result.rs b/scylla/src/transport/legacy_query_result.rs index 599174320..91fe47a58 100644 --- a/scylla/src/transport/legacy_query_result.rs +++ b/scylla/src/transport/legacy_query_result.rs @@ -11,6 +11,11 @@ use uuid::Uuid; /// Trait used to implement `Vec::into_typed` // This is the only way to add custom method to Vec +#[deprecated( + since = "0.15.1", + note = "Legacy deserialization API is inefficient and is going to be removed soon" +)] +#[allow(deprecated)] pub trait IntoTypedRows { fn into_typed(self) -> TypedRowIter; } @@ -28,6 +33,10 @@ impl IntoTypedRows for Vec { /// Iterator over rows parsed as the given type\ /// Returned by `rows.into_typed::<(...)>()` +#[deprecated( + since = "0.15.1", + note = "Legacy deserialization API is inefficient and is going to be removed soon" +)] pub struct TypedRowIter { row_iter: std::vec::IntoIter, phantom_data: std::marker::PhantomData, @@ -185,6 +194,10 @@ impl LegacyQueryResult { /// An error that occurred during [`QueryResult`](crate::transport::query_result::QueryResult) /// to [`LegacyQueryResult`] conversion. +#[deprecated( + since = "0.15.1", + note = "Legacy deserialization API is inefficient and is going to be removed soon" +)] #[non_exhaustive] #[derive(Error, Clone, Debug)] pub enum IntoLegacyQueryResultError { @@ -205,6 +218,11 @@ pub enum IntoLegacyQueryResultError { /// Expected `LegacyQueryResult.rows` to be `Some`, but it was `None`.\ /// `LegacyQueryResult.rows` is `Some` for queries that can return rows (e.g `SELECT`).\ /// It is `None` for queries that can't return rows (e.g `INSERT`). +#[deprecated( + since = "0.15.1", + note = "Legacy deserialization API is inefficient and is going to be removed soon" +)] +#[allow(deprecated)] #[derive(Debug, Clone, Error, PartialEq, Eq)] #[error( "LegacyQueryResult::rows() or similar function called on a bad LegacyQueryResult. @@ -259,6 +277,11 @@ pub enum FirstRowTypedError { FromRowError(#[from] FromRowError), } +#[deprecated( + since = "0.15.1", + note = "Legacy deserialization API is inefficient and is going to be removed soon" +)] +#[allow(deprecated)] #[derive(Debug, Clone, Error, PartialEq, Eq)] pub enum MaybeFirstRowTypedError { /// [`LegacyQueryResult::maybe_first_row_typed()`](LegacyQueryResult::maybe_first_row_typed) called on a bad LegacyQueryResult.\ @@ -273,6 +296,11 @@ pub enum MaybeFirstRowTypedError { FromRowError(#[from] FromRowError), } +#[deprecated( + since = "0.15.1", + note = "Legacy deserialization API is inefficient and is going to be removed soon" +)] +#[allow(deprecated)] #[derive(Debug, Clone, Error, PartialEq, Eq)] pub enum SingleRowError { /// [`LegacyQueryResult::single_row()`](LegacyQueryResult::single_row) called on a bad LegacyQueryResult.\ @@ -287,6 +315,11 @@ pub enum SingleRowError { BadNumberOfRows(usize), } +#[deprecated( + since = "0.15.1", + note = "Legacy deserialization API is inefficient and is going to be removed soon" +)] +#[allow(deprecated)] #[derive(Debug, Clone, Error, PartialEq, Eq)] pub enum SingleRowTypedError { /// [`LegacyQueryResult::single_row_typed()`](LegacyQueryResult::single_row_typed) called on a bad LegacyQueryResult.\ diff --git a/scylla/src/transport/load_balancing/default.rs b/scylla/src/transport/load_balancing/default.rs index 89220fbf2..16fd6ac9a 100644 --- a/scylla/src/transport/load_balancing/default.rs +++ b/scylla/src/transport/load_balancing/default.rs @@ -2853,6 +2853,7 @@ mod latency_awareness { | QueryError::DbError(DbError::RateLimitReached { .. }, _) => false, // "slow" errors, i.e. ones that are returned after considerable time of query being run + #[allow(deprecated)] QueryError::DbError(_, _) | QueryError::CqlResultParseError(_) | QueryError::CqlErrorParseError(_) diff --git a/scylla/src/transport/session.rs b/scylla/src/transport/session.rs index 11b413dad..90bdfead4 100644 --- a/scylla/src/transport/session.rs +++ b/scylla/src/transport/session.rs @@ -83,6 +83,7 @@ pub use crate::transport::connection_pool::PoolSize; // This re-export is to preserve backward compatibility. // Those items are no longer here not to clutter session.rs with legacy things. +#[allow(deprecated)] pub use crate::transport::legacy_query_result::{IntoTypedRows, TypedRowIter}; use crate::authentication::AuthenticatorProvider; diff --git a/scylla/src/transport/speculative_execution.rs b/scylla/src/transport/speculative_execution.rs index 60344d0a0..756ed3d89 100644 --- a/scylla/src/transport/speculative_execution.rs +++ b/scylla/src/transport/speculative_execution.rs @@ -110,6 +110,7 @@ fn can_be_ignored(result: &Result) -> bool { QueryError::EmptyPlan => false, // Errors that should not appear here, thus should not be ignored + #[allow(deprecated)] QueryError::NextRowError(_) | QueryError::IntoLegacyQueryResultError(_) | QueryError::TimeoutError