From 99bece8be8f11baece0ce10934feecb5d0f51863 Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Thu, 14 Nov 2024 16:13:13 +0200 Subject: [PATCH] feat(protocol): init WebToMaster service --- emerwen-protocol/build.rs | 3 +++ proto/shared/worker.proto | 10 ++++++++++ proto/webtomaster.proto | 13 +++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 proto/shared/worker.proto create mode 100644 proto/webtomaster.proto diff --git a/emerwen-protocol/build.rs b/emerwen-protocol/build.rs index 8bd2f48..b506ef4 100644 --- a/emerwen-protocol/build.rs +++ b/emerwen-protocol/build.rs @@ -14,10 +14,13 @@ fn main() -> Result<(), Box> { "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"], )?; diff --git a/proto/shared/worker.proto b/proto/shared/worker.proto new file mode 100644 index 0000000..0c1ac4c --- /dev/null +++ b/proto/shared/worker.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; +package emerwen.shared; + +import "shared/target.proto"; + +message Worker { + uint32 id = 1; + string auth_token = 2; + repeated shared.Target targets = 3; +} diff --git a/proto/webtomaster.proto b/proto/webtomaster.proto new file mode 100644 index 0000000..b4ce39c --- /dev/null +++ b/proto/webtomaster.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; +package emerwen.webtomaster; + +import "google/protobuf/empty.proto"; +import "shared/worker.proto"; + +service WebToMaster { + rpc GetWorkers (google.protobuf.Empty) returns (WorkersResponse); +} + +message WorkersResponse { + repeated shared.Worker workers = 1; +} -- 2.44.1