fix proto

This commit is contained in:
anlicheng 2026-04-26 16:31:34 +08:00
parent c46336431f
commit a687abdefd
2 changed files with 56 additions and 2 deletions

54
proto/service.proto Normal file
View File

@ -0,0 +1,54 @@
syntax = "proto3";
// ws_channel efka
// JSON //
message ServiceRequest {
uint32 packet_id = 1;
message Register {
string service_id = 1;
}
message Subscribe {
string topic = 1;
}
oneof request {
Register register = 10;
Subscribe subscribe = 11;
}
}
message ServiceReply {
uint32 packet_id = 1;
message Error {
int32 code = 1;
string message = 2;
}
oneof reply {
bytes result = 10;
Error error = 11;
}
}
message ServiceCast {
message MetricData {
bytes route_key = 1;
bytes metric = 2;
}
message TopicEvent {
string topic = 1;
bytes content = 2;
}
oneof body {
TopicEvent topic_event = 10;
MetricData metric_data = 11;
}
}

View File

@ -8,8 +8,8 @@
% 核心:强制指定 proto 路径 + 输出到你的 apps/sdlan % 核心:强制指定 proto 路径 + 输出到你的 apps/sdlan
% ====================== % ======================
{gpb_opts, [ {gpb_opts, [
{i, "../proto"}, % 共享 proto 文件路径 {i, "proto"}, % 共享 proto 文件路径
{src_dirs, ["../proto"]}, % 源码目录(必须) {src_dirs, ["proto"]}, % 源码目录(必须)
{f, ["service.proto"]}, {f, ["service.proto"]},
recursive, % 递归查找 proto 文件 recursive, % 递归查找 proto 文件
{module_name_suffix, "_pb"}, % 生成模块后缀 {module_name_suffix, "_pb"}, % 生成模块后缀