Skip to content

Commit 58d3d21

Browse files
committed
cargo: bump rust-driver to 0.15
1. CassResult was refactored yet again. Now, we clearly distinguish betwen Rows and non-Rows result. `CassResultKind` and `CassRowsResult` are introduced. `CassRowsResult` holds information about the (for now, eagerly deserialized) rows and metadata. The usages of `CassResult` are adjusted throughout the codebase. 2. CassErrorResult was extended by two variants: - metadata deserialization error - happens during conversion from QueryResult to QueryRowsResult - deserialization error - happens during eager rows deserialization. 3. CassResult construction logic was adjusted to new QueryResult. As mentioned above, some errors can occur during conversion, thus `CassResult::from_result_payload` returns a StdResult now. For now, we eagerly deserialize the rows. This is equivalent to the version before this PR.
1 parent d8213e0 commit 58d3d21

File tree

6 files changed

+214
-65
lines changed

6 files changed

+214
-65
lines changed

scylla-rust-wrapper/Cargo.lock

Lines changed: 71 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scylla-rust-wrapper/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ categories = ["database"]
1010
license = "MIT OR Apache-2.0"
1111

1212
[dependencies]
13-
scylla = { git = "https://github.com/scylladb/scylla-rust-driver.git", rev = "64b4afcd", features = [
13+
scylla = { git = "https://github.com/scylladb/scylla-rust-driver.git", rev = "v0.15.0", features = [
1414
"ssl",
1515
] }
1616
tokio = { version = "1.27.0", features = ["full"] }
@@ -33,7 +33,7 @@ bindgen = "0.65"
3333
chrono = "0.4.20"
3434

3535
[dev-dependencies]
36-
scylla-proxy = { git = "https://github.com/scylladb/scylla-rust-driver.git", rev = "64b4afcd" }
36+
scylla-proxy = { git = "https://github.com/scylladb/scylla-rust-driver.git", rev = "v0.15.0" }
3737

3838
assert_matches = "1.5.0"
3939
ntest = "0.9.3"

scylla-rust-wrapper/src/cass_error.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ impl ToCassError for CassErrorResult {
1212
fn to_cass_error(&self) -> CassError {
1313
match self {
1414
CassErrorResult::Query(query_error) => query_error.to_cass_error(),
15+
16+
// For now let's leave these as LIB_INVALID_DATA.
17+
// I don't see any variants that would make more sense.
18+
// TBH, I'm almost sure that we should introduce additional enum variants
19+
// of CassError in the future ~ muzarski.
20+
CassErrorResult::ResultMetadataLazyDeserialization(_) => {
21+
CassError::CASS_ERROR_LIB_INVALID_DATA
22+
}
23+
CassErrorResult::Deserialization(_) => CassError::CASS_ERROR_LIB_INVALID_DATA,
1524
}
1625
}
1726
}

scylla-rust-wrapper/src/query_error.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ use crate::cass_error::*;
33
use crate::cass_error_types::CassWriteType;
44
use crate::cass_types::CassConsistency;
55
use crate::types::*;
6+
use scylla::deserialize::DeserializationError;
7+
use scylla::frame::frame_errors::ResultMetadataAndRowsCountParseError;
68
use scylla::statement::Consistency;
79
use scylla::transport::errors::*;
810
use thiserror::Error;
@@ -11,6 +13,10 @@ use thiserror::Error;
1113
pub enum CassErrorResult {
1214
#[error(transparent)]
1315
Query(#[from] QueryError),
16+
#[error(transparent)]
17+
ResultMetadataLazyDeserialization(#[from] ResultMetadataAndRowsCountParseError),
18+
#[error("Failed to deserialize rows: {0}")]
19+
Deserialization(#[from] DeserializationError),
1420
}
1521

1622
impl From<Consistency> for CassConsistency {

0 commit comments

Comments
 (0)