refactor: update health report to connection test and simplify proto definitions
This commit is contained in:
@@ -62,14 +62,14 @@ async fn main() {
|
||||
// send a dummy heartbeat to verify the connection is working
|
||||
let client = master_connector.get_client();
|
||||
|
||||
let request = nxmesh_proto::HealthReport {
|
||||
let request = nxmesh_proto::TestRequest {
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
match client.lock().await.report_health(request).await {
|
||||
Ok(_) => info!("Successfully sent health report to master."),
|
||||
match client.lock().await.connection_test(request).await {
|
||||
Ok(_) => info!("Successfully sent connection test to master."),
|
||||
Err(e) => {
|
||||
error!("Failed to send health report to master: {}", e);
|
||||
error!("Failed to send connection test to master: {}", e);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
use nxmesh_proto::{
|
||||
Ack, AgentMessage, HealthReport, MasterMessage, MetricsBatch,
|
||||
agent_service_server::AgentService,
|
||||
};
|
||||
use tracing::warn;
|
||||
use nxmesh_proto::{AgentMessage, MasterMessage, agent_service_server::AgentService};
|
||||
|
||||
pub mod repo;
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct AgentServerService {}
|
||||
@@ -25,30 +23,13 @@ impl AgentService for AgentServerService {
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[doc = " ReportHealth sends a health report to the master"]
|
||||
#[allow(
|
||||
mismatched_lifetime_syntaxes,
|
||||
clippy::type_complexity,
|
||||
clippy::type_repetition_in_bounds
|
||||
)]
|
||||
async fn report_health(
|
||||
async fn connection_test(
|
||||
&self,
|
||||
request: tonic::Request<HealthReport>,
|
||||
) -> Result<tonic::Response<Ack>, tonic::Status> {
|
||||
warn!("Received health report: {:?}", request.get_ref());
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[doc = " ReportMetrics sends metrics batch to the master"]
|
||||
#[allow(
|
||||
mismatched_lifetime_syntaxes,
|
||||
clippy::type_complexity,
|
||||
clippy::type_repetition_in_bounds
|
||||
)]
|
||||
async fn report_metrics(
|
||||
&self,
|
||||
request: tonic::Request<MetricsBatch>,
|
||||
) -> Result<tonic::Response<Ack>, tonic::Status> {
|
||||
todo!()
|
||||
_request: tonic::Request<nxmesh_proto::TestRequest>,
|
||||
) -> Result<tonic::Response<nxmesh_proto::TestResponse>, tonic::Status> {
|
||||
Ok(tonic::Response::new(nxmesh_proto::TestResponse {
|
||||
success: true,
|
||||
error_message: String::new(),
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user