-
Notifications
You must be signed in to change notification settings - Fork 115
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
scylla_cql cleanup after legacy APIs removal #1198
base: main
Are you sure you want to change the base?
Conversation
See the following report for details: cargo semver-checks output
|
6b48f80
to
030bf81
Compare
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.
An idea: maybe extend test_types_imports
test? Currently we only test for _scylla::value::CqlValue
, but now that we explicitly re-export types from this module it makes sense to test imports for them as well.
Makes sense, I'll do it soon |
Added the rest of the types to the test |
We want to move tests from this file into serialization module. In order for the move commit to be simpler, the tests should be made more similar before.
We want to move tests from this file into serialization module. In order for the move commit to be simpler, the tests should be made more similar before.
There is another equivalent function already: `col`.
That's how this helper function is named in serialize/row_tests.rs.
This allows us to finally get rid of frame/value_tests.rs!
…ests Those tests only test CqlValue deserialization, and we want to have serialization / deserialization tests grouped together.
Previously those types were located in scylla_cql::frame::response::result. This is because in old framework they were strongly coupled to the result frame: values were always deserialized into `Vec` of `Row`s, which in turn were `Vec`s of `CqlValue`. In the new framework this coupling is gone. New traits allow deserialization from raw bytes instead of `CqlValue`, which means that those types are no more important than any other, and can be moved to the module with other values. scylla_cql::values may be a bit of a weird place for a `Row` struct, but I don't see any better place.
Other scylla_cql re-exports don't usually re-export whole modules, only what is necessary for scylla crate public API. This commit does the same for `scylla_cql::value` re-export. All public items apart from deser_cql_value are re-exported.
Now that values (CqlValue etc) are manually re-exported in lib.rs we should test the correctness of this re-export.
bf64c39
to
3db46f6
Compare
Rebased on main |
After removing the legacy serialization / deserialization APIs it became clear that some things in scylla_cql are not placed where they should be.
This PR tries to address it.
PR based on #1184 . You can start the review with commit "scylla_cql/serialize: Extract value tests to a separate file".
Ser / deser tests
They are placed in several places, making it hard to follow what tests we actually have.
We should strive to put them together.
Where are the tests and how does this PR change it?
deserialize
module in files separate from implementation (row_tests.rs
,value_tests.rs
). This is good and so left unchanged.serialize
module inside the files with implementation. I extracted those tests to separate files (row_tests.rs
,value_tests.rs
) to reduce file size and be more similar todeserialize
module.frame/value_tests.rs
file. Those were some of the serialization tests for both values, rows, and batches. I moved them to relevant files inserialize
module.frame/result/response.rs
file. Those were some of the deserialization tests forCqlValue
. I moved them todeserialize/value_tests.rs
file.value
moduleThis module in
scylla_cql
is placed inframe
module and contained multiple things:Value
andValueList
traits and their implementations)CqlValue
,CqlTimeuuid
etcAfter removing (1), and removing
cql_to_rust
module which was also inframe
, I find it a bit weirdfor this module to be placed in
frame
. Why? Previously types likeCqlValue
andCqlTimeuuid
were strongly tied to frame serialization / deserialization, because they were used in CqlValue,
which was always used when deserializing result values.
With the new API this is no longer the case, so there is no more reason to keep those types in
frame
module.I moved this file into the root folder, so
value
is now a top-level module.CqlValue and Row
Those were placed in
scylla-cql/frame/response/result.rs
. As described in the previous point, this location madesense with the old deserialization API because
CqlValue
andRow
were strongly tied to frame deserialization.With the new API they are not anymore - they are normal types than can be serialized / deserialized, and are kept
mostly to address dynamic use cases. With this change,
result.rs
no longer seems like a good place for them.I moved them to the newly created
value.rs
top-level module, so it is placed close toCqlTimeuuid
and other such types.This may be a bit of a weird place for a
Row
struct, but I don't have any better ideas.Fixes #1167
Pre-review checklist
I added relevant tests for new features and bug fixes.I have provided docstrings for the public items that I want to introduce../docs/source/
.Fixes:
annotations to PR description.