commit 65300edf90eefaa61833fd3dabd25e3e95c56c61 Author: alemidev Date: Sun Jul 10 19:01:56 2022 +0200 build: initial commit with tonic stubs diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..011b707 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +# Default to Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = tab +indent_size = 4 + +[*.rs] +indent_size = 2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000..218e203 --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1 @@ +hard_tabs = true diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..c6d2b57 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "codemp" +version = "0.1.0" +edition = "2021" + +[[bin]] # Bin to run the CodeMP gRPC server +name = "codemp-server" +path = "src/server.rs" + +[[bin]] # Bin to run the CodeMP gRPC client +name = "codemp-client" +path = "src/client.rs" + +[dependencies] +tonic = "0.7" +prost = "0.10" +tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } + +[build-dependencies] +tonic-build = "0.7" diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..2ff484b --- /dev/null +++ b/build.rs @@ -0,0 +1,4 @@ +fn main() -> Result<(), Box> { + tonic_build::compile_protos("proto/core.proto")?; + Ok(()) +} diff --git a/proto/core.proto b/proto/core.proto new file mode 100644 index 0000000..2a28f46 --- /dev/null +++ b/proto/core.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package core; + +service Session { + rpc Create (SessionRequest) returns (SessionResponse); +} + +message SessionRequest { + int32 sessionId = 1; +} + +message SessionResponse { + int32 sessionId = 1; +} + diff --git a/src/client.rs b/src/client.rs new file mode 100644 index 0000000..53844fe --- /dev/null +++ b/src/client.rs @@ -0,0 +1,13 @@ +use tonic::{transport::Server, Request, Response, Status}; + +pub mod proto_core { + tonic::include_proto!("core"); +} + +use proto_core::session_server::{Session, SessionServer}; +use proto_core::{SessionRequest, SessionResponse}; + +pub fn main() { + + +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..a30eb95 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/src/server.rs b/src/server.rs new file mode 100644 index 0000000..53844fe --- /dev/null +++ b/src/server.rs @@ -0,0 +1,13 @@ +use tonic::{transport::Server, Request, Response, Status}; + +pub mod proto_core { + tonic::include_proto!("core"); +} + +use proto_core::session_server::{Session, SessionServer}; +use proto_core::{SessionRequest, SessionResponse}; + +pub fn main() { + + +}