Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ build-examples:

_update-rust-tooling:
@echo "Run rustup update"
@rustup update
@rustup update stable

check-cargo: install-cargo-if-missing _update-rust-tooling
@echo "Running \"cargo check\" in ./scylla-rust-wrapper"
Expand Down
33 changes: 17 additions & 16 deletions scylla-rust-wrapper/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ pub mod future {
pub mod statement {
// Disabling rustfmt to have one item per line for better readability.
#[rustfmt::skip]
pub use crate::statement::{
pub use crate::statements::statement::{
CassStatement,
cass_statement_bind_bool,
cass_statement_bind_bool_by_name,
Expand Down Expand Up @@ -483,7 +483,7 @@ pub mod statement {
pub mod prepared {
// Disabling rustfmt to have one item per line for better readability.
#[rustfmt::skip]
pub use crate::prepared::{
pub use crate::statements::prepared::{
CassPrepared,
cass_prepared_bind,
cass_prepared_free,
Expand All @@ -497,7 +497,7 @@ pub mod prepared {
pub mod batch {
// Disabling rustfmt to have one item per line for better readability.
#[rustfmt::skip]
pub use crate::batch::{
pub use crate::statements::batch::{
CassBatch,
CassBatchType,
cass_batch_add_statement,
Expand Down Expand Up @@ -526,7 +526,7 @@ pub mod batch {
pub mod data_type {
// Disabling rustfmt to have one item per line for better readability.
#[rustfmt::skip]
pub use crate::cass_types::{
pub use crate::cql_types::data_type::{
CassDataType,
cass_data_sub_type_count,
cass_data_type_add_sub_type,
Expand Down Expand Up @@ -562,7 +562,7 @@ pub mod data_type {
pub mod collection {
// Disabling rustfmt to have one item per line for better readability.
#[rustfmt::skip]
pub use crate::collection::{
pub use crate::cql_types::collection::{
CassCollection,
cass_collection_append_bool,
cass_collection_append_bytes,
Expand Down Expand Up @@ -594,7 +594,7 @@ pub mod collection {
pub mod tuple {
// Disabling rustfmt to have one item per line for better readability.
#[rustfmt::skip]
pub use crate::tuple::{
pub use crate::cql_types::tuple::{
CassTuple,
cass_tuple_data_type,
cass_tuple_free,
Expand Down Expand Up @@ -627,7 +627,7 @@ pub mod tuple {
pub mod user_type {
// Disabling rustfmt to have one item per line for better readability.
#[rustfmt::skip]
pub use crate::user_type::{
pub use crate::cql_types::user_type::{
CassUserType,
cass_user_type_data_type,
cass_user_type_free,
Expand Down Expand Up @@ -832,7 +832,7 @@ pub mod value {
pub mod uuid_gen {
// Disabling rustfmt to have one item per line for better readability.
#[rustfmt::skip]
pub use crate::uuid::{
pub use crate::cql_types::uuid::{
CassUuidGen,
cass_uuid_gen_free,
cass_uuid_gen_from_time,
Expand All @@ -846,7 +846,8 @@ pub mod uuid_gen {
pub mod uuid {
// Disabling rustfmt to have one item per line for better readability.
#[rustfmt::skip]
pub use crate::uuid::{
pub use crate::cql_types::uuid::{
CassUuid,
cass_uuid_from_string,
cass_uuid_from_string_n,
cass_uuid_max_from_time,
Expand Down Expand Up @@ -895,16 +896,16 @@ pub mod custom_payload {
pub mod consistency {
// Disabling rustfmt to have one item per line for better readability.
#[rustfmt::skip]
pub use crate::misc::{
pub use crate::cql_types::{
CassConsistency,
cass_consistency_string
cass_consistency_string,
};
}

pub mod write_type {
// Disabling rustfmt to have one item per line for better readability.
#[rustfmt::skip]
pub use crate::misc::{
pub use crate::cql_types::{
CassWriteType,
cass_write_type_string
};
Expand All @@ -927,7 +928,7 @@ pub mod log {
pub mod inet {
// Disabling rustfmt to have one item per line for better readability.
#[rustfmt::skip]
pub use crate::inet::{
pub use crate::cql_types::inet::{
CassInet,
cass_inet_from_string,
cass_inet_from_string_n,
Expand All @@ -940,7 +941,7 @@ pub mod inet {
pub mod date_time {
// Disabling rustfmt to have one item per line for better readability.
#[rustfmt::skip]
pub use crate::date_time::{
pub use crate::cql_types::date_time::{
cass_date_from_epoch,
cass_date_time_to_epoch,
cass_time_from_epoch
Expand All @@ -955,7 +956,7 @@ pub mod alloc {
pub mod integration_testing {
// Disabling rustfmt to have one item per line for better readability.
#[rustfmt::skip]
pub use crate::integration_testing::{
pub use crate::testing::integration::{
IgnoringRetryPolicy,
testing_batch_set_sleeping_history_listener,
testing_cluster_get_connect_timeout,
Expand All @@ -974,7 +975,7 @@ pub mod integration_testing {
/// and at the same time the functions are not yet implemented in the wrapper.
// Disabling rustfmt to have one item per line for better readability.
#[rustfmt::skip]
pub use crate::integration_testing::stubs::{
pub use crate::testing::integration::stubs::{
CassAggregateMeta,
CassAuthenticator,
CassCustomPayload,
Expand Down
4 changes: 2 additions & 2 deletions scylla-rust-wrapper/src/argconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ mod sealed {
/// There is no way to obtain a mutable reference from such pointer.
///
/// In some cases, we need to be able to mutate the data behind a shared pointer.
/// There is an example of such use case - namely [`crate::cass_types::CassDataType`].
/// There is an example of such use case - namely [`crate::cql_types::data_type::CassDataType`].
/// argconv API does not provide a way to mutate such pointer - one can only convert the pointer
/// to [`Arc`] or &. It is the API user's responsibility to implement sound interior mutability
/// pattern in such case. This is what we currently do - CassDataType wraps CassDataTypeInner
Expand Down Expand Up @@ -626,7 +626,7 @@ impl<T> BoxFFI for T where T: FFI<Origin = FromBox> {}
/// C API user should be responsible for freeing (decreasing reference count of)
/// associated memory manually via corresponding API call.
///
/// An example of such implementor would be [`CassDataType`](crate::cass_types::CassDataType):
/// An example of such implementor would be [`CassDataType`](crate::cql_types::data_type::CassDataType):
/// - it is allocated on the heap via [`Arc::new`]
/// - there are multiple owners of the shared CassDataType object
/// - some API functions require to increase a reference count of the object
Expand Down
28 changes: 14 additions & 14 deletions scylla-rust-wrapper/src/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ macro_rules! make_index_binder {
) -> CassError {
// For some reason detected as unused, which is not true
#[allow(unused_imports)]
use crate::value::CassCqlValue::*;
use crate::cql_types::value::CassCqlValue::*;
let Some(this) = BoxFFI::as_mut_ref(this) else {
tracing::error!("Provided null pointer to {}!", stringify!($fn_by_idx));
return CassError::CASS_ERROR_LIB_BAD_PARAMS;
Expand All @@ -83,7 +83,7 @@ macro_rules! make_name_binder {
) -> CassError {
// For some reason detected as unused, which is not true
#[allow(unused_imports)]
use crate::value::CassCqlValue::*;
use crate::cql_types::value::CassCqlValue::*;
let Some(this) = BoxFFI::as_mut_ref(this) else {
tracing::error!("Provided null pointer to {}!", stringify!($fn_by_name));
return CassError::CASS_ERROR_LIB_BAD_PARAMS;
Expand All @@ -109,7 +109,7 @@ macro_rules! make_name_n_binder {
) -> CassError {
// For some reason detected as unused, which is not true
#[allow(unused_imports)]
use crate::value::CassCqlValue::*;
use crate::cql_types::value::CassCqlValue::*;
let Some(this) = BoxFFI::as_mut_ref(this) else {
tracing::error!("Provided null pointer to {}!", stringify!($fn_by_name_n));
return CassError::CASS_ERROR_LIB_BAD_PARAMS;
Expand All @@ -133,7 +133,7 @@ macro_rules! make_appender {
) -> CassError {
// For some reason detected as unused, which is not true
#[allow(unused_imports)]
use crate::value::CassCqlValue::*;
use crate::cql_types::value::CassCqlValue::*;
let Some(this) = BoxFFI::as_mut_ref(this) else {
tracing::error!("Provided null pointer to {}!", stringify!($fn_append));
return CassError::CASS_ERROR_LIB_BAD_PARAMS;
Expand Down Expand Up @@ -263,16 +263,16 @@ macro_rules! invoke_binder_maker_macro_with_type {
$this,
$consume_v,
$fn,
|v: crate::uuid::CassUuid| Ok(Some(Uuid(v.into()))),
[v @ crate::uuid::CassUuid]
|v: crate::cql_types::uuid::CassUuid| Ok(Some(Uuid(v.into()))),
[v @ crate::cql_types::uuid::CassUuid]
);
};
(inet, $macro_name:ident, $this:ty, $consume_v:expr, $fn:ident) => {
$macro_name!(
$this,
$consume_v,
$fn,
|v: crate::inet::CassInet| {
|v: crate::cql_types::inet::CassInet| {
// Err if length in struct is invalid.
// cppdriver doesn't check this - it encodes any length given to it
// but it doesn't seem like something we wanna do. Also, rust driver can't
Expand All @@ -282,7 +282,7 @@ macro_rules! invoke_binder_maker_macro_with_type {
Err(_) => Err(CassError::CASS_ERROR_LIB_INVALID_VALUE_TYPE),
}
},
[v @ crate::inet::CassInet]
[v @ crate::cql_types::inet::CassInet]
);
};
(duration, $macro_name:ident, $this:ty, $consume_v:expr, $fn:ident) => {
Expand Down Expand Up @@ -318,32 +318,32 @@ macro_rules! invoke_binder_maker_macro_with_type {
$this,
$consume_v,
$fn,
|p: CassBorrowedSharedPtr<crate::collection::CassCollection, CConst>| {
|p: CassBorrowedSharedPtr<crate::cql_types::collection::CassCollection, CConst>| {
Ok(Some(std::convert::Into::into(BoxFFI::as_ref(p).unwrap())))
},
[p @ CassBorrowedSharedPtr<crate::collection::CassCollection, CConst>]
[p @ CassBorrowedSharedPtr<crate::cql_types::collection::CassCollection, CConst>]
);
};
(tuple, $macro_name:ident, $this:ty, $consume_v:expr, $fn:ident) => {
$macro_name!(
$this,
$consume_v,
$fn,
|p: CassBorrowedSharedPtr<crate::tuple::CassTuple, CConst>| {
|p: CassBorrowedSharedPtr<crate::cql_types::tuple::CassTuple, CConst>| {
Ok(Some(BoxFFI::as_ref(p).unwrap().into()))
},
[p @ CassBorrowedSharedPtr<crate::tuple::CassTuple, CConst>]
[p @ CassBorrowedSharedPtr<crate::cql_types::tuple::CassTuple, CConst>]
);
};
(user_type, $macro_name:ident, $this:ty, $consume_v:expr, $fn:ident) => {
$macro_name!(
$this,
$consume_v,
$fn,
|p: CassBorrowedSharedPtr<crate::user_type::CassUserType, CConst>| {
|p: CassBorrowedSharedPtr<crate::cql_types::user_type::CassUserType, CConst>| {
Ok(Some(BoxFFI::as_ref(p).unwrap().into()))
},
[p @ CassBorrowedSharedPtr<crate::user_type::CassUserType, CConst>]
[p @ CassBorrowedSharedPtr<crate::cql_types::user_type::CassUserType, CConst>]
);
};
}
Expand Down
5 changes: 2 additions & 3 deletions scylla-rust-wrapper/src/cass_error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::argconv::*;
use crate::cass_types::CassConsistency;
use crate::misc::CassWriteType;
use crate::cql_types::{CassConsistency, CassWriteType};
use crate::types::*;
use libc::c_char;
use scylla::deserialize::DeserializationError;
Expand All @@ -15,7 +14,7 @@ use thiserror::Error;

// Re-export error types.
pub use crate::cass_error_types::{CassError, CassErrorSource};
use crate::statement::UnknownNamedParameterError;
use crate::statements::statement::UnknownNamedParameterError;

pub(crate) trait ToCassError {
fn to_cass_error(&self) -> CassError;
Expand Down
6 changes: 3 additions & 3 deletions scylla-rust-wrapper/src/cluster.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::argconv::*;
use crate::cass_error::CassError;
use crate::cass_types::CassConsistency;
use crate::config_value::MaybeUnsetConfig;
use crate::cql_types::CassConsistency;
use crate::cql_types::uuid::CassUuid;
use crate::exec_profile::{CassExecProfile, ExecProfileName, exec_profile_builder_modify};
use crate::load_balancing::{
CassHostFilter, DcRestriction, LoadBalancingConfig, LoadBalancingKind,
Expand All @@ -11,7 +12,6 @@ use crate::runtime::{RUNTIMES, Runtime};
use crate::ssl::CassSsl;
use crate::timestamp_generator::CassTimestampGen;
use crate::types::*;
use crate::uuid::CassUuid;
use openssl::ssl::SslContextBuilder;
use openssl_sys::SSL_CTX_up_ref;
use scylla::client::execution_profile::ExecutionProfileBuilder;
Expand Down Expand Up @@ -1617,7 +1617,7 @@ pub unsafe extern "C" fn cass_cluster_set_metadata_request_serverside_timeout(

#[cfg(test)]
mod tests {
use crate::testing::{assert_cass_error_eq, setup_tracing};
use crate::testing::utils::{assert_cass_error_eq, setup_tracing};

use super::*;
use crate::{
Expand Down
2 changes: 1 addition & 1 deletion scylla-rust-wrapper/src/config_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use scylla::{
statement::{Consistency, SerialConsistency},
};

use crate::{cass_types::CassConsistency, retry_policy::CassRetryPolicy, types::cass_uint64_t};
use crate::{cql_types::CassConsistency, retry_policy::CassRetryPolicy, types::cass_uint64_t};

/// Represents a configuration value that may or may not be set.
/// If a configuration value is unset, it means that the default value
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::argconv::*;
use crate::cass_collection_types::CassCollectionType;
use crate::cass_error::CassError;
use crate::cass_types::{CassDataType, CassDataTypeInner, MapDataType};
use crate::cql_types::data_type::{CassDataType, CassDataTypeInner, MapDataType};
use crate::cql_types::value::{self, CassCqlValue};
use crate::types::*;
use crate::value::CassCqlValue;
use crate::{argconv::*, value};
use std::convert::TryFrom;
use std::sync::Arc;
use std::sync::LazyLock;
Expand Down Expand Up @@ -281,14 +281,17 @@ mod tests {
use crate::{
argconv::ArcFFI,
cass_error::CassError,
cass_types::{
CassDataType, CassDataTypeInner, CassValueType, MapDataType,
cass_data_type_add_sub_type, cass_data_type_free, cass_data_type_new,
},
collection::{
cass_collection_append_double, cass_collection_append_float, cass_collection_free,
cql_types::{
CassValueType,
collection::{
cass_collection_append_double, cass_collection_append_float, cass_collection_free,
},
data_type::{
CassDataType, CassDataTypeInner, MapDataType, cass_data_type_add_sub_type,
cass_data_type_free, cass_data_type_new,
},
},
testing::assert_cass_error_eq,
testing::utils::assert_cass_error_eq,
};

use super::{
Expand Down
Loading