144 lines
5.3 KiB
Protocol Buffer
144 lines
5.3 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package saasapi;
|
|
|
|
option go_package = "e.coding.net/rta/public/saasapi";
|
|
|
|
// SaasReq 命令请求
|
|
message SaasReq {
|
|
UserIdType userid_type = 1; // 用户ID类型
|
|
string appid = 2; // 小程序/小游戏/公众号/视频号的appid
|
|
|
|
oneof cmd {
|
|
Write write = 10; // 批量写入
|
|
Read read = 11; // 批量读取
|
|
ColumnWrite column_write = 12; // 全量列式写入
|
|
|
|
TaskList task_list = 20; // 任务列表
|
|
TaskCancel task_cancel = 21; // 取消任务
|
|
TaskDetail task_detail = 22; // 任务详情
|
|
}
|
|
}
|
|
|
|
// Write 批量写入命令
|
|
message Write {
|
|
bool async = 1; // 是否异步执行
|
|
bool is_clear_all_first = 2; // 是否先执行清空
|
|
repeated WriteCmd write_cmds = 3; // 批量写入命令
|
|
}
|
|
|
|
// WriteCmd 写入命令
|
|
message WriteCmd {
|
|
string userid = 1; // 用户ID
|
|
Bytes write_bytes = 2; // byte区域
|
|
Uint32s write_uint32s = 3; // uint32区域
|
|
FlagsWithExpire write_flags_with_expire = 4; // 标志位区域
|
|
}
|
|
|
|
// Bytes 写入byte区域
|
|
message Bytes {
|
|
bytes bytes = 1; // 写入的byte
|
|
uint64 index_1 = 2; // 写入byte的索引值(0..63)
|
|
uint64 index_2 = 3; // 写入byte的索引值(64..127)
|
|
}
|
|
|
|
// Uint32s 写入uint32区域
|
|
message Uint32s {
|
|
repeated uint32 uint32s = 1; // 写入的uint32
|
|
uint64 index_1 = 2; // 写入uint32的索引值(0..15) 最多 16 个
|
|
//uint64 index_2 = 3; // 写入uint32的索引值(64..127)(当前不支持)
|
|
}
|
|
|
|
// FlagsWithExpire 写入标志位区域
|
|
message FlagsWithExpire {
|
|
repeated FlagWithExpire flags_with_expire = 1; // 写入的标志位
|
|
uint64 index_1 = 2; // 写入标志位的索引值
|
|
}
|
|
|
|
// FlagWithExpire 标志位
|
|
message FlagWithExpire {
|
|
bool flag = 1; // 标志位
|
|
bool default_flag = 2; // 默认值。超时后则回到默认值。
|
|
uint32 expire = 3; // 过期时间,为 0 则永不过期
|
|
}
|
|
|
|
// UserIdType 用户 ID 类型
|
|
enum UserIdType {
|
|
DEVICEID = 0; // 设备号
|
|
OPENID = 1; // OpenId
|
|
}
|
|
|
|
// Write 批量读取命令
|
|
message Read {
|
|
repeated ReadCmd read_cmds = 1; // 批量获取命令
|
|
}
|
|
|
|
// WriteCmd 读取命令
|
|
message ReadCmd {
|
|
string userid = 1; // 用户ID
|
|
}
|
|
|
|
// ColumnWrite 全量列式写入命令
|
|
message ColumnWrite {
|
|
Bytes write_bytes = 2; // byte区域
|
|
Uint32s write_uint32s = 3; // uint32区域
|
|
FlagsWithExpire write_flags_with_expire = 4; // 标志位区域
|
|
bool is_clear_all_first = 5; // 是否先执行清空
|
|
}
|
|
|
|
// TaskList 任务列表
|
|
message TaskList {
|
|
|
|
}
|
|
|
|
// TaskCancel 取消任务
|
|
message TaskCancel {
|
|
|
|
}
|
|
|
|
// TaskDetail 任务详情
|
|
message TaskDetail {
|
|
|
|
}
|
|
|
|
// SaasRes 命令返回
|
|
message SaasRes {
|
|
ErrorCode code = 1; // 返回码
|
|
string status = 2; // 返回信息的文本提示
|
|
uint32 succ_cmd_count = 3; // 成功的命令数量
|
|
uint32 fail_cmd_count = 4; // 失败的命令数量
|
|
repeated CmdsResItem cmd_res = 5; // 返回的命令
|
|
}
|
|
|
|
// CmdsResItem 读取命令返回内容
|
|
message CmdsResItem {
|
|
uint32 cmd_index = 1; // 命令索引
|
|
CmdErrorCode cmd_code = 2; // 状态
|
|
bytes bytes = 3; // byte区域
|
|
repeated uint32 uint32s = 4; // uint32区域
|
|
repeated FlagWithExpire flags_with_expire = 5; // 标志位区域
|
|
uint32 last_modify_time = 6; // 最后修改时间
|
|
}
|
|
|
|
// ErrorCode 返回码
|
|
enum ErrorCode {
|
|
SUCC = 0; // 成功
|
|
INVALID_ACCOUNT = 101; // Account不合法
|
|
INVALID_TIMESTAMP = 102; // 头信息缺少时间戳
|
|
INVALID_SIGNATURE = 103; // 头信息缺少签名
|
|
AUTH_FAIL = 104; // 签名较验失败
|
|
DISABLED_ACCOUNT = 105; // 账号已禁用
|
|
INVALID_CONTENT_TYPE = 110; // 非法的Content-Type
|
|
READ_BODY = 111; // 读取 http body 失败
|
|
DECODE_BODY = 112; // 解码 body 失败
|
|
QPS_LIMIT = 113; // 并发请求量超限
|
|
CMDS_LIMIT = 114; // 命令数量超限
|
|
CMDS_NULL = 115; // 命令为空
|
|
}
|
|
|
|
enum CmdErrorCode {
|
|
OK = 0; // 成功
|
|
}
|
|
|
|
|