feat: Rename api related to protobuf (#1224)

This commit is contained in:
tottoto
2023-01-10 11:16:57 -05:00
committed by GitHub
parent 0d35d7fbaf
commit d2542dc034
5 changed files with 25 additions and 24 deletions
+8 -8
View File
@@ -1,7 +1,7 @@
//! Contains all healthcheck based server utilities.
use crate::proto::health_server::{Health, HealthServer};
use crate::proto::{HealthCheckRequest, HealthCheckResponse};
use crate::pb::health_server::{Health, HealthServer};
use crate::pb::{HealthCheckRequest, HealthCheckResponse};
use crate::ServingStatus;
use std::collections::HashMap;
use std::pin::Pin;
@@ -132,7 +132,7 @@ impl Health for HealthService {
match status {
None => Err(Status::not_found("service not registered")),
Some(status) => Ok(Response::new(HealthCheckResponse {
status: crate::proto::health_check_response::ServingStatus::from(status) as i32,
status: crate::pb::health_check_response::ServingStatus::from(status) as i32,
})),
}
}
@@ -152,11 +152,11 @@ impl Health for HealthService {
let output = async_stream::try_stream! {
// yield the current value
let status = crate::proto::health_check_response::ServingStatus::from(*status_rx.borrow()) as i32;
let status = crate::pb::health_check_response::ServingStatus::from(*status_rx.borrow()) as i32;
yield HealthCheckResponse { status };
while let Ok(_) = status_rx.changed().await {
let status = crate::proto::health_check_response::ServingStatus::from(*status_rx.borrow()) as i32;
let status = crate::pb::health_check_response::ServingStatus::from(*status_rx.borrow()) as i32;
yield HealthCheckResponse { status };
}
};
@@ -167,8 +167,8 @@ impl Health for HealthService {
#[cfg(test)]
mod tests {
use crate::proto::health_server::Health;
use crate::proto::HealthCheckRequest;
use crate::pb::health_server::Health;
use crate::pb::HealthCheckRequest;
use crate::server::{HealthReporter, HealthService};
use crate::ServingStatus;
use tokio::sync::watch;
@@ -176,7 +176,7 @@ mod tests {
use tonic::{Code, Request, Status};
fn assert_serving_status(wire: i32, expected: ServingStatus) {
let expected = crate::proto::health_check_response::ServingStatus::from(expected) as i32;
let expected = crate::pb::health_check_response::ServingStatus::from(expected) as i32;
assert_eq!(wire, expected);
}