更新大量【proto定义】并勘误

This commit is contained in:
社会易姐QwQ
2021-07-06 21:28:36 +08:00
parent 129b9bc88b
commit ce8d00fcd0
36 changed files with 2951 additions and 2099 deletions

View File

@@ -0,0 +1,96 @@
syntax = "proto3";
package bilibili.broadcast.v1;
import "bilibili/rpc/status.proto";
import "google/protobuf/any.proto";
import "google/protobuf/empty.proto";
// broadcast操作对应每个target_path
service Broadcast {
// 用户鉴权
rpc Auth(AuthReq) returns (AuthResp);
// 心跳保活成功心跳为4分45秒重试心跳为30s三次收不到进行重连不超过5分45
rpc Heartbeat(HeartbeatReq) returns (HeartbeatResp);
// 订阅target_path
rpc Subscribe(TargetPath) returns (google.protobuf.Empty);
// 取消订阅target_path
rpc Unsubscribe(TargetPath) returns (google.protobuf.Empty);
// 消息回执
rpc MessageAck(MessageAckReq) returns (google.protobuf.Empty);
}
// broadcast连接隧道
service BroadcastTunnel {
// 创建双向stream连接隧道
rpc CreateTunnel(stream BroadcastFrame) returns (stream BroadcastFrame);
}
// 鉴权请求通过authorization验证绑定用户mid
message AuthReq {
// 冷启动id算法uuid重新起启会变
string guid = 1;
// 连接id算法uuid重连会变
string conn_id = 2;
// 最后收到的消息id用于过虑重连后获取未读的消息
int64 last_msg_id = 3;
}
// 鉴权返回
message AuthResp {}
// 心跳请求
message HeartbeatReq{}
// 心跳返回
message HeartbeatResp{}
// target_path
message TargetPath {
// 需要订阅的target_paths
repeated string target_paths = 1;
}
// 消息回执
message MessageAckReq {
// 消息id
int64 ack_id = 1;
// ack来源由业务指定用于埋点跟踪
string ack_origin = 2;
// 消息对应的target_path方便业务区分和监控统计
string target_path = 3;
}
// message_id:
// client: 本次连接唯一的消息id可用于回执
// server: 唯一消息id可用于上报或者回执
// sequence:
// client: 客户端应该每次请求时frame seq++会返回对应的对称req/resp
// server: 服务端下行消息只会返回默认值0
message FrameOption {
// 消息id
int64 message_id = 1;
// frame序号
int64 sequence = 2;
// 是否进行消息回执(发出MessageAckReq)
// downstream 上只有服务端设置为true客户端响应
// upstream 上只有客户端设置为true服务端响应
// 响应帧禁止设置is_ack协议上禁止循环
// 通常只有业务帧才可能设置is_ack, 因为协议栈(例如心跳、鉴权)另有响应约定
bool is_ack = 3;
// 业务状态码
bilibili.rpc.Status status = 4;
// 业务ack来源, 仅downstream时候由服务端填写.
string ack_origin = 5;
}
// target_path:
// "/" Service-Name "/" {method name} 参考 gRPC Request Path
message BroadcastFrame {
// 请求消息信息
FrameOption options = 1;
// 业务target_path
string target_path = 2;
// 业务pb内容
google.protobuf.Any body = 3;
}

View File

@@ -0,0 +1,19 @@
syntax = "proto3";
package bilibili.broadcast.v1;
import "google/protobuf/empty.proto";
// Laser
service Laser {
// 监听上报事件
rpc WatchLogUploadEvent(google.protobuf.Empty) returns (stream LaserLogUploadResp);
}
// 服务端下发日志上报事件
message LaserLogUploadResp {
// 任务id
int64 taskid = 1;
// 下发时间
string date = 2;
}

View File

@@ -0,0 +1,13 @@
syntax = "proto3";
package bilibili.broadcast.v1;
import "google/protobuf/empty.proto";
message ModResourceResp {}
// ModManager
service ModManager {
//
rpc WatchResource(google.protobuf.Empty) returns (stream ModResourceResp);
}

View File

@@ -0,0 +1,126 @@
syntax = "proto3";
package bilibili.broadcast.v1;
import "google/protobuf/empty.proto";
// Push
service Push {
rpc WatchMessage(google.protobuf.Empty) returns (stream PushMessageResp);
}
//
message PushMessageResp {
// 业务类型
enum Biz {
// 未知
BIZ_UNKNOWN = 0;
// 视频
BIZ_VIDEO = 1;
// 直播
BIZ_LIVE = 2;
// 活动
BIZ_ACTIVITY = 3;
}
// 消息类型
enum Type {
// 未知
TYPE_UNKNOWN = 0;
// 默认
TYPE_DEFAULT = 1;
// 热门
TYPE_HOT = 2;
// 实时
TYPE_REALTIME = 3;
// 推荐
TYPE_RECOMMEND = 4;
}
// 展示未知
enum Position {
// 未知
POS_UNKNOWN = 0;
// 顶部
POS_TOP = 1;
}
// Deprecated: 推送任务id使用string
int64 old_taskid = 1;
// 业务
// 1:是视频 2:是直播 3:是活动
Biz biz = 2;
// 类型
// 1:是默认 2:是热门 3:是实时 4:是推荐
Type type = 3;
// 主标题
string title = 4;
// 副标题
string summary = 5;
// 图片地址
string img = 6;
// 跳转地址
string link = 7;
// 展示位置1是顶部
Position position = 8;
// 展示时长单位默认3秒
int32 duration = 9;
// 失效时间
int64 expire = 10;
// 推送任务id
string taskid = 11;
// 应用内推送黑名单
// UGC: ugc-video-detail
// PGC: pgc-video-detail
// 一起看: pgc-video-detail-theater
// 直播: live-room-detail
// Story: ugc-video-detail-vertical
// 播单黑名单 playlist-video-detail
repeated PageBlackList page_blackList = 12;
// 预留pvid
repeated PageView page_view = 13;
// 跳转资源
TargetResource target_resource = 14;
}
//
message PageBlackList {
//
string id = 1;
}
//
message PageView {
//
string id = 1;
}
//
enum LinkType {
// 未知
LINK_TYPE_UNKNOWN = 0;
// 番剧
LINK_TYPE_BANGUMI = 1;
// 视频
LINK_TYPE_VIDEO = 2;
// 直播
LINK_TYPE_LIVE = 3;
}
//
message TargetResource {
//直播: roomid
//UGC: avid
//PGC: seasonid
//Story: avid
//举个例子
//Type: LINK_TYPE_BANGUMI (番剧)
//Resource: {"seasonid":"123"}
//
//Type: LINK_TYPE_VIDEO (视频)
//Resource: {"avid":"123"}
//
//Type: LINK_TYPE_LIVE (直播)
//Resource: {"roomid":"123"}
//
LinkType Type = 1;
//
map<string,string> Resource = 2;
}

View File

@@ -0,0 +1,72 @@
syntax = "proto3";
package bilibili.broadcast.v1;
import "bilibili/rpc/status.proto";
import "google/protobuf/any.proto";
//
service BroadcastRoom {
//
rpc Enter(stream RoomReq) returns (stream RoomResp);
}
//
message RoomJoinEvent {}
//
message RoomLeaveEvent {}
//
message RoomOnlineEvent {
//
int32 online = 1;
}
//
message RoomMessageEvent {
//
string target_path = 1;
//
google.protobuf.Any body = 2;
}
//
message RoomErrorEvent {
//
bilibili.rpc.Status status = 1;
}
//
message RoomReq {
// {type}://{room_id}
string id = 1;
oneof event {
//
RoomJoinEvent join = 2;
//
RoomLeaveEvent leave = 3;
//
RoomOnlineEvent online = 4;
//
RoomMessageEvent msg = 5;
}
}
//
message RoomResp {
// {type}://{room_id}
string id = 1;
oneof event {
//
RoomJoinEvent join = 2;
//
RoomLeaveEvent leave = 3;
//
RoomOnlineEvent online = 4;
//
RoomMessageEvent msg = 5;
//
RoomErrorEvent err = 6;
}
}

View File

@@ -0,0 +1,26 @@
syntax = "proto3";
package bilibili.broadcast.v1;
import "google/protobuf/any.proto";
import "google/protobuf/empty.proto";
// 服务端下发的测试专用消息客户端debug/release包都会通过弹窗响应该消息
// 后端平台 必须 限制该消息只能针对单个用户发送
// Test
service Test {
// 监听上报事件
rpc WatchTestEvent(google.protobuf.Empty) returns (stream TestResp);
}
message TestResp {
// 任务id
int64 taskid = 1 [json_name="taskid"];
// 时间戳
int64 timestamp = 2 [json_name="timestamp"];
// 消息
string message = 3 [json_name="message"];
// 扩展
google.protobuf.Any extra = 4;
}