Skip to content

Commit

Permalink
Move AC to inner functions
Browse files Browse the repository at this point in the history
  • Loading branch information
allada committed Dec 30, 2020
1 parent 3e8c210 commit 5452f4b
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions cas/grpc_service/ac_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@ impl AcServer {
pub fn into_service(self) -> Server<AcServer> {
Server::new(self)
}
}

#[tonic::async_trait]
impl ActionCache for AcServer {
async fn get_action_result(
async fn inner_get_action_result(
&self,
grpc_request: Request<GetActionResultRequest>,
) -> Result<Response<ActionResult>, Status> {
Expand Down Expand Up @@ -71,7 +68,7 @@ impl ActionCache for AcServer {
Ok(Response::new(action_result))
}

async fn update_action_result(
async fn inner_update_action_result(
&self,
grpc_request: Request<UpdateActionResultRequest>,
) -> Result<Response<ActionResult>, Status> {
Expand Down Expand Up @@ -116,3 +113,26 @@ impl ActionCache for AcServer {
Ok(Response::new(action_result))
}
}

#[tonic::async_trait]
impl ActionCache for AcServer {
async fn get_action_result(
&self,
grpc_request: Request<GetActionResultRequest>,
) -> Result<Response<ActionResult>, Status> {
println!("get_action_result Req: {:?}", grpc_request);
let resp = self.inner_get_action_result(grpc_request).await;
println!("get_action_result Resp: {:?}", resp);
return resp;
}

async fn update_action_result(
&self,
grpc_request: Request<UpdateActionResultRequest>,
) -> Result<Response<ActionResult>, Status> {
println!("update_action_result Req: {:?}", grpc_request);
let resp = self.inner_update_action_result(grpc_request).await;
println!("update_action_result Resp: {:?}", resp);
return resp;
}
}

0 comments on commit 5452f4b

Please sign in to comment.