♻️ Better grpc map encoder / decoder

This commit is contained in:
2024-10-20 15:22:19 +08:00
parent 71b8607e32
commit 18ce501089
16 changed files with 957 additions and 80 deletions

42
pkg/proto/command.proto Normal file
View File

@@ -0,0 +1,42 @@
syntax = "proto3";
option go_package = ".;proto";
package proto;
service CommandController {
rpc AddCommand(CommandInfo) returns (AddCommandResponse) {}
rpc RemoveCommand(CommandLookupRequest) returns (RemoveCommandResponse) {}
rpc SendCommand(CommandArgument) returns (CommandReturn) {}
rpc SendStreamCommand(stream CommandArgument) returns (stream CommandReturn) {}
}
message CommandInfo {
string id = 1;
string method = 2;
repeated string tags = 3;
}
message CommandLookupRequest {
string id = 1;
string method = 2;
}
message AddCommandResponse {
bool is_success = 1;
}
message RemoveCommandResponse {
bool is_success = 1;
}
message CommandArgument {
string command = 1;
string method = 2;
optional bytes payload = 3;
}
message CommandReturn {
int32 status = 1;
optional bytes payload = 2;
}