M emerwen-protocol/build.rs => emerwen-protocol/build.rs +3 -0
@@ 14,10 14,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"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"],
)?;
A proto/shared/worker.proto => proto/shared/worker.proto +10 -0
@@ 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;
+}
A proto/webtomaster.proto => proto/webtomaster.proto +13 -0
@@ 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;
+}