-
Notifications
You must be signed in to change notification settings - Fork 110
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 API #1057
Conversation
6038ee0
to
671bf1e
Compare
v1.0.1: clippy fixes |
See the following report for details: cargo semver-checks output
|
671bf1e
to
774e839
Compare
v1.0.2: docstrings fixes |
774e839
to
e5982ba
Compare
v1.0.3: tests fixes. |
e5982ba
to
088a9ab
Compare
v1.0.4: docstring fixes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Posting the comments that I already made so that they are not lost
088a9ab
to
a0e7f2f
Compare
v2.0:
|
a0e7f2f
to
aef9803
Compare
v2.1:
|
aef9803
to
93f3174
Compare
v2.1.1:
|
93f3174
to
f104336
Compare
f104336
to
611e48c
Compare
Implements methods related to sending queries for the new Session. Co-authored-by: Wojciech Przytuła <[email protected]>
Adjusts `Connection::fetch_schema_version` to use the new deserialization API. Connection is meant to be an internal API, so we don't introduce a LegacyConnection for this. `Connection::{query,execute}_iter` will be migrated in a further commit. Co-authored-by: Wojciech Przytuła <[email protected]>
In a similar fashion to Session, CachingSession was also made generic over the session kind. Co-authored-by: Wojciech Przytuła <[email protected]>
After Session was made generic wrt deserialization API, the references got broken.
Adjusts the CachingSession tests to use the new deserialization interface. Co-authored-by: Wojciech Przytuła <[email protected]>
The Connection::query_iter method is changed to use the new deserialization framework. All the internal uses of it in topology.rs are adjusted. Co-authored-by: Piotr Dulikowski <[email protected]>
`query_filter_keyspace_name` is monomorphised into 5 different functions, with considerably large body each. To reduce code bloat (and potentially have better caching by calling the same code, not distinct), the large common part is degenericised and extracted.
Adjusts the Session::try_getting_tracing_info method to use the new deserialization framework. Co-authored-by: Wojciech Przytuła <[email protected]>
8384730
to
11c8406
Compare
v3.1.1: amended commit message about de-genericisation - now it mentions partial de-genericisation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
This is a large commit which goes over all existing tests that haven't been migrated in previous commits and adjusts them to use the new deserialization framework. There were lots of changes to be made, but they are mostly independent from each other and very simple.
This commit goes over all unadjusted examples and changes them to use the new deserialization framework. Again, it contains a lot of changes, but they are quite simple. Co-authored-by: Wojciech Przytuła <[email protected]>
ScyllaDB does not distinguish empty collections from nulls. That is, INSERTing an empty collection is equivalent to nullifying the corresponding column. As pointed out in [scylladb#1001](scylladb#1001), it's a nice QOL feature to be able to deserialize empty CQL collections to empty Rust collections instead of `None::<RustCollection>`. A test is added that checks it.
As noted in a review comment, parsing `for<'r> DeserializeValue<'r, 'r>` to understand it's requiring an owned type is nontrivial and could be replaced with a subtrait with an informative name. Therefore, this commit introduces DeserializeOwnedRow and DeserializeOwnedValue (to be used by the `scylla` crate itself only).
Not to use legacy naming, (SingleConnection)RowIteratorWorker is renamed to (SingleConnection)PagerWorker.
4971667
to
d342dfe
Compare
v3.2: Added 2 new commits on top of the PR:
|
It appears that the previous requirements: ```rust fn rows_stream< 'frame, 'metadata, RowT: 'static + DeserializeRow<'frame, 'metadata> > ``` allowed creating the `TypedRowStream<&'static str>`. It was error-prone, because the compiler would accept `rows_stream::<&str>`, happily deducing that it's `&'static str`, and failing upon Stream `next()` not being a lending method. To prevent such situations, the constraints are changed the following way (credits to @Lorak-mmk): ```rust fn rows_stream< RowT: 'static + for<'frame, 'metadata> DeserializeRow<'frame, 'metadata> > ``` and now `&'static str` is not permitted (because it only implements `DeserializeValue<'static, '_>`. Co-authored-by: Karol Baryła <[email protected]>
d342dfe
to
d4a222c
Compare
Here it is, finally!
After #1004 with preparation, #970 with lower layer and #1024 with derive macros,
then #1065 and #1088 with yet more preparations, #1082, then #1101...
this PR does introduce the uppermost layer of the new deserialization framework - finally brings it available for the user!
The Big Picture
Session
is made generic over the deserialization API kind, so that both old and new API can be used in the transition period by the users. The choice is done onSessionBuilder
's level, by choosing eitherbuild()
orbuild_legacy()
method.Connection
's API, especiallyquery_iter()
widely used intopology.rs
) are adjusted to use the new API.Collection
instead ofOption<Collection>
, even though the DB represents empty collections as nulls.Collection
instead ofOption<Collection>
.Details
Achieving old behaviour for dynamic deserialization purposes
If one still wants to deserialize arbitrary rows (as the old framework would do) and only then try to convert them dynamically to some proper types, this is doable by using the old
Row
struct as the target type, e.g.TODO
Session
s of both APIs, so that both façades are cheaply convertible into each other (by sharing their inner data with an Arc). This will enable using both APIs in one application with minimal changes needed.Fixes: #964
Fixes: #1001
Nearly_resolves: #462
Pre-review checklist
./docs/source/
.Fixes:
annotations to PR description.