Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce new deserialization framework upper layer abstractions #1093

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6a1450b
deser/result: rename RowIterator to RawRowIterator
wprzytula Nov 5, 2024
2908f4e
lib.rs: unpub RawRowIterator
wprzytula Nov 5, 2024
d95e3d7
result: make ColumnSpec::borrowed `const`
wprzytula Oct 30, 2024
3d7a20f
result: fix docstrings
wprzytula Nov 4, 2024
8ff86f7
result: reposition and comment some code
wprzytula Oct 11, 2024
9ddefa9
result: fix lifetimes in ColumnSpec
wprzytula Oct 22, 2024
d0c66a3
result: introduce RawRows & friends
piodul Mar 15, 2023
100e1e9
result: introduce RawRowLendingIterator
wprzytula Aug 14, 2024
d9d71bd
treewide: rename QueryResult -> LegacyQueryResult
piodul Mar 14, 2023
661af48
legacy_query_result: move legacy helpers from session.rs
wprzytula Nov 5, 2024
2430fdb
result: store ResultMetadataHolder in Rows
wprzytula Nov 4, 2024
059294a
transport: introduce new QueryResult
piodul Mar 13, 2023
0afcd96
result: metadata serialization utils for tests
wprzytula Oct 16, 2024
1949a6f
transport: add tests for new QueryResult
wprzytula Oct 16, 2024
358f430
session,iterator: no longer record rows size & count
wprzytula Oct 11, 2024
a7e6193
treewide: propagate RawRows/new QueryResult
piodul Mar 13, 2023
a7a50b5
iterator: rename (Typed)RowIterator to Legacy(Typed)RowIterator
piodul Mar 13, 2023
83df64e
iterator: introduce poll_next_internal
piodul Feb 28, 2023
f9ab0bc
iterator: introduce ready_some_ok! macro
piodul Mar 13, 2023
c47e6e2
iterator: introduce poll_next_page
piodul Mar 13, 2023
814fbe6
iterator: reorder code for better grouping
wprzytula Aug 13, 2024
3340b9d
iterator: adjust to the new deserialization framework
piodul Mar 14, 2023
ec5af4a
iterator: create module for legacy abstractions
wprzytula Nov 6, 2024
0fe6890
iterator: typed API for new deserialization framework
wprzytula Oct 22, 2024
fe4322d
result: delete legacy Rows type
wprzytula Oct 11, 2024
b0fabe5
session,iterator: record raw metadata&rows size
wprzytula Oct 28, 2024
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
65 changes: 65 additions & 0 deletions Cargo.lock.msrv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/cqlsh-rs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rustyline::error::ReadlineError;
use rustyline::{CompletionType, Config, Context, Editor};
use rustyline_derive::{Helper, Highlighter, Hinter, Validator};
use scylla::transport::Compression;
use scylla::{QueryResult, Session, SessionBuilder};
use scylla::{LegacyQueryResult, Session, SessionBuilder};
use std::env;

#[derive(Helper, Highlighter, Validator, Hinter)]
Expand Down Expand Up @@ -173,7 +173,7 @@ impl Completer for CqlHelper {
}
}

fn print_result(result: &QueryResult) {
fn print_result(result: &LegacyQueryResult) {
if result.rows.is_none() {
println!("OK");
return;
Expand Down
2 changes: 1 addition & 1 deletion examples/tower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct SessionService {

// A trivial service implementation for sending parameterless simple string requests to Scylla.
impl Service<scylla::query::Query> for SessionService {
type Response = scylla::QueryResult;
type Response = scylla::LegacyQueryResult;
type Error = scylla::transport::errors::QueryError;
type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>>>>;

Expand Down
12 changes: 6 additions & 6 deletions examples/tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use scylla::statement::{
prepared_statement::PreparedStatement, query::Query, Consistency, SerialConsistency,
};
use scylla::tracing::TracingInfo;
use scylla::transport::iterator::RowIterator;
use scylla::QueryResult;
use scylla::transport::iterator::LegacyRowIterator;
use scylla::LegacyQueryResult;
use scylla::{Session, SessionBuilder};
use std::env;
use std::num::NonZeroU32;
Expand Down Expand Up @@ -42,7 +42,7 @@ async fn main() -> Result<()> {
query.set_serial_consistency(Some(SerialConsistency::LocalSerial));

// QueryResult will contain a tracing_id which can be used to query tracing information
let query_result: QueryResult = session.query_unpaged(query.clone(), &[]).await?;
let query_result: LegacyQueryResult = session.query_unpaged(query.clone(), &[]).await?;
let query_tracing_id: Uuid = query_result
.tracing_id
.ok_or_else(|| anyhow!("Tracing id is None!"))?;
Expand Down Expand Up @@ -79,14 +79,14 @@ async fn main() -> Result<()> {
// To trace execution of a prepared statement tracing must be enabled for it
prepared.set_tracing(true);

let execute_result: QueryResult = session.execute_unpaged(&prepared, &[]).await?;
let execute_result: LegacyQueryResult = session.execute_unpaged(&prepared, &[]).await?;
println!("Execute tracing id: {:?}", execute_result.tracing_id);

// PAGED QUERY_ITER EXECUTE_ITER
// It's also possible to trace paged queries like query_iter or execute_iter
// After iterating through all rows iterator.get_tracing_ids() will give tracing ids
// for all page queries
let mut row_iterator: RowIterator = session.query_iter(query, &[]).await?;
let mut row_iterator: LegacyRowIterator = session.query_iter(query, &[]).await?;

while let Some(_row) = row_iterator.next().await {
// Receive rows
Expand All @@ -105,7 +105,7 @@ async fn main() -> Result<()> {
batch.set_tracing(true);

// Run the batch and print its tracing_id
let batch_result: QueryResult = session.batch(&batch, ((),)).await?;
let batch_result: LegacyQueryResult = session.batch(&batch, ((),)).await?;
println!("Batch tracing id: {:?}\n", batch_result.tracing_id);

// CUSTOM
Expand Down
3 changes: 3 additions & 0 deletions scylla-cql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ lz4_flex = { version = "0.11.1" }
async-trait = "0.1.57"
serde = { version = "1.0", features = ["derive"], optional = true }
time-03 = { package = "time", version = "0.3", optional = true }
yoke = { version = "0.7", features = ["derive"] }
stable_deref_trait = "1.2"

[dev-dependencies]
assert_matches = "1.5.0"
criterion = "0.4" # Note: v0.5 needs at least rust 1.70.0
lazy_static = "1" # We can migrate to std::sync::LazyLock once MSRV is bumped to 1.80.
# Use large-dates feature to test potential edge cases
time-03 = { package = "time", version = "0.3.21", features = ["large-dates"] }
uuid = { version = "1.0", features = ["v4"] }
Expand Down
Loading
Loading