This commit is contained in:
xqtc 2024-09-11 22:18:22 +02:00
parent a634b174b9
commit bc84e9164f
3 changed files with 13 additions and 12 deletions
justfile
yotei-nodes/src

View file

@ -9,6 +9,12 @@ fmt:
run *ARGS: run *ARGS:
cargo 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) # Run 'cargo watch' to run the project (auto-recompiles)
watch *ARGS: watch *ARGS:
cargo watch -x "run -- {{ARGS}}" cargo watch -x "run -- {{ARGS}}"

View file

@ -30,8 +30,9 @@ impl data_server::Data for DataService {
} }
} }
async fn data_client() { async fn data_client(node_id: String, hashmap_id: String, uuid: String) -> tonic::Request<DataRequest>{
todo!() let req = DataRequest {node_id, uuid, hashmap_id };
tonic::Request::new(req)
} }
#[derive(Debug, Default)] #[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> {} // async fn logout(node_id: String) -> tonic::Request<LoginRequest> {}

View file

@ -5,7 +5,7 @@ mod config;
use crate::config::CONFIG; use crate::config::CONFIG;
use log::{debug, info}; use log::{debug, info};
use sched::LoginRequest; use sched::{LoginRequest, LogoutRequest};
pub mod sched { pub mod sched {
tonic::include_proto!("sched"); tonic::include_proto!("sched");
@ -50,6 +50,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
})) }))
.await? .await?
); );
debug!("{:#?}", auth.logout(tonic::Request::new(LogoutRequest {
node_id: "compute-1".to_string(),
})).await?);
// Await server at end // Await server at end
alive_check_server.await?; alive_check_server.await?;
Ok(()) 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>> { async fn alive_check_serve(addr: SocketAddr) -> Result<(), Box<dyn std::error::Error>> {
use grpc::AliveCheckService; use grpc::AliveCheckService;
use sched::alive_check_server::AliveCheckServer; use sched::alive_check_server::AliveCheckServer;
use tokio::sync::mpsc;
use tokio::task; use tokio::task;
use tonic::transport::Server; use tonic::transport::Server;
let (tx, mut rx) = mpsc::channel::<Server>(100);
task::spawn(async move { task::spawn(async move {
info!( info!(
@ -77,8 +78,5 @@ async fn alive_check_serve(addr: SocketAddr) -> Result<(), Box<dyn std::error::E
.unwrap(); .unwrap();
}); });
while let Some(msg) = rx.recv().await {
println!("REC: {:?}", msg);
}
Ok(()) Ok(())
} }