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

API Peer Validation for SQL Server #483

Merged
merged 3 commits into from
Oct 4, 2023
Merged

Conversation

Amogh-Bharadwaj
Copy link
Contributor

@Amogh-Bharadwaj Amogh-Bharadwaj commented Oct 4, 2023

For now, uses the ValidatePeer gRPC endpoint for SQL Server on the Rust side. Tested for all relevant peers - SQL Server, PG, SF and BQ.
Partially completes #484

}))
})?;
if let PeerValidationResult::Invalid(validation_err) = validity {
return Err(PgWireError::UserError(Box::new(ErrorInfo::new(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] reported by reviewdog 🐶

warning: unneeded `return` statement
   --> server/src/main.rs:242:17
    |
242 | /                 return Err(PgWireError::UserError(Box::new(ErrorInfo::new(
243 | |                     "ERROR".to_owned(),
244 | |                     "internal_error".to_owned(),
245 | |                     format!("[peer]: invalid configuration: {}", validation_err),
246 | |                 )))
247 | |                 .into());
    | |________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
    |
242 ~                 Err(PgWireError::UserError(Box::new(ErrorInfo::new(
243 +                     "ERROR".to_owned(),
244 +                     "internal_error".to_owned(),
245 +                     format!("[peer]: invalid configuration: {}", validation_err),
246 +                 )))
247 ~                 .into())
    |

)))
.into());
} else {
return Ok(());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] reported by reviewdog 🐶

warning: unneeded `return` statement
   --> server/src/main.rs:249:17
    |
249 |                 return Ok(());
    |                 ^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
249 -                 return Ok(());
249 +                 Ok(())
    |

@@ -205,6 +204,53 @@
}
}

async fn validate_peer<'a>(&self, peer_type: i32, peer: &Peer) -> anyhow::Result<()> {
if peer_type != 6 {
let peer_executor = self.get_peer_executor(&peer).await.map_err(|err| {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] reported by reviewdog 🐶

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> server/src/main.rs:209:56
    |
209 |             let peer_executor = self.get_peer_executor(&peer).await.map_err(|err| {
    |                                                        ^^^^^ help: change this to: `peer`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `#[warn(clippy::needless_borrow)]` on by default

@iskakaushik iskakaushik merged commit ab64814 into main Oct 4, 2023
18 of 19 checks passed
@serprex serprex deleted the refactor-peer-validate branch July 19, 2024 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants