From 859323bdfb3492a0bb6cf29a2014b6198c36304b Mon Sep 17 00:00:00 2001 From: hu55a1n1 Date: Tue, 20 Feb 2024 08:34:42 -0800 Subject: [PATCH] Extract quartz-proto crate --- Cargo.lock | 18 ++++++++++++++++++ enclaves/quartz/Cargo.toml | 3 +-- enclaves/quartz/src/main.rs | 4 ++-- enclaves/quartz/src/server.rs | 3 +-- utils/quartz-proto/Cargo.toml | 11 +++++++++++ .../quartz => utils/quartz-proto}/build.rs | 0 .../quartz-proto}/proto/quartz.proto | 0 .../proto.rs => utils/quartz-proto/src/lib.rs | 0 8 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 utils/quartz-proto/Cargo.toml rename {enclaves/quartz => utils/quartz-proto}/build.rs (100%) rename {enclaves/quartz => utils/quartz-proto}/proto/quartz.proto (100%) rename enclaves/quartz/src/proto.rs => utils/quartz-proto/src/lib.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 0d884d4..e44bda2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1832,11 +1832,29 @@ name = "quartz-enclave" version = "0.1.0" dependencies = [ "prost", + "quartz-proto", "tokio", "tonic", +] + +[[package]] +name = "quartz-proto" +version = "0.1.0" +dependencies = [ + "prost", + "tonic", "tonic-build", ] +[[package]] +name = "quartz-relayer" +version = "0.1.0" +dependencies = [ + "quartz-proto", + "tokio", + "tonic", +] + [[package]] name = "quote" version = "1.0.35" diff --git a/enclaves/quartz/Cargo.toml b/enclaves/quartz/Cargo.toml index 20bfc63..bfdcdf3 100644 --- a/enclaves/quartz/Cargo.toml +++ b/enclaves/quartz/Cargo.toml @@ -8,5 +8,4 @@ prost = "0.12" tonic = "0.11" tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } -[build-dependencies] -tonic-build = "0.11" +quartz-proto = { path = "../../utils/quartz-proto" } diff --git a/enclaves/quartz/src/main.rs b/enclaves/quartz/src/main.rs index e061dca..8f8bfe0 100644 --- a/enclaves/quartz/src/main.rs +++ b/enclaves/quartz/src/main.rs @@ -14,12 +14,12 @@ unused_qualifications )] -mod proto; mod server; +use quartz_proto::quartz::core_server::CoreServer; use tonic::transport::Server; -use crate::{proto::quartz::core_server::CoreServer, server::CoreService}; +use crate::server::CoreService; #[tokio::main(flavor = "current_thread")] async fn main() -> Result<(), Box> { diff --git a/enclaves/quartz/src/server.rs b/enclaves/quartz/src/server.rs index 0267da9..3a99741 100644 --- a/enclaves/quartz/src/server.rs +++ b/enclaves/quartz/src/server.rs @@ -1,7 +1,6 @@ +use quartz_proto::quartz::{core_server::Core, SessionCreateRequest, SessionCreateResponse}; use tonic::{Request, Response, Status}; -use crate::proto::quartz::{core_server::Core, SessionCreateRequest, SessionCreateResponse}; - #[derive(Debug, Default)] pub struct CoreService {} diff --git a/utils/quartz-proto/Cargo.toml b/utils/quartz-proto/Cargo.toml new file mode 100644 index 0000000..d406f0f --- /dev/null +++ b/utils/quartz-proto/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "quartz-proto" +version = "0.1.0" +edition = "2021" + +[dependencies] +prost = "0.12" +tonic = "0.11" + +[build-dependencies] +tonic-build = "0.11" diff --git a/enclaves/quartz/build.rs b/utils/quartz-proto/build.rs similarity index 100% rename from enclaves/quartz/build.rs rename to utils/quartz-proto/build.rs diff --git a/enclaves/quartz/proto/quartz.proto b/utils/quartz-proto/proto/quartz.proto similarity index 100% rename from enclaves/quartz/proto/quartz.proto rename to utils/quartz-proto/proto/quartz.proto diff --git a/enclaves/quartz/src/proto.rs b/utils/quartz-proto/src/lib.rs similarity index 100% rename from enclaves/quartz/src/proto.rs rename to utils/quartz-proto/src/lib.rs