Skip to content

Commit

Permalink
Merge pull request #1084 from wprzytula/connection-raw-unpaged-api-re…
Browse files Browse the repository at this point in the history
…move-paging-state

connection: remove paging state parameter from unpaged raw API
  • Loading branch information
wprzytula authored Oct 7, 2024
2 parents 2ac20a9 + cbb8978 commit 1a2c51b
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions scylla/src/transport/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ impl Connection {
// This method is used only for driver internal queries, so no need to consult execution profile here.
let query: Query = query.into();

self.query_raw_unpaged(&query, PagingState::start())
self.query_raw_unpaged(&query)
.await
.map_err(Into::into)
.and_then(QueryResponse::into_query_result)
Expand All @@ -1034,7 +1034,6 @@ impl Connection {
pub(crate) async fn query_raw_unpaged(
&self,
query: &Query,
paging_state: PagingState,
) -> Result<QueryResponse, UserRequestError> {
// This method is used only for driver internal queries, so no need to consult execution profile here.
self.query_raw_with_consistency(
Expand All @@ -1044,7 +1043,7 @@ impl Connection {
.determine_consistency(self.config.default_consistency),
query.config.serial_consistency.flatten(),
None,
paging_state,
PagingState::start(),
)
.await
}
Expand Down Expand Up @@ -1084,7 +1083,7 @@ impl Connection {
values: SerializedValues,
) -> Result<QueryResult, QueryError> {
// This method is used only for driver internal queries, so no need to consult execution profile here.
self.execute_raw_unpaged(prepared, values, PagingState::start())
self.execute_raw_unpaged(prepared, values)
.await
.map_err(Into::into)
.and_then(QueryResponse::into_query_result)
Expand All @@ -1095,7 +1094,6 @@ impl Connection {
&self,
prepared: &PreparedStatement,
values: SerializedValues,
paging_state: PagingState,
) -> Result<QueryResponse, UserRequestError> {
// This method is used only for driver internal queries, so no need to consult execution profile here.
self.execute_raw_with_consistency(
Expand All @@ -1106,7 +1104,7 @@ impl Connection {
.determine_consistency(self.config.default_consistency),
prepared.config.serial_consistency.flatten(),
None,
paging_state,
PagingState::start(),
)
.await
}
Expand Down Expand Up @@ -1362,7 +1360,7 @@ impl Connection {
false => format!("USE {}", keyspace_name.as_str()).into(),
};

let query_response = self.query_raw_unpaged(&query, PagingState::start()).await?;
let query_response = self.query_raw_unpaged(&query).await?;
Self::verify_use_keyspace_result(keyspace_name, query_response)
}

Expand Down Expand Up @@ -2390,7 +2388,6 @@ mod tests {

use super::ConnectionConfig;
use crate::query::Query;
use crate::statement::PagingState;
use crate::test_utils::setup_tracing;
use crate::transport::connection::open_connection;
use crate::transport::node::ResolvedContactPoint;
Expand Down Expand Up @@ -2490,11 +2487,7 @@ mod tests {
let mut insert_futures = Vec::new();
for v in &values {
let values = prepared.serialize_values(&(*v,)).unwrap();
let fut = async {
connection
.execute_raw_unpaged(&prepared, values, PagingState::start())
.await
};
let fut = async { connection.execute_raw_unpaged(&prepared, values).await };
insert_futures.push(fut);
}

Expand Down Expand Up @@ -2596,10 +2589,8 @@ mod tests {
let values = prepared
.serialize_values(&(j, vec![j as u8; j as usize]))
.unwrap();
let response = conn
.execute_raw_unpaged(&prepared, values, PagingState::start())
.await
.unwrap();
let response =
conn.execute_raw_unpaged(&prepared, values).await.unwrap();
// QueryResponse might contain an error - make sure that there were no errors
let _nonerror_response =
response.into_non_error_query_response().unwrap();
Expand Down

0 comments on commit 1a2c51b

Please sign in to comment.