增加命令功能
This commit is contained in:
194
cmd.proto
194
cmd.proto
@@ -6,76 +6,78 @@ option go_package = "e.coding.net/rta/public/saasapi";
|
||||
|
||||
// SaasReq 命令请求
|
||||
message SaasReq {
|
||||
UserIdType userid_type = 1; // 用户ID类型
|
||||
string appid = 2; // 小程序/小游戏/公众号/视频号的appid
|
||||
UserIdType userid_type = 1; // 用户ID类型
|
||||
string appid = 2; // 小程序/小游戏/公众号/视频号的appid
|
||||
|
||||
oneof cmd {
|
||||
Write write = 10; // 批量写入
|
||||
Read read = 11; // 批量读取
|
||||
ColumnWrite column_write = 12; // 全量列式写入
|
||||
Read read = 10; // 批量读取
|
||||
Write write = 11; // 批量写入
|
||||
ColumnWrite column_write = 12; // 全量列式写入
|
||||
|
||||
TaskList task_list = 20; // 任务列表
|
||||
TaskCancel task_cancel = 21; // 取消任务
|
||||
TaskDetail task_detail = 22; // 任务详情
|
||||
Task task_create = 20; // 任务创建
|
||||
TaskList task_list = 21; // 列出任务
|
||||
TaskRun task_run = 22; // 执行任务
|
||||
TaskDelete task_delete = 23; // 删除任务
|
||||
TaskInfo task_info = 24; // 任务详情
|
||||
}
|
||||
}
|
||||
|
||||
// Read 批量读取命令
|
||||
message Read {
|
||||
repeated ReadItem read_items = 1; // 批量获取命令
|
||||
}
|
||||
|
||||
// ReadItem 读取命令
|
||||
message ReadItem {
|
||||
string userid = 1; // 用户ID
|
||||
}
|
||||
|
||||
// Write 批量写入命令
|
||||
message Write {
|
||||
bool async = 1; // 是否异步执行
|
||||
bool is_clear_all_first = 2; // 是否先执行清空
|
||||
repeated WriteCmd write_cmds = 3; // 批量写入命令
|
||||
bool is_clear_all_first = 1; // 是否先清空该用户所有数据
|
||||
repeated WriteItem write_items = 2; // 批量写入命令
|
||||
}
|
||||
|
||||
// WriteCmd 写入命令
|
||||
message WriteCmd {
|
||||
string userid = 1; // 用户ID
|
||||
Bytes write_bytes = 2; // byte区域
|
||||
Uint32s write_uint32s = 3; // uint32区域
|
||||
FlagsWithExpire write_flags_with_expire = 4; // 标志位区域
|
||||
// WriteItem 写入命令
|
||||
message WriteItem {
|
||||
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)
|
||||
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)(当前不支持)
|
||||
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; // 写入标志位的索引值
|
||||
repeated FlagWithExpire flags_with_expire = 1; // 写入的标志位
|
||||
uint64 index_1 = 2; // 写入标志位的索引值
|
||||
}
|
||||
|
||||
// FlagWithExpire 标志位
|
||||
message FlagWithExpire {
|
||||
bool flag = 1; // 标志位
|
||||
bool default_flag = 2; // 默认值。超时后则回到默认值。
|
||||
uint32 expire = 3; // 过期时间,为 0 则永不过期
|
||||
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
|
||||
DEVICEID = 0; // 设备号
|
||||
OPENID = 1; // OpenId
|
||||
INNERID1 = 10; // 内部ID1
|
||||
}
|
||||
|
||||
// ColumnWrite 全量列式写入命令
|
||||
@@ -86,32 +88,82 @@ message ColumnWrite {
|
||||
bool is_clear_all_first = 5; // 是否先执行清空
|
||||
}
|
||||
|
||||
message Task {
|
||||
string task_sha256 = 1; // 任务sha256
|
||||
string task_description = 2; // 任务描述
|
||||
repeated FileInfo task_file_infos = 3; // 文件列表
|
||||
uint64 task_block_size = 4; // 文件块字节大小(推荐50M)
|
||||
|
||||
// 以下字段只在返回时填写,用于提供服务端的任务状态。在请求时填写会被忽略
|
||||
string create_time = 10; // 创建时间
|
||||
string run_time = 11; // 运行时间
|
||||
string finish_time = 12; // 完成时间
|
||||
|
||||
TaskStatus status = 15; // 任务状态
|
||||
}
|
||||
|
||||
// TaskList 任务列表
|
||||
message TaskList {
|
||||
|
||||
TaskStatus status_filter = 1; // 只显示指定状态的任务
|
||||
}
|
||||
|
||||
// TaskCancel 取消任务
|
||||
message TaskCancel {
|
||||
|
||||
// TaskRun 任务运行
|
||||
message TaskRun {
|
||||
string task_sha256 = 1; // 任务sha256
|
||||
}
|
||||
|
||||
// TaskDetail 任务详情
|
||||
message TaskDetail {
|
||||
// TaskDelete 取消任务
|
||||
message TaskDelete {
|
||||
string task_sha256 = 1; // 任务sha256
|
||||
}
|
||||
|
||||
// TaskInfo 任务详情
|
||||
message TaskInfo {
|
||||
string task_sha256 = 1; // 任务sha256
|
||||
}
|
||||
|
||||
message FileInfo {
|
||||
string file_name = 1; // 文件名
|
||||
uint64 file_size = 2; // 文件大小
|
||||
repeated FileBlock file_blocks = 3; // 文件块列表
|
||||
}
|
||||
|
||||
message FileBlock {
|
||||
string block_sha256 = 1; // 块的sha256
|
||||
uint64 block_length = 2; // 块的字节长度
|
||||
bool uploaded = 3; // 是否已上传(在TaskInfo请求返回)
|
||||
}
|
||||
|
||||
// SaasRes 命令返回
|
||||
message SaasRes {
|
||||
ErrorCode code = 1; // 返回码
|
||||
string status = 2; // 返回信息的文本提示
|
||||
uint32 succ_cmd_count = 3; // 成功的命令数量
|
||||
uint32 fail_cmd_count = 4; // 失败的命令数量
|
||||
repeated CmdsResItem cmd_res = 5; // 返回的命令
|
||||
oneof res {
|
||||
ReadRes read_res = 10; // 读取命令返回
|
||||
WriteRes write_res = 11; // 写入命令返回
|
||||
|
||||
Task task_create_res = 20; // 创建任务返回状态
|
||||
TaskListRes task_list_res = 21; // 任务列表返回状态
|
||||
Task task_run_res = 22; // 运行任务返回状态
|
||||
Task task_info_res = 23; // 任务详情返回状态
|
||||
Task task_delete_res = 24; // 删除任务返回状态
|
||||
}
|
||||
}
|
||||
|
||||
// CmdsResItem 读取命令返回内容
|
||||
message CmdsResItem {
|
||||
message ReadRes {
|
||||
uint32 succ_cmd_count = 1; // 成功的命令数量
|
||||
uint32 fail_cmd_count = 2; // 失败的命令数量
|
||||
repeated ValueItem cmd_res = 3; // 返回的命令
|
||||
}
|
||||
|
||||
message WriteRes {
|
||||
uint32 succ_cmd_count = 1; // 成功的命令数量
|
||||
uint32 fail_cmd_count = 2; // 失败的命令数量
|
||||
repeated ValueItem cmd_res = 3; // 返回的失败命令,仅填写cmd_index和cmd_code
|
||||
}
|
||||
|
||||
// ValueItem 读取命令返回内容
|
||||
message ValueItem {
|
||||
uint32 cmd_index = 1; // 命令索引
|
||||
CmdErrorCode cmd_code = 2; // 状态
|
||||
bytes bytes = 3; // byte区域
|
||||
@@ -120,24 +172,46 @@ message CmdsResItem {
|
||||
uint32 last_modify_time = 6; // 最后修改时间
|
||||
}
|
||||
|
||||
message TaskListRes {
|
||||
repeated Task tasks = 1; // 任务列表
|
||||
}
|
||||
|
||||
// ErrorCode 返回码
|
||||
enum ErrorCode {
|
||||
SUCC = 0; // 成功
|
||||
SUCC = 0; // 成功
|
||||
INVALID_ACCOUNT = 101; // Account不合法
|
||||
INVALID_TIMESTAMP = 102; // 头信息缺少时间戳
|
||||
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; // 命令数量超限
|
||||
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; // 命令为空
|
||||
|
||||
TASK_EXISTS = 120; // 任务已存在
|
||||
TASK_IS_NOT_EXISTS = 121; // 任务不存在
|
||||
TASK_NUM_LIMIT = 122; // 任务数达到上限
|
||||
TASK_BLOCK_SIZE = 123; // 块大小超限
|
||||
TASK_TOTAL_SIZE = 124; // 总文件大小超限
|
||||
TASK_MARSHAL = 125; // 序列化
|
||||
|
||||
DATA_ERROR = 201; // 数据错误
|
||||
}
|
||||
|
||||
enum CmdErrorCode {
|
||||
OK = 0; // 成功
|
||||
}
|
||||
|
||||
enum TaskStatus {
|
||||
ALL = 0; // 全部
|
||||
WAITING = 1; // 等待中
|
||||
RUNNING = 2; // 运行中
|
||||
SUCCESS = 3; // 成功
|
||||
FAIL = 4; // 失败
|
||||
|
||||
DELETED = 5; // 已删除,仅在执行删除成功时返回
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user