From d0d02f62cb5d23bd2ccec1d4169b0da9349005bd Mon Sep 17 00:00:00 2001 From: muzarski Date: Tue, 13 Feb 2024 00:40:21 +0100 Subject: [PATCH 1/4] frame: pub re-export submodules Pub re-exported the structs of scylla_cql::frame module and its submodules that contain any of the symbols that should be exposed publicly. This means that the following submodules will be private: - scylla_cql::frame::request - scylla_cql::frame::server_event_type - scylla_cql::frame::protocol_features --- scylla/src/lib.rs | 9 ++++++++- scylla/tests/integration/lwt_optimisation.rs | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/scylla/src/lib.rs b/scylla/src/lib.rs index 381fad34d3..98879cbd77 100644 --- a/scylla/src/lib.rs +++ b/scylla/src/lib.rs @@ -102,7 +102,14 @@ pub mod macros; #[doc(inline)] pub use macros::*; -pub use scylla_cql::frame; +pub mod frame { + pub use scylla_cql::frame::{frame_errors, response, types, value, Authenticator, Compression}; + pub(crate) use scylla_cql::frame::{ + parse_response_body_extensions, protocol_features, read_response_frame, request, + server_event_type, FrameParams, SerializedRequest, + }; +} + pub use scylla_cql::types::serialize; pub mod authentication; diff --git a/scylla/tests/integration/lwt_optimisation.rs b/scylla/tests/integration/lwt_optimisation.rs index 004840e66a..406323666c 100644 --- a/scylla/tests/integration/lwt_optimisation.rs +++ b/scylla/tests/integration/lwt_optimisation.rs @@ -2,9 +2,10 @@ use crate::utils::{setup_tracing, test_with_3_node_cluster}; use scylla::frame::types; use scylla::retry_policy::FallthroughRetryPolicy; +use scylla::test_utils::unique_keyspace_name; use scylla::transport::session::Session; -use scylla::{frame::protocol_features::ProtocolFeatures, test_utils::unique_keyspace_name}; use scylla::{ExecutionProfile, SessionBuilder}; +use scylla_cql::frame::protocol_features::ProtocolFeatures; use std::sync::Arc; use tokio::sync::mpsc; From 3c9013cc028f4a34bd6138ab2de88ae17c29109f Mon Sep 17 00:00:00 2001 From: muzarski Date: Tue, 13 Feb 2024 00:58:45 +0100 Subject: [PATCH 2/4] frame/types: re-export pub types Re-exported the Consistency and SerialConsistency types. Hidden utility functions such as `read/write_int`. --- scylla/benches/benchmark.rs | 8 ++++---- scylla/src/lib.rs | 6 +++++- scylla/tests/integration/lwt_optimisation.rs | 3 +-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/scylla/benches/benchmark.rs b/scylla/benches/benchmark.rs index 20440ea0b7..61d35d8f97 100644 --- a/scylla/benches/benchmark.rs +++ b/scylla/benches/benchmark.rs @@ -1,11 +1,11 @@ use criterion::{criterion_group, criterion_main, Criterion}; use bytes::BytesMut; -use scylla::{ - frame::types, - transport::partitioner::{calculate_token_for_partition_key, Murmur3Partitioner}, +use scylla::transport::partitioner::{calculate_token_for_partition_key, Murmur3Partitioner}; +use scylla_cql::{ + frame::{response::result::ColumnType, types}, + types::serialize::row::SerializedValues, }; -use scylla_cql::{frame::response::result::ColumnType, types::serialize::row::SerializedValues}; fn types_benchmark(c: &mut Criterion) { let mut buf = BytesMut::with_capacity(64); diff --git a/scylla/src/lib.rs b/scylla/src/lib.rs index 98879cbd77..cdab5022b9 100644 --- a/scylla/src/lib.rs +++ b/scylla/src/lib.rs @@ -103,11 +103,15 @@ pub mod macros; pub use macros::*; pub mod frame { - pub use scylla_cql::frame::{frame_errors, response, types, value, Authenticator, Compression}; + pub use scylla_cql::frame::{frame_errors, response, value, Authenticator, Compression}; pub(crate) use scylla_cql::frame::{ parse_response_body_extensions, protocol_features, read_response_frame, request, server_event_type, FrameParams, SerializedRequest, }; + + pub mod types { + pub use scylla_cql::frame::types::{Consistency, SerialConsistency}; + } } pub use scylla_cql::types::serialize; diff --git a/scylla/tests/integration/lwt_optimisation.rs b/scylla/tests/integration/lwt_optimisation.rs index 406323666c..a36d7367de 100644 --- a/scylla/tests/integration/lwt_optimisation.rs +++ b/scylla/tests/integration/lwt_optimisation.rs @@ -1,11 +1,10 @@ use crate::utils::{setup_tracing, test_with_3_node_cluster}; - -use scylla::frame::types; use scylla::retry_policy::FallthroughRetryPolicy; use scylla::test_utils::unique_keyspace_name; use scylla::transport::session::Session; use scylla::{ExecutionProfile, SessionBuilder}; use scylla_cql::frame::protocol_features::ProtocolFeatures; +use scylla_cql::frame::types; use std::sync::Arc; use tokio::sync::mpsc; From 8b5cabb0a74961fbca42eca914be9acfe8d04774 Mon Sep 17 00:00:00 2001 From: muzarski Date: Tue, 13 Feb 2024 01:05:25 +0100 Subject: [PATCH 3/4] frame/response: pub re-export submodules pub re-exported submodules that contain publicly used types. The submodules re-exported as pub: - scylla_cql::frame::response::cql_to_rust - scylla_cql::frame::response::result The submodules re-exported as pub(crate): - scylla_cql::frame::response::authenticate - scylla_cql::frame::response::error - scylla_cql::frame::response::event - scylla_cql::frame::response::supported --- scylla/src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scylla/src/lib.rs b/scylla/src/lib.rs index cdab5022b9..e15cfedf21 100644 --- a/scylla/src/lib.rs +++ b/scylla/src/lib.rs @@ -103,7 +103,7 @@ pub mod macros; pub use macros::*; pub mod frame { - pub use scylla_cql::frame::{frame_errors, response, value, Authenticator, Compression}; + pub use scylla_cql::frame::{frame_errors, value, Authenticator, Compression}; pub(crate) use scylla_cql::frame::{ parse_response_body_extensions, protocol_features, read_response_frame, request, server_event_type, FrameParams, SerializedRequest, @@ -112,6 +112,11 @@ pub mod frame { pub mod types { pub use scylla_cql::frame::types::{Consistency, SerialConsistency}; } + + pub mod response { + pub(crate) use scylla_cql::frame::response::*; + pub use scylla_cql::frame::response::{cql_to_rust, result}; + } } pub use scylla_cql::types::serialize; From 73bbf87911764526152c2035625fe7bec0d6001f Mon Sep 17 00:00:00 2001 From: muzarski Date: Tue, 13 Feb 2024 01:26:25 +0100 Subject: [PATCH 4/4] response/result: re-export pub types Re-exported types that should be exposed to users. Re-exported types: - ColumnSpec - ColumnType - CqlValue - PartitionKeyIndex - Row - TableSpec Note for reviewers: As mentioned in https://github.com/scylladb/scylla-rust-driver/pull/925#discussion_r1475074404, we should not expose the `PreparedMetadata` structure. I believe the same applies to `ResultMetadata`. That's why I decided not to re-export them. --- scylla/src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scylla/src/lib.rs b/scylla/src/lib.rs index e15cfedf21..1b46559698 100644 --- a/scylla/src/lib.rs +++ b/scylla/src/lib.rs @@ -114,8 +114,15 @@ pub mod frame { } pub mod response { + pub use scylla_cql::frame::response::cql_to_rust; pub(crate) use scylla_cql::frame::response::*; - pub use scylla_cql::frame::response::{cql_to_rust, result}; + + pub mod result { + pub(crate) use scylla_cql::frame::response::result::*; + pub use scylla_cql::frame::response::result::{ + ColumnSpec, ColumnType, CqlValue, PartitionKeyIndex, Row, TableSpec, + }; + } } }