-
Notifications
You must be signed in to change notification settings - Fork 112
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
errors: metadata errors refactor #1170
base: main
Are you sure you want to change the base?
Conversation
3e1aa4e
to
6283bee
Compare
See the following report for details: cargo semver-checks output
|
This also allows us to remove the FIXME regarding DbError returned from cassandra clusters during metadata fetch.
I introduced a utility trait which converts multiple lower-level errors to a specific error type that provides more context. The function is now generic over the trait implementations. After this commit, there is an outdated comment next to nested `make_keyspace_filtered_query_pager` function. It will be addressed in the following commit.
The inner function was made generic after changes from previous commit. There is no point in having a separate function. Converted it to an async block.
This functions cannot fail.
6283bee
to
54f07fb
Compare
54f07fb
to
898b1f8
Compare
scylla/src/cluster/metadata.rs
Outdated
// This function is extracted to reduce monomorphisation penalty: | ||
// query_filter_keyspace_name() is going to be monomorphised into 5 distinct functions, | ||
// so it's better to extract the common part. | ||
async fn make_keyspace_filtered_query_pager( | ||
async fn make_keyspace_filtered_query_pager<E>( |
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.
🔧 (EDIT: I see it's mentioned in the commit message) As you make make_keyspace_filtered_query_pager
a generic method, the comment is no longer valid.
❓ Is it feasible to keep the common part nongeneric and only add generics as a wrapper over it?
scylla/src/cluster/metadata.rs
Outdated
|
||
let fut = async move { | ||
let pager = | ||
make_keyspace_filtered_query_pager::<E>(conn, query_str, keyspaces_to_fetch).await?; | ||
let pager: QueryPager = pager_fut.await?; |
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.
⛏️ I feel that inlining the pager_fut
here (making the code flow linear) could be more readable here.
Ref: #519
Motivation
The goal of this PR is to purge
metadata.rs
ofQueryError
, and replace it withMetadataError
. Thanks to that metadata related functions are now independent ofQueryError
.I tried to split this PR into commits, so each commit handles one function/method from metadata module. New error variants are introduced where necessary.
When it comes to public API - after this PR
Session::refresh_metadata()
will now returnMetadataError
.Pre-review checklist
[ ] I added relevant tests for new features and bug fixes.[ ] I have adjusted the documentation in./docs/source/
.Fixes:
annotations to PR description.