cycles-quartz/enclaves/quartz/src/server.rs

37 lines
959 B
Rust
Raw Normal View History

2024-02-22 20:09:44 +00:00
use quartz_proto::quartz::{
core_server::Core, InstantiateRequest, InstantiateResponse, SessionCreateRequest,
SessionCreateResponse,
};
2024-02-20 11:27:10 +00:00
use tonic::{Request, Response, Status};
#[derive(Debug, Default)]
2024-02-22 20:09:44 +00:00
pub struct CoreService;
2024-02-20 11:27:10 +00:00
#[tonic::async_trait]
impl Core for CoreService {
2024-02-22 20:09:44 +00:00
async fn instantiate(
&self,
request: Request<InstantiateRequest>,
) -> Result<Response<InstantiateResponse>, Status> {
println!("Got a request: {:?}", request);
let reply = InstantiateResponse {
message: "Hello!".to_string(),
};
Ok(Response::new(reply))
}
2024-02-20 11:27:10 +00:00
async fn session_create(
&self,
request: Request<SessionCreateRequest>,
) -> Result<Response<SessionCreateResponse>, Status> {
println!("Got a request: {:?}", request);
let reply = SessionCreateResponse {
message: "Hello!".to_string(),
};
Ok(Response::new(reply))
}
}