实现基础的智能调度

This commit is contained in:
GoEdgeLab
2023-05-17 18:42:35 +08:00
parent f52a55e670
commit fa2f89c094
12 changed files with 3273 additions and 718 deletions

View File

@@ -0,0 +1,71 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_node_action.proto";
import "models/rpc_messages.proto";
// 节点动作服务
service NodeActionService {
// 添加动作
rpc createNodeAction(CreateNodeActionRequest) returns (CreateNodeActionResponse);
// 删除动作
rpc deleteNodeAction(DeleteNodeActionRequest) returns (RPCSuccess);
// 修改动作
rpc updateNodeAction(UpdateNodeActionRequest) returns (RPCSuccess);
// 列出某个节点的所有动作
rpc findAllNodeActions(FindAllNodeActionsRequest) returns (FindAllNodeActionsResponse);
// 查找单个节点动作
rpc findNodeAction(FindNodeActionRequest) returns (FindNodeActionResponse);
}
// 添加动作
message CreateNodeActionRequest {
int64 nodeId = 1; // 节点ID
string role = 2; // 节点角色
bytes condsJSON = 3; // 条件设置
bytes actionJSON = 4; // 动作设置
bytes durationJSON = 5; // 持续时间
}
message CreateNodeActionResponse {
int64 nodeActionId = 1;
}
// 删除动作
message DeleteNodeActionRequest {
int64 nodeActionId = 1;
}
// 修改动作
message UpdateNodeActionRequest {
int64 nodeActionId = 1; // 动作ID
bytes condsJSON = 2;
bytes actionJSON = 3;
bytes durationJSON = 4; // 持续时间
bool isOn = 5; // 是否启用
}
// 列出某个节点的所有动作
message FindAllNodeActionsRequest {
int64 nodeId = 1; // 节点ID
string role = 2; // 节点角色
}
message FindAllNodeActionsResponse {
repeated NodeAction nodeActions = 1; // 动作列表
}
// 查找单个节点动作
message FindNodeActionRequest {
int64 nodeActionId = 1; // 动作ID
}
message FindNodeActionResponse {
NodeAction nodeAction = 1;
}