-
Notifications
You must be signed in to change notification settings - Fork 97
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
Conversation
a8f1f1f
to
a2bd85d
Compare
nexus/server/src/main.rs
Outdated
})) | ||
})?; | ||
if let PeerValidationResult::Invalid(validation_err) = validity { | ||
return Err(PgWireError::UserError(Box::new(ErrorInfo::new( |
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.
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())
|
nexus/server/src/main.rs
Outdated
))) | ||
.into()); | ||
} else { | ||
return Ok(()); |
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.
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(())
|
nexus/server/src/main.rs
Outdated
@@ -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| { |
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.
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
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