Skip to content

Commit

Permalink
iterator: adjust to the new deserialization framework
Browse files Browse the repository at this point in the history
This commit finishes the work related to adjusting the iterators module
to the new deserialization framework.

The equivalent of the old RowIterator is now RawIterator (notice the
vowel change). Despite the name, it cannot actually be iterated on, as
it does not have any information about the column types. After calling
the `into_typed()` method it gets converted into TypedRowIterator that
can actually be iterated on.

Unfortunately, due to the limitations of the Stream trait, currently the
TypedRowIterator cannot deserialize types that need to borrow from the
serialized frame contents.

Co-authored-by: Wojciech Przytuła <[email protected]>
  • Loading branch information
piodul and wprzytula committed Oct 16, 2024
1 parent 3c546ab commit ddbf4c4
Show file tree
Hide file tree
Showing 3 changed files with 302 additions and 77 deletions.
15 changes: 6 additions & 9 deletions scylla/src/transport/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use std::{
};

use super::errors::{ProtocolError, UseKeyspaceProtocolError};
use super::iterator::LegacyRowIterator;
use super::iterator::{LegacyRowIterator, RawIterator};
use super::locator::tablets::{RawTablet, TabletParsingError};
use super::query_result::QueryResult;
use super::session::AddressTranslator;
Expand Down Expand Up @@ -1188,13 +1188,9 @@ impl Connection {
.determine_consistency(self.config.default_consistency);
let serial_consistency = query.config.serial_consistency.flatten();

LegacyRowIterator::new_for_connection_query_iter(
query,
self,
consistency,
serial_consistency,
)
.await
RawIterator::new_for_connection_query_iter(query, self, consistency, serial_consistency)
.await
.map(RawIterator::into_legacy)
}

/// Executes a prepared statements and fetches its results over multiple pages, using
Expand All @@ -1209,14 +1205,15 @@ impl Connection {
.determine_consistency(self.config.default_consistency);
let serial_consistency = prepared_statement.config.serial_consistency.flatten();

LegacyRowIterator::new_for_connection_execute_iter(
RawIterator::new_for_connection_execute_iter(
prepared_statement,
values,
self,
consistency,
serial_consistency,
)
.await
.map(RawIterator::into_legacy)
}

#[allow(dead_code)]
Expand Down
Loading

0 comments on commit ddbf4c4

Please sign in to comment.