Skip to content

Commit

Permalink
feat: Update proto def to pass 'buf lint'
Browse files Browse the repository at this point in the history
This commit modifies the protobuf definition for Hipcheck plugins to meet the
expectations of 'buf lint', which checks protobuf definitions against a set
of best practices. The main goal here is to make the service definition more
defensive against forward-compatibility issues.

This also includes updates to the code that interacts with the generated code
to make sure it still compiles.

Signed-off-by: Andrew Lilley Brinker <[email protected]>
  • Loading branch information
alilleybrinker committed Aug 29, 2024
1 parent a65f7d9 commit 9cdc659
Show file tree
Hide file tree
Showing 21 changed files with 954 additions and 1,905 deletions.
5 changes: 5 additions & 0 deletions .buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: v2
lint:
use:
- DEFAULT
rpc_allow_same_request_response: true
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions hipcheck/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ which = { version = "6.0.3", default-features = false }
xml-rs = "0.8.20"
xz2 = "0.1.7"
zip = "2.1.6"
tokio-stream = "0.1.15"

[build-dependencies]

Expand Down
2 changes: 1 addition & 1 deletion hipcheck/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0

fn main() -> anyhow::Result<()> {
tonic_build::compile_protos("proto/hipcheck.proto")?;
tonic_build::compile_protos("../proto/hipcheck/v1/hipcheck.proto")?;
Ok(())
}
2 changes: 1 addition & 1 deletion hipcheck/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ mod util;
mod version;

pub mod hipcheck {
include!(concat!(env!("OUT_DIR"), "/hipcheck.rs"));
include!(concat!(env!("OUT_DIR"), "/hipcheck.v1.rs"));
}

use crate::analysis::report_builder::build_report;
Expand Down
4 changes: 2 additions & 2 deletions hipcheck/src/plugin/manager.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::hipcheck::plugin_client::PluginClient;
use crate::hipcheck::plugin_service_client::PluginServiceClient;
use crate::plugin::{HcPluginClient, Plugin, PluginContext};
use crate::{hc_error, Result, F64};
use futures::future::join_all;
Expand Down Expand Up @@ -106,7 +106,7 @@ impl PluginExecutor {
.mul_f64(jitter_percent);
sleep_until(Instant::now() + sleep_duration).await;
if let Ok(grpc) =
PluginClient::connect(format!("http://127.0.0.1:{port_str}")).await
PluginServiceClient::connect(format!("http://127.0.0.1:{port_str}")).await
{
opt_grpc = Some(grpc);
break;
Expand Down
Loading

0 comments on commit 9cdc659

Please sign in to comment.