Start implementing the grpc
Some checks failed
ci/woodpecker/push/code_tests Pipeline failed
ci/woodpecker/push/pre_commit_test Pipeline was successful

Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
This commit is contained in:
2025-11-30 13:06:58 +01:00
parent 2052178ebf
commit 86566221b1
6 changed files with 479 additions and 21 deletions

View File

@@ -5,8 +5,12 @@ edition = "2024"
[dependencies]
prost = "0.14.1"
tokio = { version = "1.48.0", features = ["rt-multi-thread"] }
tonic = "0.14.2"
tonic-prost = "0.14.2"
uuid = { version = "1.18.1", features = ["v4"] }
[build-dependencies]
prost-build = "0.14.1"
prost-types = "0.14.1"
tonic-prost-build = "0.14.2"

View File

@@ -1,13 +1,14 @@
use std::{fs, io::Result};
use tonic_prost_build;
fn main() -> Result<()> {
//let proto_dir = "proto";
//let paths = fs::read_dir(proto_dir).unwrap();
//for path in paths {
// prost_build::compile_protos(&[path.unwrap().path()], &[proto_dir])?;
//}
tonic_prost_build::compile_protos("proto/audio_backend.proto")
.unwrap_or_else(|e| panic!("Failed to compile protos {:?}", e));
prost_build::compile_protos(&["proto/audio_backend.proto"], &["proto/"])?;
prost_build::compile_protos(&["proto/items.proto"], &["proto/"])?;
Ok(())
}

View File

@@ -1,6 +1,23 @@
syntax = "proto3";
package termix.audio_backend;
service AudioBackend {
import "google/protobuf/empty.proto";
service AudioBackend {
rpc StartClient(google.protobuf.Empty) returns (google.protobuf.Empty);
rpc InitConnection(google.protobuf.Empty) returns (google.protobuf.Empty);
}
message Shirt {
// Label sizes
enum Size {
SMALL = 0;
MEDIUM = 1;
LARGE = 2;
}
// The base color
string color = 1;
// The size as stated on the label
Size size = 2;
}

View File

@@ -1,11 +1,5 @@
pub mod snazzy {
pub mod items {
include!(concat!(env!("OUT_DIR"), "/snazzy.items.rs"));
}
}
pub mod termix {
pub mod audio_backend {
include!(concat!(env!("OUT_DIR"), "/termix.audio_backend.rs"));
tonic::include_proto!("termix.audio_backend");
}
}