DEVELOPMENT ENVIRONMENT

~liljamo/emerwen

1b8eda0a49f5fa733c699116c16f51898f5f06b4 — Jonni Liljamo 4 days ago 9730804 master
feat: move emerwen-proto crate out of here
14 files changed, 13 insertions(+), 82 deletions(-)

M Cargo.lock
M Cargo.toml
M emerwen-master/Cargo.toml
M emerwen-master/src/db.rs
M emerwen-master/src/ipc_server/mod.rs
M emerwen-master/src/main.rs
M emerwen-master/src/worker_server/mod.rs
D emerwen-protocol/Cargo.toml
D emerwen-protocol/build.rs
D emerwen-protocol/src/lib.rs
M emerwen-worker/Cargo.toml
M emerwen-worker/src/main.rs
M emerwen-worker/src/monitor.rs
M justfile
M Cargo.lock => Cargo.lock +4 -3
@@ 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",

M Cargo.toml => Cargo.toml +1 -1
@@ 1,6 1,6 @@
[workspace]
resolver = "2"
members = ["emerwen-master", "emerwen-protocol", "emerwen-worker"]
members = ["emerwen-master", "emerwen-worker"]

[workspace.package]
authors = ["Jonni Liljamo <jonni@liljamo.com"]

M emerwen-master/Cargo.toml => emerwen-master/Cargo.toml +1 -1
@@ 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" }

bincode = "1"
clap = { version = "4", features = ["derive"] }

M emerwen-master/src/db.rs => emerwen-master/src/db.rs +1 -1
@@ 7,7 7,7 @@

use std::path::Path;

use emerwen_protocol::emerwen::shared::Worker;
use emerwen_proto::emerwen::shared::Worker;
use redb::{Database, ReadableTable, TableDefinition, TypeName, Value};
use tokio::sync::{mpsc, oneshot};
use tracing::warn;

M emerwen-master/src/ipc_server/mod.rs => emerwen-master/src/ipc_server/mod.rs +1 -1
@@ 7,7 7,7 @@

use std::path::Path;

use emerwen_protocol::emerwen::webtomaster::{
use emerwen_proto::emerwen::webtomaster::{
    web_to_master_server::{WebToMaster, WebToMasterServer},
    WorkersResponse,
};

M emerwen-master/src/main.rs => emerwen-master/src/main.rs +1 -1
@@ 6,7 6,7 @@
 */

use clap::Parser;
use emerwen_protocol::emerwen::shared::{
use emerwen_proto::emerwen::shared::{
    target::{MethodGet, MethodPing},
    Target, Worker,
};

M emerwen-master/src/worker_server/mod.rs => emerwen-master/src/worker_server/mod.rs +1 -1
@@ 7,7 7,7 @@

use std::sync::Arc;

use emerwen_protocol::emerwen::{
use emerwen_proto::emerwen::{
    shared::Worker,
    workertomaster::{
        worker_to_master_server::{WorkerToMaster, WorkerToMasterServer},

D emerwen-protocol/Cargo.toml => emerwen-protocol/Cargo.toml +0 -17
@@ 1,17 0,0 @@
[package]
name = "emerwen-protocol"
version = "0.1.0"
authors.workspace = true
edition.workspace = true
homepage.workspace = true
license.workspace = true
publish.workspace = true
repository.workspace = true

[dependencies]
prost = "0.13"
serde = { version = "1", features = ["derive"] }
tonic = "0.12"

[build-dependencies]
tonic-build = "0.12"

D emerwen-protocol/build.rs => emerwen-protocol/build.rs +0 -28
@@ 1,28 0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
    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(())
}

D emerwen-protocol/src/lib.rs => emerwen-protocol/src/lib.rs +0 -22
@@ 1,22 0,0 @@
/*
 * Copyright (C) 2024 Jonni Liljamo <jonni@liljamo.com>
 *
 * 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<MethodPing> for Method {
    fn from(value: MethodPing) -> Self {
        Method::Ping(value)
    }
}

impl From<MethodGet> for Method {
    fn from(value: MethodGet) -> Self {
        Method::Get(value)
    }
}

M emerwen-worker/Cargo.toml => emerwen-worker/Cargo.toml +1 -1
@@ 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 }

M emerwen-worker/src/main.rs => emerwen-worker/src/main.rs +1 -1
@@ 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};

M emerwen-worker/src/monitor.rs => emerwen-worker/src/monitor.rs +1 -1
@@ 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},
};

M justfile => justfile +0 -3
@@ 9,6 9,3 @@ worker *ARGS:

worker-trace *ARGS:
    cargo run --bin emerwen-worker --features trace -- {{ARGS}}

test-protocol:
    cargo test --package emerwen-protocol