133 lines
2.8 KiB
Protocol Buffer
133 lines
2.8 KiB
Protocol Buffer
syntax = "proto3";
|
||
|
||
// auth验证请求和应答
|
||
|
||
message AuthRequest {
|
||
string uuid = 1;
|
||
string username = 2;
|
||
string salt = 4;
|
||
string token = 5;
|
||
uint32 timestamp = 6;
|
||
}
|
||
|
||
message AuthReply {
|
||
uint32 code = 1;
|
||
string message = 2;
|
||
string repository_url = 3;
|
||
}
|
||
|
||
// 激活信息
|
||
message ActivatePush {
|
||
bool auth = 1;
|
||
}
|
||
|
||
// 部署逻辑
|
||
message Deploy {
|
||
uint32 task_id = 1;
|
||
string from = 2;
|
||
string service_id = 3;
|
||
}
|
||
|
||
// 部署响应
|
||
message DeployReply {
|
||
bool is_ok = 1;
|
||
string message = 2;
|
||
}
|
||
|
||
// 基于pub/sub的机制实现远程调用
|
||
message TopicMessage {
|
||
string topic = 1;
|
||
string content = 2;
|
||
}
|
||
|
||
// 服务参数
|
||
message ServiceArguments {
|
||
string service_id = 1;
|
||
string args = 2;
|
||
}
|
||
|
||
message ServiceArgumentsReply {
|
||
bool is_ok = 1;
|
||
string message = 2;
|
||
}
|
||
|
||
// 服务采集项
|
||
message ServiceMetrics {
|
||
string service_id = 1;
|
||
string metrics = 2;
|
||
}
|
||
|
||
message ServiceMetricsReply {
|
||
bool is_ok = 1;
|
||
string message = 2;
|
||
}
|
||
|
||
// 数据传输
|
||
message Data {
|
||
string device_uuid = 1;
|
||
string service_name = 2;
|
||
int32 at = 3;
|
||
map<string, string> tags = 4;
|
||
// 为了数据的灵活性,存储类型无关的二进制流; 兼容更多的业务逻辑情况
|
||
bytes fields = 5;
|
||
}
|
||
|
||
//#{<<"adcode">> => 0,<<"boot_time">> => 18256077,<<"city">> => <<>>,
|
||
// <<"cpu_core">> => 2,
|
||
// <<"cpu_load">> => 0,<<"cpu_temperature">> => 43.75,
|
||
// <<"disk">> => #{<<"total">> => 7129,<<"used">> => 6074},
|
||
// <<"efka_version">> => <<"1.0.0">>,
|
||
// <<"interfaces">> => [],
|
||
// <<"ips">> => [<<"10.68.152.142/22">>,<<"10.20.1.202/24">>],
|
||
// <<"kernel_arch">> => <<"Linux openeic 4.4.194 #14 SMP PREEMPT Fri Aug 2 11:31:15 CST 2024 aarch64 GNU/Linux\n">>,
|
||
// <<"memory">> => #{<<"total">> => 990,<<"used">> => 80},
|
||
// <<"province">> => <<>>}
|
||
|
||
// 定义ping消息格式
|
||
|
||
message Ping {
|
||
string adcode = 1;
|
||
uint32 boot_time = 2;
|
||
string province = 3;
|
||
string city = 4;
|
||
string efka_version = 5;
|
||
string kernel_arch = 6;
|
||
repeated string ips = 7;
|
||
// cpu
|
||
uint32 cpu_core = 8;
|
||
uint32 cpu_load = 9;
|
||
float cpu_temperature = 10;
|
||
// 存储格式为数组: [total, used]
|
||
repeated int32 disk = 11;
|
||
repeated int32 memory = 12;
|
||
// 接口信息的定义: 每个接口的信息, 采用json格式传输,没有办法提前定义
|
||
string interfaces = 13;
|
||
}
|
||
|
||
// Inform消息
|
||
message ServiceInform {
|
||
string service_id = 1;
|
||
string props = 2;
|
||
uint32 status = 3;
|
||
uint32 timestamp = 4;
|
||
}
|
||
|
||
// 任务部署阶段反馈
|
||
message FeedbackPhase {
|
||
string task_id = 1;
|
||
uint32 timestamp = 2;
|
||
string phase = 3;
|
||
// 0 标识失败, 1 成功
|
||
uint32 code = 4;
|
||
string message = 5;
|
||
}
|
||
|
||
message Event {
|
||
uint32 event_type = 1;
|
||
string params = 2;
|
||
}
|
||
|
||
message AIEvent {
|
||
uint32 event_type = 1;
|
||
string params = 2;
|
||
} |