From 1b8eda0a49f5fa733c699116c16f51898f5f06b4 Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Mon, 18 Nov 2024 20:07:51 +0200 Subject: [PATCH] feat: move emerwen-proto crate out of here --- Cargo.lock | 7 ++++--- Cargo.toml | 2 +- emerwen-master/Cargo.toml | 2 +- emerwen-master/src/db.rs | 2 +- emerwen-master/src/ipc_server/mod.rs | 2 +- emerwen-master/src/main.rs | 2 +- emerwen-master/src/worker_server/mod.rs | 2 +- emerwen-protocol/Cargo.toml | 17 --------------- emerwen-protocol/build.rs | 28 ------------------------- emerwen-protocol/src/lib.rs | 22 ------------------- emerwen-worker/Cargo.toml | 2 +- emerwen-worker/src/main.rs | 2 +- emerwen-worker/src/monitor.rs | 2 +- justfile | 3 --- 14 files changed, 13 insertions(+), 82 deletions(-) delete mode 100644 emerwen-protocol/Cargo.toml delete mode 100644 emerwen-protocol/build.rs delete mode 100644 emerwen-protocol/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index f5da97d..b219d7c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -396,7 +396,7 @@ version = "0.1.0" dependencies = [ "bincode", "clap", - "emerwen-protocol", + "emerwen-proto", "redb", "serde", "tokio", @@ -408,8 +408,9 @@ dependencies = [ ] [[package]] -name = "emerwen-protocol" +name = "emerwen-proto" version = "0.1.0" +source = "git+https://git.src.quest/~liljamo/emerwen-proto#787470c66a23d1bb9c18b6ce7e410267dcb27d5d" dependencies = [ "prost", "serde", @@ -423,7 +424,7 @@ version = "0.1.0" dependencies = [ "clap", "console-subscriber", - "emerwen-protocol", + "emerwen-proto", "reqwest", "surge-ping", "tokio", diff --git a/Cargo.toml b/Cargo.toml index a700736..dc13fb3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] resolver = "2" -members = ["emerwen-master", "emerwen-protocol", "emerwen-worker"] +members = ["emerwen-master", "emerwen-worker"] [workspace.package] authors = ["Jonni Liljamo Result<(), Box> { - tonic_build::configure() - .include_file("mod.rs") - .type_attribute("Target", "#[derive(serde::Deserialize, serde::Serialize)]") - .type_attribute( - "Target.method", - "#[derive(serde::Deserialize, serde::Serialize)]", - ) - .type_attribute( - "Target.MethodPing", - "#[derive(serde::Deserialize, serde::Serialize)]", - ) - .type_attribute( - "Target.MethodGET", - "#[derive(serde::Deserialize, serde::Serialize)]", - ) - .type_attribute("Worker", "#[derive(serde::Deserialize, serde::Serialize)]") - .compile_protos( - &[ - "../proto/workertomaster.proto", - "../proto/webtomaster.proto", - "../proto/shared/target.proto", - "../proto/shared/worker.proto", - ], - &["../proto"], - )?; - Ok(()) -} diff --git a/emerwen-protocol/src/lib.rs b/emerwen-protocol/src/lib.rs deleted file mode 100644 index 0dee097..0000000 --- a/emerwen-protocol/src/lib.rs +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2024 Jonni Liljamo - * - * This file is licensed under GPL-3.0-or-later, see NOTICE and LICENSE for - * more information. - */ - -tonic::include_proto!("mod"); - -use emerwen::shared::target::{Method, MethodGet, MethodPing}; - -impl From for Method { - fn from(value: MethodPing) -> Self { - Method::Ping(value) - } -} - -impl From for Method { - fn from(value: MethodGet) -> Self { - Method::Get(value) - } -} diff --git a/emerwen-worker/Cargo.toml b/emerwen-worker/Cargo.toml index 546c109..819e623 100644 --- a/emerwen-worker/Cargo.toml +++ b/emerwen-worker/Cargo.toml @@ -9,7 +9,7 @@ publish.workspace = true repository.workspace = true [dependencies] -emerwen-protocol = { path = "../emerwen-protocol" } +emerwen-proto = { git = "https://git.src.quest/~liljamo/emerwen-proto" } clap = { version = "4", features = ["derive"] } console-subscriber = { version = "0.4", optional = true } diff --git a/emerwen-worker/src/main.rs b/emerwen-worker/src/main.rs index 5e0e052..c519d82 100644 --- a/emerwen-worker/src/main.rs +++ b/emerwen-worker/src/main.rs @@ -6,7 +6,7 @@ */ use clap::Parser; -use emerwen_protocol::emerwen::workertomaster::worker_to_master_client::WorkerToMasterClient; +use emerwen_proto::emerwen::workertomaster::worker_to_master_client::WorkerToMasterClient; use tonic::{metadata::MetadataValue, service::Interceptor, transport::Channel}; use tracing::{debug, info}; use tracing_subscriber::{prelude::*, EnvFilter}; diff --git a/emerwen-worker/src/monitor.rs b/emerwen-worker/src/monitor.rs index 7df9464..c7d0079 100644 --- a/emerwen-worker/src/monitor.rs +++ b/emerwen-worker/src/monitor.rs @@ -7,7 +7,7 @@ use std::time::Duration; -use emerwen_protocol::emerwen::{ +use emerwen_proto::emerwen::{ shared::{target::Method, Target, TargetState}, workertomaster::{worker_to_master_client::WorkerToMasterClient, SetTargetStateRequest}, }; diff --git a/justfile b/justfile index 13e07e2..ad19b3b 100644 --- a/justfile +++ b/justfile @@ -9,6 +9,3 @@ worker *ARGS: worker-trace *ARGS: cargo run --bin emerwen-worker --features trace -- {{ARGS}} - -test-protocol: - cargo test --package emerwen-protocol -- 2.44.1