diff --git a/justfile b/justfile index 753472f..3141d18 100644 --- a/justfile +++ b/justfile @@ -9,6 +9,12 @@ fmt: run *ARGS: cargo run {{ARGS}} +head-node *ARGS: + cargo run --bin head-node + +worker-node *ARGS: + cargo run --bin worker-node + # Run 'cargo watch' to run the project (auto-recompiles) watch *ARGS: cargo watch -x "run -- {{ARGS}}" diff --git a/yotei-nodes/src/grpc/mod.rs b/yotei-nodes/src/grpc/mod.rs index 311b2ea..920033e 100644 --- a/yotei-nodes/src/grpc/mod.rs +++ b/yotei-nodes/src/grpc/mod.rs @@ -30,8 +30,9 @@ impl data_server::Data for DataService { } } -async fn data_client() { - todo!() +async fn data_client(node_id: String, hashmap_id: String, uuid: String) -> tonic::Request<DataRequest>{ + let req = DataRequest {node_id, uuid, hashmap_id }; + tonic::Request::new(req) } #[derive(Debug, Default)] @@ -64,10 +65,6 @@ impl auth_server::Auth for AuthService { } } -async fn login(node_id: String) -> tonic::Request<LoginRequest> { - let req = LoginRequest { node_id }; - tonic::Request::new(req) -} // async fn logout(node_id: String) -> tonic::Request<LoginRequest> {} diff --git a/yotei-nodes/src/worker.rs b/yotei-nodes/src/worker.rs index 0ae7d8f..728a94f 100644 --- a/yotei-nodes/src/worker.rs +++ b/yotei-nodes/src/worker.rs @@ -5,7 +5,7 @@ mod config; use crate::config::CONFIG; use log::{debug, info}; -use sched::LoginRequest; +use sched::{LoginRequest, LogoutRequest}; pub mod sched { tonic::include_proto!("sched"); @@ -50,6 +50,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { })) .await? ); + debug!("{:#?}", auth.logout(tonic::Request::new(LogoutRequest { + node_id: "compute-1".to_string(), + })).await?); // Await server at end alive_check_server.await?; Ok(()) @@ -58,11 +61,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { async fn alive_check_serve(addr: SocketAddr) -> Result<(), Box<dyn std::error::Error>> { use grpc::AliveCheckService; use sched::alive_check_server::AliveCheckServer; - use tokio::sync::mpsc; use tokio::task; use tonic::transport::Server; - let (tx, mut rx) = mpsc::channel::<Server>(100); task::spawn(async move { info!( @@ -77,8 +78,5 @@ async fn alive_check_serve(addr: SocketAddr) -> Result<(), Box<dyn std::error::E .unwrap(); }); - while let Some(msg) = rx.recv().await { - println!("REC: {:?}", msg); - } Ok(()) }