diff --git a/.forgejo/workflows/uwu.yaml b/.forgejo/workflows/uwu.yaml index e5b1613..4c33b59 100644 --- a/.forgejo/workflows/uwu.yaml +++ b/.forgejo/workflows/uwu.yaml @@ -15,6 +15,8 @@ jobs: with: command: build args: --release --bins + - name: Install Protoc + uses: arduino/setup-protoc@v3 - uses: https://github.com/actions-rs/cargo@v1 with: command: build @@ -32,6 +34,8 @@ jobs: - uses: https://github.com/actions-rs/toolchain@v1 with: toolchain: nightly + - name: Install Protoc + uses: arduino/setup-protoc@v3 - uses: https://github.com/actions-rs/cargo@v1 with: command: clippy diff --git a/Cargo.toml b/Cargo.toml index ccab24b..688fccc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,4 @@ [workspace] -members = ["./uwusched-head-node"] +members = ["./uwusched-nodes"] resolver = "2" diff --git a/protos/protocol.proto b/protos/protocol.proto index 827810b..e9ffdd6 100644 --- a/protos/protocol.proto +++ b/protos/protocol.proto @@ -25,8 +25,18 @@ service Auth { message LoginRequest { string node_id = 1; + message specs { + uint32 threads = 1; + float clock = 2; + uint32 mem_mib = 3; + uint32 net_speed_mib = 4; + } } message LoginResponse { - + string node_id = 1; + enum status { + ACCEPTED = 0; + REJECTED = 1; + } } diff --git a/uwusched-head-node/src/head.rs b/uwusched-head-node/src/head.rs deleted file mode 100644 index e2c14a4..0000000 --- a/uwusched-head-node/src/head.rs +++ /dev/null @@ -1,38 +0,0 @@ -mod config; - -use crate::config::CONFIG; -use bson::{bson, Bson}; -use clap::{Parser, Subcommand}; -use log::debug; -use lz4_flex::block::{compress_prepend_size, decompress_size_prepended}; -use tonic::*; - -#[derive(Parser)] -#[command(author, version, about)] -#[command(propagate_version = true)] -struct Cli { - #[command(subcommand)] - command: Option, -} - -#[derive(Subcommand)] -enum Commands { - /// Starts uwusched - Start { role: Option }, -} -fn get_type_of(_: &T) -> &'static str { - std::any::type_name::() -} - -fn main() { - std::env::set_var("RUST_LOG", CONFIG.log.level.clone()); - pretty_env_logger::init(); - // debug!("{:?}", CONFIG.node); - let cli = Cli::parse(); - match &cli.command { - Some(Commands::Start { role }) => { - debug!("{:#?}", role) - } - None => {} - } -} diff --git a/uwusched-head-node/.gitignore b/uwusched-nodes/.gitignore similarity index 100% rename from uwusched-head-node/.gitignore rename to uwusched-nodes/.gitignore diff --git a/uwusched-head-node/Cargo.lock b/uwusched-nodes/Cargo.lock similarity index 100% rename from uwusched-head-node/Cargo.lock rename to uwusched-nodes/Cargo.lock diff --git a/uwusched-head-node/Cargo.toml b/uwusched-nodes/Cargo.toml similarity index 100% rename from uwusched-head-node/Cargo.toml rename to uwusched-nodes/Cargo.toml diff --git a/uwusched-head-node/build.rs b/uwusched-nodes/build.rs similarity index 100% rename from uwusched-head-node/build.rs rename to uwusched-nodes/build.rs diff --git a/uwusched-head-node/src/compute.rs b/uwusched-nodes/src/compute.rs similarity index 100% rename from uwusched-head-node/src/compute.rs rename to uwusched-nodes/src/compute.rs diff --git a/uwusched-head-node/src/config.rs b/uwusched-nodes/src/config.rs similarity index 100% rename from uwusched-head-node/src/config.rs rename to uwusched-nodes/src/config.rs diff --git a/uwusched-nodes/src/head.rs b/uwusched-nodes/src/head.rs new file mode 100644 index 0000000..abd4ba0 --- /dev/null +++ b/uwusched-nodes/src/head.rs @@ -0,0 +1,69 @@ +mod config; + +use crate::config::CONFIG; +use bson::{bson, Bson}; +use clap::{Parser, Subcommand}; +use log::debug; +use lz4_flex::block::{compress_prepend_size, decompress_size_prepended}; +use tonic::{transport::Server, Request, Response, Status}; +// Import generated protobuf +mod sched { + tonic::include_proto!("sched"); +} + +#[derive(Parser)] +#[command(author, version, about)] +#[command(propagate_version = true)] +struct Cli { + #[command(subcommand)] + command: Option, + + #[arg(short, long)] + /// Optional path to config file + config_file: Option, +} + +#[derive(Subcommand)] +enum Commands { + /// Starts uwusched + Start { role: Option }, +} + +fn get_type_of(_: &T) -> &'static str { + std::any::type_name::() +} + +// impl sched::data_server::Data for sched::DataResponse { +// fn data<'life0, 'async_trait>( +// &'life0 self, +// request: tonic::Request, +// ) -> ::core::pin::Pin< +// Box< +// dyn ::core::future::Future< +// Output = std::result::Result< +// tonic::Response, +// tonic::Status, +// >, +// > + ::core::marker::Send +// + 'async_trait, +// >, +// > +// where +// 'life0: 'async_trait, +// Self: 'async_trait, +// { +// } +// } + +fn main() { + std::env::set_var("RUST_LOG", CONFIG.log.level.clone()); + pretty_env_logger::init(); + debug!("{:?}", CONFIG.node); + let cli = Cli::parse(); + match &cli.command { + Some(Commands::Start { role }) => { + debug!("{:#?}", role) + } + None => {} + } +}