1
1
//! Contains all healthcheck based server utilities.
2
2
3
- use crate :: proto :: health_server:: { Health , HealthServer } ;
4
- use crate :: proto :: { HealthCheckRequest , HealthCheckResponse } ;
3
+ use crate :: pb :: health_server:: { Health , HealthServer } ;
4
+ use crate :: pb :: { HealthCheckRequest , HealthCheckResponse } ;
5
5
use crate :: ServingStatus ;
6
6
use std:: collections:: HashMap ;
7
7
use std:: pin:: Pin ;
@@ -132,7 +132,7 @@ impl Health for HealthService {
132
132
match status {
133
133
None => Err ( Status :: not_found ( "service not registered" ) ) ,
134
134
Some ( status) => Ok ( Response :: new ( HealthCheckResponse {
135
- status : crate :: proto :: health_check_response:: ServingStatus :: from ( status) as i32 ,
135
+ status : crate :: pb :: health_check_response:: ServingStatus :: from ( status) as i32 ,
136
136
} ) ) ,
137
137
}
138
138
}
@@ -152,11 +152,11 @@ impl Health for HealthService {
152
152
153
153
let output = async_stream:: try_stream! {
154
154
// yield the current value
155
- let status = crate :: proto :: health_check_response:: ServingStatus :: from( * status_rx. borrow( ) ) as i32 ;
155
+ let status = crate :: pb :: health_check_response:: ServingStatus :: from( * status_rx. borrow( ) ) as i32 ;
156
156
yield HealthCheckResponse { status } ;
157
157
158
158
while let Ok ( _) = status_rx. changed( ) . await {
159
- let status = crate :: proto :: health_check_response:: ServingStatus :: from( * status_rx. borrow( ) ) as i32 ;
159
+ let status = crate :: pb :: health_check_response:: ServingStatus :: from( * status_rx. borrow( ) ) as i32 ;
160
160
yield HealthCheckResponse { status } ;
161
161
}
162
162
} ;
@@ -167,16 +167,16 @@ impl Health for HealthService {
167
167
168
168
#[ cfg( test) ]
169
169
mod tests {
170
- use crate :: proto :: health_server:: Health ;
171
- use crate :: proto :: HealthCheckRequest ;
170
+ use crate :: pb :: health_server:: Health ;
171
+ use crate :: pb :: HealthCheckRequest ;
172
172
use crate :: server:: { HealthReporter , HealthService } ;
173
173
use crate :: ServingStatus ;
174
174
use tokio:: sync:: watch;
175
175
use tokio_stream:: StreamExt ;
176
176
use tonic:: { Code , Request , Status } ;
177
177
178
178
fn assert_serving_status ( wire : i32 , expected : ServingStatus ) {
179
- let expected = crate :: proto :: health_check_response:: ServingStatus :: from ( expected) as i32 ;
179
+ let expected = crate :: pb :: health_check_response:: ServingStatus :: from ( expected) as i32 ;
180
180
assert_eq ! ( wire, expected) ;
181
181
}
182
182
0 commit comments