修改协议
This commit is contained in:
60
cmd.pb.go
60
cmd.pb.go
@@ -908,10 +908,10 @@ func (x *FlagWithExpire) GetExpire() uint32 {
|
||||
// ColumnWrite 全量列式写入命令
|
||||
type ColumnWrite struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
IsClearAllFirst bool `protobuf:"varint,1,opt,name=is_clear_all_first,json=isClearAllFirst,proto3" json:"is_clear_all_first,omitempty"` // 是否先执行清空
|
||||
WriteBytes *Bytes `protobuf:"bytes,2,opt,name=write_bytes,json=writeBytes,proto3" json:"write_bytes,omitempty"` // byte区域
|
||||
WriteUint32S *Uint32S `protobuf:"bytes,3,opt,name=write_uint32s,json=writeUint32s,proto3" json:"write_uint32s,omitempty"` // uint32区域
|
||||
WriteFlagsWithExpire *FlagsWithExpire `protobuf:"bytes,4,opt,name=write_flags_with_expire,json=writeFlagsWithExpire,proto3" json:"write_flags_with_expire,omitempty"` // 标志位区域
|
||||
IsClearAllFirst bool `protobuf:"varint,5,opt,name=is_clear_all_first,json=isClearAllFirst,proto3" json:"is_clear_all_first,omitempty"` // 是否先执行清空
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@@ -946,6 +946,13 @@ func (*ColumnWrite) Descriptor() ([]byte, []int) {
|
||||
return file_cmd_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *ColumnWrite) GetIsClearAllFirst() bool {
|
||||
if x != nil {
|
||||
return x.IsClearAllFirst
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *ColumnWrite) GetWriteBytes() *Bytes {
|
||||
if x != nil {
|
||||
return x.WriteBytes
|
||||
@@ -967,13 +974,6 @@ func (x *ColumnWrite) GetWriteFlagsWithExpire() *FlagsWithExpire {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ColumnWrite) GetIsClearAllFirst() bool {
|
||||
if x != nil {
|
||||
return x.IsClearAllFirst
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type Task struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
TaskSha256 string `protobuf:"bytes,1,opt,name=task_sha256,json=taskSha256,proto3" json:"task_sha256,omitempty"` // 任务sha256
|
||||
@@ -1387,8 +1387,8 @@ type SaasRes struct {
|
||||
// *SaasRes_TaskCreateRes
|
||||
// *SaasRes_TaskListRes
|
||||
// *SaasRes_TaskRunRes
|
||||
// *SaasRes_TaskInfoRes
|
||||
// *SaasRes_TaskDeleteRes
|
||||
// *SaasRes_TaskInfoRes
|
||||
Res isSaasRes_Res `protobuf_oneof:"res"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -1490,19 +1490,19 @@ func (x *SaasRes) GetTaskRunRes() *Task {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *SaasRes) GetTaskInfoRes() *Task {
|
||||
func (x *SaasRes) GetTaskDeleteRes() *Task {
|
||||
if x != nil {
|
||||
if x, ok := x.Res.(*SaasRes_TaskInfoRes); ok {
|
||||
return x.TaskInfoRes
|
||||
if x, ok := x.Res.(*SaasRes_TaskDeleteRes); ok {
|
||||
return x.TaskDeleteRes
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *SaasRes) GetTaskDeleteRes() *Task {
|
||||
func (x *SaasRes) GetTaskInfoRes() *Task {
|
||||
if x != nil {
|
||||
if x, ok := x.Res.(*SaasRes_TaskDeleteRes); ok {
|
||||
return x.TaskDeleteRes
|
||||
if x, ok := x.Res.(*SaasRes_TaskInfoRes); ok {
|
||||
return x.TaskInfoRes
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -1532,12 +1532,12 @@ type SaasRes_TaskRunRes struct {
|
||||
TaskRunRes *Task `protobuf:"bytes,22,opt,name=task_run_res,json=taskRunRes,proto3,oneof"` // 运行任务返回状态
|
||||
}
|
||||
|
||||
type SaasRes_TaskInfoRes struct {
|
||||
TaskInfoRes *Task `protobuf:"bytes,23,opt,name=task_info_res,json=taskInfoRes,proto3,oneof"` // 任务详情返回状态
|
||||
type SaasRes_TaskDeleteRes struct {
|
||||
TaskDeleteRes *Task `protobuf:"bytes,23,opt,name=task_delete_res,json=taskDeleteRes,proto3,oneof"` // 删除任务返回状态
|
||||
}
|
||||
|
||||
type SaasRes_TaskDeleteRes struct {
|
||||
TaskDeleteRes *Task `protobuf:"bytes,24,opt,name=task_delete_res,json=taskDeleteRes,proto3,oneof"` // 删除任务返回状态
|
||||
type SaasRes_TaskInfoRes struct {
|
||||
TaskInfoRes *Task `protobuf:"bytes,24,opt,name=task_info_res,json=taskInfoRes,proto3,oneof"` // 任务详情返回状态
|
||||
}
|
||||
|
||||
func (*SaasRes_ReadRes) isSaasRes_Res() {}
|
||||
@@ -1550,10 +1550,10 @@ func (*SaasRes_TaskListRes) isSaasRes_Res() {}
|
||||
|
||||
func (*SaasRes_TaskRunRes) isSaasRes_Res() {}
|
||||
|
||||
func (*SaasRes_TaskInfoRes) isSaasRes_Res() {}
|
||||
|
||||
func (*SaasRes_TaskDeleteRes) isSaasRes_Res() {}
|
||||
|
||||
func (*SaasRes_TaskInfoRes) isSaasRes_Res() {}
|
||||
|
||||
type ReadRes struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
SuccCmdCount uint32 `protobuf:"varint,1,opt,name=succ_cmd_count,json=succCmdCount,proto3" json:"succ_cmd_count,omitempty"` // 成功的命令数量
|
||||
@@ -1853,12 +1853,12 @@ const file_cmd_proto_rawDesc = "" +
|
||||
"\x04flag\x18\x01 \x01(\bR\x04flag\x12!\n" +
|
||||
"\fdefault_flag\x18\x02 \x01(\bR\vdefaultFlag\x12\x16\n" +
|
||||
"\x06expire\x18\x03 \x01(\rR\x06expire\"\xf3\x01\n" +
|
||||
"\vColumnWrite\x12/\n" +
|
||||
"\vColumnWrite\x12+\n" +
|
||||
"\x12is_clear_all_first\x18\x01 \x01(\bR\x0fisClearAllFirst\x12/\n" +
|
||||
"\vwrite_bytes\x18\x02 \x01(\v2\x0e.saasapi.BytesR\n" +
|
||||
"writeBytes\x125\n" +
|
||||
"\rwrite_uint32s\x18\x03 \x01(\v2\x10.saasapi.Uint32sR\fwriteUint32s\x12O\n" +
|
||||
"\x17write_flags_with_expire\x18\x04 \x01(\v2\x18.saasapi.FlagsWithExpireR\x14writeFlagsWithExpire\x12+\n" +
|
||||
"\x12is_clear_all_first\x18\x05 \x01(\bR\x0fisClearAllFirst\"\xbf\x02\n" +
|
||||
"\x17write_flags_with_expire\x18\x04 \x01(\v2\x18.saasapi.FlagsWithExpireR\x14writeFlagsWithExpire\"\xbf\x02\n" +
|
||||
"\x04Task\x12\x1f\n" +
|
||||
"\vtask_sha256\x18\x01 \x01(\tR\n" +
|
||||
"taskSha256\x12)\n" +
|
||||
@@ -1902,9 +1902,9 @@ const file_cmd_proto_rawDesc = "" +
|
||||
"\x0ftask_create_res\x18\x14 \x01(\v2\r.saasapi.TaskH\x00R\rtaskCreateRes\x12:\n" +
|
||||
"\rtask_list_res\x18\x15 \x01(\v2\x14.saasapi.TaskListResH\x00R\vtaskListRes\x121\n" +
|
||||
"\ftask_run_res\x18\x16 \x01(\v2\r.saasapi.TaskH\x00R\n" +
|
||||
"taskRunRes\x123\n" +
|
||||
"\rtask_info_res\x18\x17 \x01(\v2\r.saasapi.TaskH\x00R\vtaskInfoRes\x127\n" +
|
||||
"\x0ftask_delete_res\x18\x18 \x01(\v2\r.saasapi.TaskH\x00R\rtaskDeleteResB\x05\n" +
|
||||
"taskRunRes\x127\n" +
|
||||
"\x0ftask_delete_res\x18\x17 \x01(\v2\r.saasapi.TaskH\x00R\rtaskDeleteRes\x123\n" +
|
||||
"\rtask_info_res\x18\x18 \x01(\v2\r.saasapi.TaskH\x00R\vtaskInfoResB\x05\n" +
|
||||
"\x03res\"\x82\x01\n" +
|
||||
"\aReadRes\x12$\n" +
|
||||
"\x0esucc_cmd_count\x18\x01 \x01(\rR\fsuccCmdCount\x12$\n" +
|
||||
@@ -2034,8 +2034,8 @@ var file_cmd_proto_depIdxs = []int32{
|
||||
14, // 25: saasapi.SaasRes.task_create_res:type_name -> saasapi.Task
|
||||
25, // 26: saasapi.SaasRes.task_list_res:type_name -> saasapi.TaskListRes
|
||||
14, // 27: saasapi.SaasRes.task_run_res:type_name -> saasapi.Task
|
||||
14, // 28: saasapi.SaasRes.task_info_res:type_name -> saasapi.Task
|
||||
14, // 29: saasapi.SaasRes.task_delete_res:type_name -> saasapi.Task
|
||||
14, // 28: saasapi.SaasRes.task_delete_res:type_name -> saasapi.Task
|
||||
14, // 29: saasapi.SaasRes.task_info_res:type_name -> saasapi.Task
|
||||
24, // 30: saasapi.ReadRes.cmd_res:type_name -> saasapi.ValueItem
|
||||
24, // 31: saasapi.WriteRes.cmd_res:type_name -> saasapi.ValueItem
|
||||
2, // 32: saasapi.ValueItem.cmd_code:type_name -> saasapi.CmdErrorCode
|
||||
@@ -2069,8 +2069,8 @@ func file_cmd_proto_init() {
|
||||
(*SaasRes_TaskCreateRes)(nil),
|
||||
(*SaasRes_TaskListRes)(nil),
|
||||
(*SaasRes_TaskRunRes)(nil),
|
||||
(*SaasRes_TaskInfoRes)(nil),
|
||||
(*SaasRes_TaskDeleteRes)(nil),
|
||||
(*SaasRes_TaskInfoRes)(nil),
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
|
||||
10
cmd.proto
10
cmd.proto
@@ -57,7 +57,7 @@ message Bytes {
|
||||
message Uint32s {
|
||||
repeated uint32 uint32s = 1; // 写入的uint32
|
||||
uint64 index_1 = 2; // 写入uint32的索引值(0..15) 最多 16 个
|
||||
//uint64 index_2 = 3; // 写入uint32的索引值(64..127)(当前不支持)
|
||||
//uint64 index_2 = 3; // 写入uint32的索引值(当前不支持)
|
||||
}
|
||||
|
||||
// FlagsWithExpire 写入标志位区域
|
||||
@@ -82,10 +82,10 @@ enum UserIdType {
|
||||
|
||||
// ColumnWrite 全量列式写入命令
|
||||
message ColumnWrite {
|
||||
bool is_clear_all_first = 1; // 是否先执行清空
|
||||
Bytes write_bytes = 2; // byte区域
|
||||
Uint32s write_uint32s = 3; // uint32区域
|
||||
FlagsWithExpire write_flags_with_expire = 4; // 标志位区域
|
||||
bool is_clear_all_first = 5; // 是否先执行清空
|
||||
}
|
||||
|
||||
message Task {
|
||||
@@ -131,7 +131,7 @@ message FileInfo {
|
||||
message FileBlock {
|
||||
string block_sha256 = 1; // 块的sha256
|
||||
uint64 block_length = 2; // 块的字节长度
|
||||
bool uploaded = 3; // 是否已上传(在TaskInfo请求返回)
|
||||
bool uploaded = 3; // 是否已上传(在TaskCreate/TaskInfo请求返回)
|
||||
}
|
||||
|
||||
// SaasRes 命令返回
|
||||
@@ -145,8 +145,8 @@ message SaasRes {
|
||||
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; // 删除任务返回状态
|
||||
Task task_delete_res = 23; // 删除任务返回状态
|
||||
Task task_info_res = 24; // 任务详情返回状态
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,11 +37,12 @@ const taskUsage = `
|
||||
Usage: saastoola task COMMAND [OPTIONS]
|
||||
|
||||
Commands:
|
||||
create
|
||||
upload Read user's 'bytes / uint32s / flags'
|
||||
run
|
||||
delete
|
||||
info
|
||||
create Create data file to task
|
||||
list List tasks on server
|
||||
run Run task on server
|
||||
delete Delete task on server
|
||||
info Get task info on server
|
||||
upload Upload file block to server
|
||||
|
||||
"help" is the default command.
|
||||
|
||||
|
||||
7
go.mod
7
go.mod
@@ -4,12 +4,7 @@ go 1.23.4
|
||||
|
||||
require (
|
||||
github.com/BurntSushi/toml v1.5.0
|
||||
github.com/jroimartin/gocui v0.5.0
|
||||
google.golang.org/protobuf v1.36.5
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.9 // indirect
|
||||
github.com/nsf/termbox-go v1.1.1 // indirect
|
||||
)
|
||||
require github.com/google/go-cmp v0.6.0 // indirect
|
||||
|
||||
6
go.sum
6
go.sum
@@ -2,11 +2,5 @@ github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg
|
||||
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/jroimartin/gocui v0.5.0 h1:DCZc97zY9dMnHXJSJLLmx9VqiEnAj0yh0eTNpuEtG/4=
|
||||
github.com/jroimartin/gocui v0.5.0/go.mod h1:l7Hz8DoYoL6NoYnlnaX6XCNR62G7J5FfSW5jEogzaxE=
|
||||
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
|
||||
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/nsf/termbox-go v1.1.1 h1:nksUPLCb73Q++DwbYUBEglYBRPZyoXJdrj5L+TkjyZY=
|
||||
github.com/nsf/termbox-go v1.1.1/go.mod h1:T0cTdVuOwf7pHQNtfhnEbzHbcNyCEcVU4YPpouCbVxo=
|
||||
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
|
||||
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
|
||||
@@ -99,10 +99,10 @@ func (c *SaasClient) post(url string, saasReq *saasapi.SaasReq) (saasRes *saasap
|
||||
md5byte := md5.Sum([]byte(c.Auth.Account + c.Auth.Token + timeStamp))
|
||||
authorization := hex.EncodeToString(md5byte[:])
|
||||
|
||||
req.Header.Add("Content-Type", "application/protobuf")
|
||||
req.Header.Add("Account", c.Auth.Account)
|
||||
req.Header.Add("Time", timeStamp)
|
||||
req.Header.Add("Authorization", authorization)
|
||||
req.Header.Add("Content-Type", "application/x-protobuf")
|
||||
res, err := c.Client.Do(req)
|
||||
if err != nil {
|
||||
fmt.Println("http send error", err)
|
||||
|
||||
Reference in New Issue
Block a user