支持dataspace
This commit is contained in:
456
cmd.pb.go
456
cmd.pb.go
@@ -21,103 +21,6 @@ const (
|
|||||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserIdType 用户 ID 类型
|
|
||||||
type UserIdType int32
|
|
||||||
|
|
||||||
const (
|
|
||||||
UserIdType_DEVICEID UserIdType = 0 // 设备号
|
|
||||||
UserIdType_OPENID UserIdType = 1 // OpenId
|
|
||||||
UserIdType_INNERID1 UserIdType = 10 // 内部ID1
|
|
||||||
)
|
|
||||||
|
|
||||||
// Enum value maps for UserIdType.
|
|
||||||
var (
|
|
||||||
UserIdType_name = map[int32]string{
|
|
||||||
0: "DEVICEID",
|
|
||||||
1: "OPENID",
|
|
||||||
10: "INNERID1",
|
|
||||||
}
|
|
||||||
UserIdType_value = map[string]int32{
|
|
||||||
"DEVICEID": 0,
|
|
||||||
"OPENID": 1,
|
|
||||||
"INNERID1": 10,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func (x UserIdType) Enum() *UserIdType {
|
|
||||||
p := new(UserIdType)
|
|
||||||
*p = x
|
|
||||||
return p
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x UserIdType) String() string {
|
|
||||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (UserIdType) Descriptor() protoreflect.EnumDescriptor {
|
|
||||||
return file_cmd_proto_enumTypes[0].Descriptor()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (UserIdType) Type() protoreflect.EnumType {
|
|
||||||
return &file_cmd_proto_enumTypes[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x UserIdType) Number() protoreflect.EnumNumber {
|
|
||||||
return protoreflect.EnumNumber(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use UserIdType.Descriptor instead.
|
|
||||||
func (UserIdType) EnumDescriptor() ([]byte, []int) {
|
|
||||||
return file_cmd_proto_rawDescGZIP(), []int{0}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NameSpaceId 用户 ID 类型
|
|
||||||
type NameSpaceId int32
|
|
||||||
|
|
||||||
const (
|
|
||||||
NameSpaceId_DID NameSpaceId = 0 // 默认设备号命名空间
|
|
||||||
NameSpaceId_WUID NameSpaceId = 1 // 默认WUID命名空间
|
|
||||||
)
|
|
||||||
|
|
||||||
// Enum value maps for NameSpaceId.
|
|
||||||
var (
|
|
||||||
NameSpaceId_name = map[int32]string{
|
|
||||||
0: "DID",
|
|
||||||
1: "WUID",
|
|
||||||
}
|
|
||||||
NameSpaceId_value = map[string]int32{
|
|
||||||
"DID": 0,
|
|
||||||
"WUID": 1,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func (x NameSpaceId) Enum() *NameSpaceId {
|
|
||||||
p := new(NameSpaceId)
|
|
||||||
*p = x
|
|
||||||
return p
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x NameSpaceId) String() string {
|
|
||||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (NameSpaceId) Descriptor() protoreflect.EnumDescriptor {
|
|
||||||
return file_cmd_proto_enumTypes[1].Descriptor()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (NameSpaceId) Type() protoreflect.EnumType {
|
|
||||||
return &file_cmd_proto_enumTypes[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x NameSpaceId) Number() protoreflect.EnumNumber {
|
|
||||||
return protoreflect.EnumNumber(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use NameSpaceId.Descriptor instead.
|
|
||||||
func (NameSpaceId) EnumDescriptor() ([]byte, []int) {
|
|
||||||
return file_cmd_proto_rawDescGZIP(), []int{1}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ErrorCode 返回码
|
// ErrorCode 返回码
|
||||||
type ErrorCode int32
|
type ErrorCode int32
|
||||||
|
|
||||||
@@ -134,6 +37,7 @@ const (
|
|||||||
ErrorCode_QPS_LIMIT ErrorCode = 113 // 并发请求量超限
|
ErrorCode_QPS_LIMIT ErrorCode = 113 // 并发请求量超限
|
||||||
ErrorCode_CMDS_LIMIT ErrorCode = 114 // 命令数量超限
|
ErrorCode_CMDS_LIMIT ErrorCode = 114 // 命令数量超限
|
||||||
ErrorCode_CMDS_NULL ErrorCode = 115 // 命令为空
|
ErrorCode_CMDS_NULL ErrorCode = 115 // 命令为空
|
||||||
|
ErrorCode_DATASPACE_NOT_EXISTS ErrorCode = 116 // 数据空间不存在
|
||||||
ErrorCode_TASK_EXISTS ErrorCode = 120 // 任务已存在
|
ErrorCode_TASK_EXISTS ErrorCode = 120 // 任务已存在
|
||||||
ErrorCode_TASK_IS_NOT_EXISTS ErrorCode = 121 // 任务不存在
|
ErrorCode_TASK_IS_NOT_EXISTS ErrorCode = 121 // 任务不存在
|
||||||
ErrorCode_TASK_NUM_LIMIT ErrorCode = 122 // 任务数达到上限
|
ErrorCode_TASK_NUM_LIMIT ErrorCode = 122 // 任务数达到上限
|
||||||
@@ -163,6 +67,7 @@ var (
|
|||||||
113: "QPS_LIMIT",
|
113: "QPS_LIMIT",
|
||||||
114: "CMDS_LIMIT",
|
114: "CMDS_LIMIT",
|
||||||
115: "CMDS_NULL",
|
115: "CMDS_NULL",
|
||||||
|
116: "DATASPACE_NOT_EXISTS",
|
||||||
120: "TASK_EXISTS",
|
120: "TASK_EXISTS",
|
||||||
121: "TASK_IS_NOT_EXISTS",
|
121: "TASK_IS_NOT_EXISTS",
|
||||||
122: "TASK_NUM_LIMIT",
|
122: "TASK_NUM_LIMIT",
|
||||||
@@ -189,6 +94,7 @@ var (
|
|||||||
"QPS_LIMIT": 113,
|
"QPS_LIMIT": 113,
|
||||||
"CMDS_LIMIT": 114,
|
"CMDS_LIMIT": 114,
|
||||||
"CMDS_NULL": 115,
|
"CMDS_NULL": 115,
|
||||||
|
"DATASPACE_NOT_EXISTS": 116,
|
||||||
"TASK_EXISTS": 120,
|
"TASK_EXISTS": 120,
|
||||||
"TASK_IS_NOT_EXISTS": 121,
|
"TASK_IS_NOT_EXISTS": 121,
|
||||||
"TASK_NUM_LIMIT": 122,
|
"TASK_NUM_LIMIT": 122,
|
||||||
@@ -215,11 +121,11 @@ func (x ErrorCode) String() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ErrorCode) Descriptor() protoreflect.EnumDescriptor {
|
func (ErrorCode) Descriptor() protoreflect.EnumDescriptor {
|
||||||
return file_cmd_proto_enumTypes[2].Descriptor()
|
return file_cmd_proto_enumTypes[0].Descriptor()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ErrorCode) Type() protoreflect.EnumType {
|
func (ErrorCode) Type() protoreflect.EnumType {
|
||||||
return &file_cmd_proto_enumTypes[2]
|
return &file_cmd_proto_enumTypes[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x ErrorCode) Number() protoreflect.EnumNumber {
|
func (x ErrorCode) Number() protoreflect.EnumNumber {
|
||||||
@@ -228,7 +134,7 @@ func (x ErrorCode) Number() protoreflect.EnumNumber {
|
|||||||
|
|
||||||
// Deprecated: Use ErrorCode.Descriptor instead.
|
// Deprecated: Use ErrorCode.Descriptor instead.
|
||||||
func (ErrorCode) EnumDescriptor() ([]byte, []int) {
|
func (ErrorCode) EnumDescriptor() ([]byte, []int) {
|
||||||
return file_cmd_proto_rawDescGZIP(), []int{2}
|
return file_cmd_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
type CmdErrorCode int32
|
type CmdErrorCode int32
|
||||||
@@ -258,11 +164,11 @@ func (x CmdErrorCode) String() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (CmdErrorCode) Descriptor() protoreflect.EnumDescriptor {
|
func (CmdErrorCode) Descriptor() protoreflect.EnumDescriptor {
|
||||||
return file_cmd_proto_enumTypes[3].Descriptor()
|
return file_cmd_proto_enumTypes[1].Descriptor()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (CmdErrorCode) Type() protoreflect.EnumType {
|
func (CmdErrorCode) Type() protoreflect.EnumType {
|
||||||
return &file_cmd_proto_enumTypes[3]
|
return &file_cmd_proto_enumTypes[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x CmdErrorCode) Number() protoreflect.EnumNumber {
|
func (x CmdErrorCode) Number() protoreflect.EnumNumber {
|
||||||
@@ -271,7 +177,7 @@ func (x CmdErrorCode) Number() protoreflect.EnumNumber {
|
|||||||
|
|
||||||
// Deprecated: Use CmdErrorCode.Descriptor instead.
|
// Deprecated: Use CmdErrorCode.Descriptor instead.
|
||||||
func (CmdErrorCode) EnumDescriptor() ([]byte, []int) {
|
func (CmdErrorCode) EnumDescriptor() ([]byte, []int) {
|
||||||
return file_cmd_proto_rawDescGZIP(), []int{3}
|
return file_cmd_proto_rawDescGZIP(), []int{1}
|
||||||
}
|
}
|
||||||
|
|
||||||
type TaskStatus int32
|
type TaskStatus int32
|
||||||
@@ -319,11 +225,11 @@ func (x TaskStatus) String() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (TaskStatus) Descriptor() protoreflect.EnumDescriptor {
|
func (TaskStatus) Descriptor() protoreflect.EnumDescriptor {
|
||||||
return file_cmd_proto_enumTypes[4].Descriptor()
|
return file_cmd_proto_enumTypes[2].Descriptor()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (TaskStatus) Type() protoreflect.EnumType {
|
func (TaskStatus) Type() protoreflect.EnumType {
|
||||||
return &file_cmd_proto_enumTypes[4]
|
return &file_cmd_proto_enumTypes[2]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x TaskStatus) Number() protoreflect.EnumNumber {
|
func (x TaskStatus) Number() protoreflect.EnumNumber {
|
||||||
@@ -332,15 +238,12 @@ func (x TaskStatus) Number() protoreflect.EnumNumber {
|
|||||||
|
|
||||||
// Deprecated: Use TaskStatus.Descriptor instead.
|
// Deprecated: Use TaskStatus.Descriptor instead.
|
||||||
func (TaskStatus) EnumDescriptor() ([]byte, []int) {
|
func (TaskStatus) EnumDescriptor() ([]byte, []int) {
|
||||||
return file_cmd_proto_rawDescGZIP(), []int{4}
|
return file_cmd_proto_rawDescGZIP(), []int{2}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SaasReq 命令请求
|
// SaasReq 命令请求
|
||||||
type SaasReq struct {
|
type SaasReq struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
UseridType UserIdType `protobuf:"varint,1,opt,name=userid_type,json=useridType,proto3,enum=saasapi.UserIdType" json:"userid_type,omitempty"` // 用户ID类型
|
|
||||||
Appid string `protobuf:"bytes,2,opt,name=appid,proto3" json:"appid,omitempty"` // 小程序/小游戏/公众号/视频号的appid
|
|
||||||
NamespaceId uint32 `protobuf:"varint,3,opt,name=namespace_id,json=namespaceId,proto3" json:"namespace_id,omitempty"` // 命名空间ID
|
|
||||||
// Types that are valid to be assigned to Cmd:
|
// Types that are valid to be assigned to Cmd:
|
||||||
//
|
//
|
||||||
// *SaasReq_Read
|
// *SaasReq_Read
|
||||||
@@ -386,27 +289,6 @@ func (*SaasReq) Descriptor() ([]byte, []int) {
|
|||||||
return file_cmd_proto_rawDescGZIP(), []int{0}
|
return file_cmd_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SaasReq) GetUseridType() UserIdType {
|
|
||||||
if x != nil {
|
|
||||||
return x.UseridType
|
|
||||||
}
|
|
||||||
return UserIdType_DEVICEID
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *SaasReq) GetAppid() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Appid
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *SaasReq) GetNamespaceId() uint32 {
|
|
||||||
if x != nil {
|
|
||||||
return x.NamespaceId
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *SaasReq) GetCmd() isSaasReq_Cmd {
|
func (x *SaasReq) GetCmd() isSaasReq_Cmd {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Cmd
|
return x.Cmd
|
||||||
@@ -541,7 +423,9 @@ func (*SaasReq_TaskInfo) isSaasReq_Cmd() {}
|
|||||||
// Read 批量读取命令
|
// Read 批量读取命令
|
||||||
type Read struct {
|
type Read struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
ReadItems []*ReadItem `protobuf:"bytes,1,rep,name=read_items,json=readItems,proto3" json:"read_items,omitempty"` // 批量获取命令
|
DataspaceId string `protobuf:"bytes,1,opt,name=dataspace_id,json=dataspaceId,proto3" json:"dataspace_id,omitempty"` // 数据空间ID
|
||||||
|
Appid string `protobuf:"bytes,2,opt,name=appid,proto3" json:"appid,omitempty"` // 小程序/小游戏/公众号/视频号的appid
|
||||||
|
ReadItems []*ReadItem `protobuf:"bytes,3,rep,name=read_items,json=readItems,proto3" json:"read_items,omitempty"` // 批量获取命令
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@@ -576,6 +460,20 @@ func (*Read) Descriptor() ([]byte, []int) {
|
|||||||
return file_cmd_proto_rawDescGZIP(), []int{1}
|
return file_cmd_proto_rawDescGZIP(), []int{1}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *Read) GetDataspaceId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.DataspaceId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Read) GetAppid() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Appid
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (x *Read) GetReadItems() []*ReadItem {
|
func (x *Read) GetReadItems() []*ReadItem {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.ReadItems
|
return x.ReadItems
|
||||||
@@ -631,8 +529,10 @@ func (x *ReadItem) GetUserid() string {
|
|||||||
// Write 批量写入命令
|
// Write 批量写入命令
|
||||||
type Write struct {
|
type Write struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
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"` // 是否先清空该用户所有数据
|
DataspaceId string `protobuf:"bytes,1,opt,name=dataspace_id,json=dataspaceId,proto3" json:"dataspace_id,omitempty"` // 数据空间ID
|
||||||
WriteItems []*WriteItem `protobuf:"bytes,2,rep,name=write_items,json=writeItems,proto3" json:"write_items,omitempty"` // 批量写入命令
|
Appid string `protobuf:"bytes,2,opt,name=appid,proto3" json:"appid,omitempty"` // 小程序/小游戏/公众号/视频号的appid
|
||||||
|
IsClearAllFirst bool `protobuf:"varint,3,opt,name=is_clear_all_first,json=isClearAllFirst,proto3" json:"is_clear_all_first,omitempty"` // 是否先清空该用户所有数据
|
||||||
|
WriteItems []*WriteItem `protobuf:"bytes,4,rep,name=write_items,json=writeItems,proto3" json:"write_items,omitempty"` // 批量写入命令
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@@ -667,6 +567,20 @@ func (*Write) Descriptor() ([]byte, []int) {
|
|||||||
return file_cmd_proto_rawDescGZIP(), []int{3}
|
return file_cmd_proto_rawDescGZIP(), []int{3}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *Write) GetDataspaceId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.DataspaceId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Write) GetAppid() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Appid
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (x *Write) GetIsClearAllFirst() bool {
|
func (x *Write) GetIsClearAllFirst() bool {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.IsClearAllFirst
|
return x.IsClearAllFirst
|
||||||
@@ -981,10 +895,11 @@ func (x *FlagWithExpire) GetExpire() uint32 {
|
|||||||
// ColumnWrite 全量列式写入命令
|
// ColumnWrite 全量列式写入命令
|
||||||
type ColumnWrite struct {
|
type ColumnWrite struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
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"` // 是否先执行清空
|
DataspaceId string `protobuf:"bytes,1,opt,name=dataspace_id,json=dataspaceId,proto3" json:"dataspace_id,omitempty"` // 数据空间ID
|
||||||
WriteBytes *Bytes `protobuf:"bytes,2,opt,name=write_bytes,json=writeBytes,proto3" json:"write_bytes,omitempty"` // byte区域
|
IsClearAllFirst bool `protobuf:"varint,2,opt,name=is_clear_all_first,json=isClearAllFirst,proto3" json:"is_clear_all_first,omitempty"` // 是否先执行清空
|
||||||
WriteUint32S *Uint32S `protobuf:"bytes,3,opt,name=write_uint32s,json=writeUint32s,proto3" json:"write_uint32s,omitempty"` // uint32区域
|
WriteBytes *Bytes `protobuf:"bytes,3,opt,name=write_bytes,json=writeBytes,proto3" json:"write_bytes,omitempty"` // byte区域
|
||||||
WriteFlagsWithExpire *FlagsWithExpire `protobuf:"bytes,4,opt,name=write_flags_with_expire,json=writeFlagsWithExpire,proto3" json:"write_flags_with_expire,omitempty"` // 标志位区域
|
WriteUint32S *Uint32S `protobuf:"bytes,4,opt,name=write_uint32s,json=writeUint32s,proto3" json:"write_uint32s,omitempty"` // uint32区域
|
||||||
|
WriteFlagsWithExpire *FlagsWithExpire `protobuf:"bytes,5,opt,name=write_flags_with_expire,json=writeFlagsWithExpire,proto3" json:"write_flags_with_expire,omitempty"` // 标志位区域
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@@ -1019,6 +934,13 @@ func (*ColumnWrite) Descriptor() ([]byte, []int) {
|
|||||||
return file_cmd_proto_rawDescGZIP(), []int{9}
|
return file_cmd_proto_rawDescGZIP(), []int{9}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *ColumnWrite) GetDataspaceId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.DataspaceId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (x *ColumnWrite) GetIsClearAllFirst() bool {
|
func (x *ColumnWrite) GetIsClearAllFirst() bool {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.IsClearAllFirst
|
return x.IsClearAllFirst
|
||||||
@@ -1049,10 +971,12 @@ func (x *ColumnWrite) GetWriteFlagsWithExpire() *FlagsWithExpire {
|
|||||||
|
|
||||||
type Task struct {
|
type Task struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
TaskSha256 string `protobuf:"bytes,1,opt,name=task_sha256,json=taskSha256,proto3" json:"task_sha256,omitempty"` // 任务sha256
|
DataspaceId string `protobuf:"bytes,1,opt,name=dataspace_id,json=dataspaceId,proto3" json:"dataspace_id,omitempty"` // 数据空间ID
|
||||||
TaskDescription string `protobuf:"bytes,2,opt,name=task_description,json=taskDescription,proto3" json:"task_description,omitempty"` // 任务描述
|
Appid string `protobuf:"bytes,2,opt,name=appid,proto3" json:"appid,omitempty"` // 小程序/小游戏/公众号/视频号的appid
|
||||||
TaskFileInfos []*FileInfo `protobuf:"bytes,3,rep,name=task_file_infos,json=taskFileInfos,proto3" json:"task_file_infos,omitempty"` // 文件列表
|
TaskSha256 string `protobuf:"bytes,3,opt,name=task_sha256,json=taskSha256,proto3" json:"task_sha256,omitempty"` // 任务sha256
|
||||||
TaskBlockSize uint64 `protobuf:"varint,4,opt,name=task_block_size,json=taskBlockSize,proto3" json:"task_block_size,omitempty"` // 文件块字节大小(推荐200M)
|
TaskDescription string `protobuf:"bytes,4,opt,name=task_description,json=taskDescription,proto3" json:"task_description,omitempty"` // 任务描述
|
||||||
|
TaskFileInfos []*FileInfo `protobuf:"bytes,5,rep,name=task_file_infos,json=taskFileInfos,proto3" json:"task_file_infos,omitempty"` // 文件列表
|
||||||
|
TaskBlockSize uint64 `protobuf:"varint,6,opt,name=task_block_size,json=taskBlockSize,proto3" json:"task_block_size,omitempty"` // 文件块字节大小(推荐200M)
|
||||||
// 以下字段只在返回时填写,用于提供服务端的任务状态。在请求时填写会被忽略
|
// 以下字段只在返回时填写,用于提供服务端的任务状态。在请求时填写会被忽略
|
||||||
CreateTime string `protobuf:"bytes,10,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` // 创建时间
|
CreateTime string `protobuf:"bytes,10,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` // 创建时间
|
||||||
RunTime string `protobuf:"bytes,11,opt,name=run_time,json=runTime,proto3" json:"run_time,omitempty"` // 运行时间
|
RunTime string `protobuf:"bytes,11,opt,name=run_time,json=runTime,proto3" json:"run_time,omitempty"` // 运行时间
|
||||||
@@ -1092,6 +1016,20 @@ func (*Task) Descriptor() ([]byte, []int) {
|
|||||||
return file_cmd_proto_rawDescGZIP(), []int{10}
|
return file_cmd_proto_rawDescGZIP(), []int{10}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *Task) GetDataspaceId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.DataspaceId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Task) GetAppid() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Appid
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (x *Task) GetTaskSha256() string {
|
func (x *Task) GetTaskSha256() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.TaskSha256
|
return x.TaskSha256
|
||||||
@@ -1688,10 +1626,10 @@ func (x *ReadRes) GetCmdRes() []*ValueItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type WriteRes struct {
|
type WriteRes struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
SuccCmdCount uint32 `protobuf:"varint,1,opt,name=succ_cmd_count,json=succCmdCount,proto3" json:"succ_cmd_count,omitempty"` // 成功的命令数量
|
// uint32 succ_cmd_count = 1; // 成功的命令数量
|
||||||
FailCmdCount uint32 `protobuf:"varint,2,opt,name=fail_cmd_count,json=failCmdCount,proto3" json:"fail_cmd_count,omitempty"` // 失败的命令数量
|
// uint32 fail_cmd_count = 2; // 失败的命令数量
|
||||||
CmdRes []*ValueItem `protobuf:"bytes,3,rep,name=cmd_res,json=cmdRes,proto3" json:"cmd_res,omitempty"` // 返回的失败命令,仅填写cmd_index和cmd_code
|
FailedUserid []string `protobuf:"bytes,3,rep,name=failed_userid,json=failedUserid,proto3" json:"failed_userid,omitempty"` // 返回的失败的用户ID
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@@ -1726,23 +1664,9 @@ func (*WriteRes) Descriptor() ([]byte, []int) {
|
|||||||
return file_cmd_proto_rawDescGZIP(), []int{19}
|
return file_cmd_proto_rawDescGZIP(), []int{19}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *WriteRes) GetSuccCmdCount() uint32 {
|
func (x *WriteRes) GetFailedUserid() []string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.SuccCmdCount
|
return x.FailedUserid
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *WriteRes) GetFailCmdCount() uint32 {
|
|
||||||
if x != nil {
|
|
||||||
return x.FailCmdCount
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *WriteRes) GetCmdRes() []*ValueItem {
|
|
||||||
if x != nil {
|
|
||||||
return x.CmdRes
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -1880,12 +1804,8 @@ var File_cmd_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
const file_cmd_proto_rawDesc = "" +
|
const file_cmd_proto_rawDesc = "" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\tcmd.proto\x12\asaasapi\"\x84\x04\n" +
|
"\tcmd.proto\x12\asaasapi\"\x95\x03\n" +
|
||||||
"\aSaasReq\x124\n" +
|
"\aSaasReq\x12#\n" +
|
||||||
"\vuserid_type\x18\x01 \x01(\x0e2\x13.saasapi.UserIdTypeR\n" +
|
|
||||||
"useridType\x12\x14\n" +
|
|
||||||
"\x05appid\x18\x02 \x01(\tR\x05appid\x12!\n" +
|
|
||||||
"\fnamespace_id\x18\x03 \x01(\rR\vnamespaceId\x12#\n" +
|
|
||||||
"\x04read\x18\n" +
|
"\x04read\x18\n" +
|
||||||
" \x01(\v2\r.saasapi.ReadH\x00R\x04read\x12&\n" +
|
" \x01(\v2\r.saasapi.ReadH\x00R\x04read\x12&\n" +
|
||||||
"\x05write\x18\v \x01(\v2\x0e.saasapi.WriteH\x00R\x05write\x129\n" +
|
"\x05write\x18\v \x01(\v2\x0e.saasapi.WriteH\x00R\x05write\x129\n" +
|
||||||
@@ -1897,15 +1817,19 @@ const file_cmd_proto_rawDesc = "" +
|
|||||||
"\vtask_delete\x18\x17 \x01(\v2\x13.saasapi.TaskDeleteH\x00R\n" +
|
"\vtask_delete\x18\x17 \x01(\v2\x13.saasapi.TaskDeleteH\x00R\n" +
|
||||||
"taskDelete\x120\n" +
|
"taskDelete\x120\n" +
|
||||||
"\ttask_info\x18\x18 \x01(\v2\x11.saasapi.TaskInfoH\x00R\btaskInfoB\x05\n" +
|
"\ttask_info\x18\x18 \x01(\v2\x11.saasapi.TaskInfoH\x00R\btaskInfoB\x05\n" +
|
||||||
"\x03cmd\"8\n" +
|
"\x03cmd\"q\n" +
|
||||||
"\x04Read\x120\n" +
|
"\x04Read\x12!\n" +
|
||||||
|
"\fdataspace_id\x18\x01 \x01(\tR\vdataspaceId\x12\x14\n" +
|
||||||
|
"\x05appid\x18\x02 \x01(\tR\x05appid\x120\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"read_items\x18\x01 \x03(\v2\x11.saasapi.ReadItemR\treadItems\"\"\n" +
|
"read_items\x18\x03 \x03(\v2\x11.saasapi.ReadItemR\treadItems\"\"\n" +
|
||||||
"\bReadItem\x12\x16\n" +
|
"\bReadItem\x12\x16\n" +
|
||||||
"\x06userid\x18\x01 \x01(\tR\x06userid\"i\n" +
|
"\x06userid\x18\x01 \x01(\tR\x06userid\"\xa2\x01\n" +
|
||||||
"\x05Write\x12+\n" +
|
"\x05Write\x12!\n" +
|
||||||
"\x12is_clear_all_first\x18\x01 \x01(\bR\x0fisClearAllFirst\x123\n" +
|
"\fdataspace_id\x18\x01 \x01(\tR\vdataspaceId\x12\x14\n" +
|
||||||
"\vwrite_items\x18\x02 \x03(\v2\x12.saasapi.WriteItemR\n" +
|
"\x05appid\x18\x02 \x01(\tR\x05appid\x12+\n" +
|
||||||
|
"\x12is_clear_all_first\x18\x03 \x01(\bR\x0fisClearAllFirst\x123\n" +
|
||||||
|
"\vwrite_items\x18\x04 \x03(\v2\x12.saasapi.WriteItemR\n" +
|
||||||
"writeItems\"\xdc\x01\n" +
|
"writeItems\"\xdc\x01\n" +
|
||||||
"\tWriteItem\x12\x16\n" +
|
"\tWriteItem\x12\x16\n" +
|
||||||
"\x06userid\x18\x01 \x01(\tR\x06userid\x12/\n" +
|
"\x06userid\x18\x01 \x01(\tR\x06userid\x12/\n" +
|
||||||
@@ -1926,19 +1850,22 @@ const file_cmd_proto_rawDesc = "" +
|
|||||||
"\x0eFlagWithExpire\x12\x12\n" +
|
"\x0eFlagWithExpire\x12\x12\n" +
|
||||||
"\x04flag\x18\x01 \x01(\bR\x04flag\x12!\n" +
|
"\x04flag\x18\x01 \x01(\bR\x04flag\x12!\n" +
|
||||||
"\fdefault_flag\x18\x02 \x01(\bR\vdefaultFlag\x12\x16\n" +
|
"\fdefault_flag\x18\x02 \x01(\bR\vdefaultFlag\x12\x16\n" +
|
||||||
"\x06expire\x18\x03 \x01(\rR\x06expire\"\xf3\x01\n" +
|
"\x06expire\x18\x03 \x01(\rR\x06expire\"\x96\x02\n" +
|
||||||
"\vColumnWrite\x12+\n" +
|
"\vColumnWrite\x12!\n" +
|
||||||
"\x12is_clear_all_first\x18\x01 \x01(\bR\x0fisClearAllFirst\x12/\n" +
|
"\fdataspace_id\x18\x01 \x01(\tR\vdataspaceId\x12+\n" +
|
||||||
"\vwrite_bytes\x18\x02 \x01(\v2\x0e.saasapi.BytesR\n" +
|
"\x12is_clear_all_first\x18\x02 \x01(\bR\x0fisClearAllFirst\x12/\n" +
|
||||||
|
"\vwrite_bytes\x18\x03 \x01(\v2\x0e.saasapi.BytesR\n" +
|
||||||
"writeBytes\x125\n" +
|
"writeBytes\x125\n" +
|
||||||
"\rwrite_uint32s\x18\x03 \x01(\v2\x10.saasapi.Uint32sR\fwriteUint32s\x12O\n" +
|
"\rwrite_uint32s\x18\x04 \x01(\v2\x10.saasapi.Uint32sR\fwriteUint32s\x12O\n" +
|
||||||
"\x17write_flags_with_expire\x18\x04 \x01(\v2\x18.saasapi.FlagsWithExpireR\x14writeFlagsWithExpire\"\xbf\x02\n" +
|
"\x17write_flags_with_expire\x18\x05 \x01(\v2\x18.saasapi.FlagsWithExpireR\x14writeFlagsWithExpire\"\xf8\x02\n" +
|
||||||
"\x04Task\x12\x1f\n" +
|
"\x04Task\x12!\n" +
|
||||||
"\vtask_sha256\x18\x01 \x01(\tR\n" +
|
"\fdataspace_id\x18\x01 \x01(\tR\vdataspaceId\x12\x14\n" +
|
||||||
|
"\x05appid\x18\x02 \x01(\tR\x05appid\x12\x1f\n" +
|
||||||
|
"\vtask_sha256\x18\x03 \x01(\tR\n" +
|
||||||
"taskSha256\x12)\n" +
|
"taskSha256\x12)\n" +
|
||||||
"\x10task_description\x18\x02 \x01(\tR\x0ftaskDescription\x129\n" +
|
"\x10task_description\x18\x04 \x01(\tR\x0ftaskDescription\x129\n" +
|
||||||
"\x0ftask_file_infos\x18\x03 \x03(\v2\x11.saasapi.FileInfoR\rtaskFileInfos\x12&\n" +
|
"\x0ftask_file_infos\x18\x05 \x03(\v2\x11.saasapi.FileInfoR\rtaskFileInfos\x12&\n" +
|
||||||
"\x0ftask_block_size\x18\x04 \x01(\x04R\rtaskBlockSize\x12\x1f\n" +
|
"\x0ftask_block_size\x18\x06 \x01(\x04R\rtaskBlockSize\x12\x1f\n" +
|
||||||
"\vcreate_time\x18\n" +
|
"\vcreate_time\x18\n" +
|
||||||
" \x01(\tR\n" +
|
" \x01(\tR\n" +
|
||||||
"createTime\x12\x19\n" +
|
"createTime\x12\x19\n" +
|
||||||
@@ -1983,11 +1910,9 @@ const file_cmd_proto_rawDesc = "" +
|
|||||||
"\aReadRes\x12$\n" +
|
"\aReadRes\x12$\n" +
|
||||||
"\x0esucc_cmd_count\x18\x01 \x01(\rR\fsuccCmdCount\x12$\n" +
|
"\x0esucc_cmd_count\x18\x01 \x01(\rR\fsuccCmdCount\x12$\n" +
|
||||||
"\x0efail_cmd_count\x18\x02 \x01(\rR\ffailCmdCount\x12+\n" +
|
"\x0efail_cmd_count\x18\x02 \x01(\rR\ffailCmdCount\x12+\n" +
|
||||||
"\acmd_res\x18\x03 \x03(\v2\x12.saasapi.ValueItemR\x06cmdRes\"\x83\x01\n" +
|
"\acmd_res\x18\x03 \x03(\v2\x12.saasapi.ValueItemR\x06cmdRes\"/\n" +
|
||||||
"\bWriteRes\x12$\n" +
|
"\bWriteRes\x12#\n" +
|
||||||
"\x0esucc_cmd_count\x18\x01 \x01(\rR\fsuccCmdCount\x12$\n" +
|
"\rfailed_userid\x18\x03 \x03(\tR\ffailedUserid\"\xf9\x01\n" +
|
||||||
"\x0efail_cmd_count\x18\x02 \x01(\rR\ffailCmdCount\x12+\n" +
|
|
||||||
"\acmd_res\x18\x03 \x03(\v2\x12.saasapi.ValueItemR\x06cmdRes\"\xf9\x01\n" +
|
|
||||||
"\tValueItem\x12\x1b\n" +
|
"\tValueItem\x12\x1b\n" +
|
||||||
"\tcmd_index\x18\x01 \x01(\rR\bcmdIndex\x120\n" +
|
"\tcmd_index\x18\x01 \x01(\rR\bcmdIndex\x120\n" +
|
||||||
"\bcmd_code\x18\x02 \x01(\x0e2\x15.saasapi.CmdErrorCodeR\acmdCode\x12\x14\n" +
|
"\bcmd_code\x18\x02 \x01(\x0e2\x15.saasapi.CmdErrorCodeR\acmdCode\x12\x14\n" +
|
||||||
@@ -1996,17 +1921,7 @@ const file_cmd_proto_rawDesc = "" +
|
|||||||
"\x11flags_with_expire\x18\x05 \x03(\v2\x17.saasapi.FlagWithExpireR\x0fflagsWithExpire\x12(\n" +
|
"\x11flags_with_expire\x18\x05 \x03(\v2\x17.saasapi.FlagWithExpireR\x0fflagsWithExpire\x12(\n" +
|
||||||
"\x10last_modify_time\x18\x06 \x01(\rR\x0elastModifyTime\"2\n" +
|
"\x10last_modify_time\x18\x06 \x01(\rR\x0elastModifyTime\"2\n" +
|
||||||
"\vTaskListRes\x12#\n" +
|
"\vTaskListRes\x12#\n" +
|
||||||
"\x05tasks\x18\x01 \x03(\v2\r.saasapi.TaskR\x05tasks*4\n" +
|
"\x05tasks\x18\x01 \x03(\v2\r.saasapi.TaskR\x05tasks*\xea\x03\n" +
|
||||||
"\n" +
|
|
||||||
"UserIdType\x12\f\n" +
|
|
||||||
"\bDEVICEID\x10\x00\x12\n" +
|
|
||||||
"\n" +
|
|
||||||
"\x06OPENID\x10\x01\x12\f\n" +
|
|
||||||
"\bINNERID1\x10\n" +
|
|
||||||
"* \n" +
|
|
||||||
"\vNameSpaceId\x12\a\n" +
|
|
||||||
"\x03DID\x10\x00\x12\b\n" +
|
|
||||||
"\x04WUID\x10\x01*\xd0\x03\n" +
|
|
||||||
"\tErrorCode\x12\b\n" +
|
"\tErrorCode\x12\b\n" +
|
||||||
"\x04SUCC\x10\x00\x12\x13\n" +
|
"\x04SUCC\x10\x00\x12\x13\n" +
|
||||||
"\x0fINVALID_ACCOUNT\x10e\x12\x15\n" +
|
"\x0fINVALID_ACCOUNT\x10e\x12\x15\n" +
|
||||||
@@ -2020,7 +1935,8 @@ const file_cmd_proto_rawDesc = "" +
|
|||||||
"\tQPS_LIMIT\x10q\x12\x0e\n" +
|
"\tQPS_LIMIT\x10q\x12\x0e\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"CMDS_LIMIT\x10r\x12\r\n" +
|
"CMDS_LIMIT\x10r\x12\r\n" +
|
||||||
"\tCMDS_NULL\x10s\x12\x0f\n" +
|
"\tCMDS_NULL\x10s\x12\x18\n" +
|
||||||
|
"\x14DATASPACE_NOT_EXISTS\x10t\x12\x0f\n" +
|
||||||
"\vTASK_EXISTS\x10x\x12\x16\n" +
|
"\vTASK_EXISTS\x10x\x12\x16\n" +
|
||||||
"\x12TASK_IS_NOT_EXISTS\x10y\x12\x12\n" +
|
"\x12TASK_IS_NOT_EXISTS\x10y\x12\x12\n" +
|
||||||
"\x0eTASK_NUM_LIMIT\x10z\x12\x13\n" +
|
"\x0eTASK_NUM_LIMIT\x10z\x12\x13\n" +
|
||||||
@@ -2059,78 +1975,74 @@ func file_cmd_proto_rawDescGZIP() []byte {
|
|||||||
return file_cmd_proto_rawDescData
|
return file_cmd_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_cmd_proto_enumTypes = make([]protoimpl.EnumInfo, 5)
|
var file_cmd_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
|
||||||
var file_cmd_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
|
var file_cmd_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
|
||||||
var file_cmd_proto_goTypes = []any{
|
var file_cmd_proto_goTypes = []any{
|
||||||
(UserIdType)(0), // 0: saasapi.UserIdType
|
(ErrorCode)(0), // 0: saasapi.ErrorCode
|
||||||
(NameSpaceId)(0), // 1: saasapi.NameSpaceId
|
(CmdErrorCode)(0), // 1: saasapi.CmdErrorCode
|
||||||
(ErrorCode)(0), // 2: saasapi.ErrorCode
|
(TaskStatus)(0), // 2: saasapi.TaskStatus
|
||||||
(CmdErrorCode)(0), // 3: saasapi.CmdErrorCode
|
(*SaasReq)(nil), // 3: saasapi.SaasReq
|
||||||
(TaskStatus)(0), // 4: saasapi.TaskStatus
|
(*Read)(nil), // 4: saasapi.Read
|
||||||
(*SaasReq)(nil), // 5: saasapi.SaasReq
|
(*ReadItem)(nil), // 5: saasapi.ReadItem
|
||||||
(*Read)(nil), // 6: saasapi.Read
|
(*Write)(nil), // 6: saasapi.Write
|
||||||
(*ReadItem)(nil), // 7: saasapi.ReadItem
|
(*WriteItem)(nil), // 7: saasapi.WriteItem
|
||||||
(*Write)(nil), // 8: saasapi.Write
|
(*Bytes)(nil), // 8: saasapi.Bytes
|
||||||
(*WriteItem)(nil), // 9: saasapi.WriteItem
|
(*Uint32S)(nil), // 9: saasapi.Uint32s
|
||||||
(*Bytes)(nil), // 10: saasapi.Bytes
|
(*FlagsWithExpire)(nil), // 10: saasapi.FlagsWithExpire
|
||||||
(*Uint32S)(nil), // 11: saasapi.Uint32s
|
(*FlagWithExpire)(nil), // 11: saasapi.FlagWithExpire
|
||||||
(*FlagsWithExpire)(nil), // 12: saasapi.FlagsWithExpire
|
(*ColumnWrite)(nil), // 12: saasapi.ColumnWrite
|
||||||
(*FlagWithExpire)(nil), // 13: saasapi.FlagWithExpire
|
(*Task)(nil), // 13: saasapi.Task
|
||||||
(*ColumnWrite)(nil), // 14: saasapi.ColumnWrite
|
(*TaskList)(nil), // 14: saasapi.TaskList
|
||||||
(*Task)(nil), // 15: saasapi.Task
|
(*TaskRun)(nil), // 15: saasapi.TaskRun
|
||||||
(*TaskList)(nil), // 16: saasapi.TaskList
|
(*TaskDelete)(nil), // 16: saasapi.TaskDelete
|
||||||
(*TaskRun)(nil), // 17: saasapi.TaskRun
|
(*TaskInfo)(nil), // 17: saasapi.TaskInfo
|
||||||
(*TaskDelete)(nil), // 18: saasapi.TaskDelete
|
(*FileInfo)(nil), // 18: saasapi.FileInfo
|
||||||
(*TaskInfo)(nil), // 19: saasapi.TaskInfo
|
(*FileBlock)(nil), // 19: saasapi.FileBlock
|
||||||
(*FileInfo)(nil), // 20: saasapi.FileInfo
|
(*SaasRes)(nil), // 20: saasapi.SaasRes
|
||||||
(*FileBlock)(nil), // 21: saasapi.FileBlock
|
(*ReadRes)(nil), // 21: saasapi.ReadRes
|
||||||
(*SaasRes)(nil), // 22: saasapi.SaasRes
|
(*WriteRes)(nil), // 22: saasapi.WriteRes
|
||||||
(*ReadRes)(nil), // 23: saasapi.ReadRes
|
(*ValueItem)(nil), // 23: saasapi.ValueItem
|
||||||
(*WriteRes)(nil), // 24: saasapi.WriteRes
|
(*TaskListRes)(nil), // 24: saasapi.TaskListRes
|
||||||
(*ValueItem)(nil), // 25: saasapi.ValueItem
|
|
||||||
(*TaskListRes)(nil), // 26: saasapi.TaskListRes
|
|
||||||
}
|
}
|
||||||
var file_cmd_proto_depIdxs = []int32{
|
var file_cmd_proto_depIdxs = []int32{
|
||||||
0, // 0: saasapi.SaasReq.userid_type:type_name -> saasapi.UserIdType
|
4, // 0: saasapi.SaasReq.read:type_name -> saasapi.Read
|
||||||
6, // 1: saasapi.SaasReq.read:type_name -> saasapi.Read
|
6, // 1: saasapi.SaasReq.write:type_name -> saasapi.Write
|
||||||
8, // 2: saasapi.SaasReq.write:type_name -> saasapi.Write
|
12, // 2: saasapi.SaasReq.column_write:type_name -> saasapi.ColumnWrite
|
||||||
14, // 3: saasapi.SaasReq.column_write:type_name -> saasapi.ColumnWrite
|
13, // 3: saasapi.SaasReq.task_create:type_name -> saasapi.Task
|
||||||
15, // 4: saasapi.SaasReq.task_create:type_name -> saasapi.Task
|
14, // 4: saasapi.SaasReq.task_list:type_name -> saasapi.TaskList
|
||||||
16, // 5: saasapi.SaasReq.task_list:type_name -> saasapi.TaskList
|
15, // 5: saasapi.SaasReq.task_run:type_name -> saasapi.TaskRun
|
||||||
17, // 6: saasapi.SaasReq.task_run:type_name -> saasapi.TaskRun
|
16, // 6: saasapi.SaasReq.task_delete:type_name -> saasapi.TaskDelete
|
||||||
18, // 7: saasapi.SaasReq.task_delete:type_name -> saasapi.TaskDelete
|
17, // 7: saasapi.SaasReq.task_info:type_name -> saasapi.TaskInfo
|
||||||
19, // 8: saasapi.SaasReq.task_info:type_name -> saasapi.TaskInfo
|
5, // 8: saasapi.Read.read_items:type_name -> saasapi.ReadItem
|
||||||
7, // 9: saasapi.Read.read_items:type_name -> saasapi.ReadItem
|
7, // 9: saasapi.Write.write_items:type_name -> saasapi.WriteItem
|
||||||
9, // 10: saasapi.Write.write_items:type_name -> saasapi.WriteItem
|
8, // 10: saasapi.WriteItem.write_bytes:type_name -> saasapi.Bytes
|
||||||
10, // 11: saasapi.WriteItem.write_bytes:type_name -> saasapi.Bytes
|
9, // 11: saasapi.WriteItem.write_uint32s:type_name -> saasapi.Uint32s
|
||||||
11, // 12: saasapi.WriteItem.write_uint32s:type_name -> saasapi.Uint32s
|
10, // 12: saasapi.WriteItem.write_flags_with_expire:type_name -> saasapi.FlagsWithExpire
|
||||||
12, // 13: saasapi.WriteItem.write_flags_with_expire:type_name -> saasapi.FlagsWithExpire
|
11, // 13: saasapi.FlagsWithExpire.flags_with_expire:type_name -> saasapi.FlagWithExpire
|
||||||
13, // 14: saasapi.FlagsWithExpire.flags_with_expire:type_name -> saasapi.FlagWithExpire
|
8, // 14: saasapi.ColumnWrite.write_bytes:type_name -> saasapi.Bytes
|
||||||
10, // 15: saasapi.ColumnWrite.write_bytes:type_name -> saasapi.Bytes
|
9, // 15: saasapi.ColumnWrite.write_uint32s:type_name -> saasapi.Uint32s
|
||||||
11, // 16: saasapi.ColumnWrite.write_uint32s:type_name -> saasapi.Uint32s
|
10, // 16: saasapi.ColumnWrite.write_flags_with_expire:type_name -> saasapi.FlagsWithExpire
|
||||||
12, // 17: saasapi.ColumnWrite.write_flags_with_expire:type_name -> saasapi.FlagsWithExpire
|
18, // 17: saasapi.Task.task_file_infos:type_name -> saasapi.FileInfo
|
||||||
20, // 18: saasapi.Task.task_file_infos:type_name -> saasapi.FileInfo
|
2, // 18: saasapi.Task.status:type_name -> saasapi.TaskStatus
|
||||||
4, // 19: saasapi.Task.status:type_name -> saasapi.TaskStatus
|
2, // 19: saasapi.TaskList.status_filter:type_name -> saasapi.TaskStatus
|
||||||
4, // 20: saasapi.TaskList.status_filter:type_name -> saasapi.TaskStatus
|
19, // 20: saasapi.FileInfo.file_blocks:type_name -> saasapi.FileBlock
|
||||||
21, // 21: saasapi.FileInfo.file_blocks:type_name -> saasapi.FileBlock
|
0, // 21: saasapi.SaasRes.code:type_name -> saasapi.ErrorCode
|
||||||
2, // 22: saasapi.SaasRes.code:type_name -> saasapi.ErrorCode
|
21, // 22: saasapi.SaasRes.read_res:type_name -> saasapi.ReadRes
|
||||||
23, // 23: saasapi.SaasRes.read_res:type_name -> saasapi.ReadRes
|
22, // 23: saasapi.SaasRes.write_res:type_name -> saasapi.WriteRes
|
||||||
24, // 24: saasapi.SaasRes.write_res:type_name -> saasapi.WriteRes
|
13, // 24: saasapi.SaasRes.task_create_res:type_name -> saasapi.Task
|
||||||
15, // 25: saasapi.SaasRes.task_create_res:type_name -> saasapi.Task
|
24, // 25: saasapi.SaasRes.task_list_res:type_name -> saasapi.TaskListRes
|
||||||
26, // 26: saasapi.SaasRes.task_list_res:type_name -> saasapi.TaskListRes
|
13, // 26: saasapi.SaasRes.task_run_res:type_name -> saasapi.Task
|
||||||
15, // 27: saasapi.SaasRes.task_run_res:type_name -> saasapi.Task
|
13, // 27: saasapi.SaasRes.task_delete_res:type_name -> saasapi.Task
|
||||||
15, // 28: saasapi.SaasRes.task_delete_res:type_name -> saasapi.Task
|
13, // 28: saasapi.SaasRes.task_info_res:type_name -> saasapi.Task
|
||||||
15, // 29: saasapi.SaasRes.task_info_res:type_name -> saasapi.Task
|
23, // 29: saasapi.ReadRes.cmd_res:type_name -> saasapi.ValueItem
|
||||||
25, // 30: saasapi.ReadRes.cmd_res:type_name -> saasapi.ValueItem
|
1, // 30: saasapi.ValueItem.cmd_code:type_name -> saasapi.CmdErrorCode
|
||||||
25, // 31: saasapi.WriteRes.cmd_res:type_name -> saasapi.ValueItem
|
11, // 31: saasapi.ValueItem.flags_with_expire:type_name -> saasapi.FlagWithExpire
|
||||||
3, // 32: saasapi.ValueItem.cmd_code:type_name -> saasapi.CmdErrorCode
|
13, // 32: saasapi.TaskListRes.tasks:type_name -> saasapi.Task
|
||||||
13, // 33: saasapi.ValueItem.flags_with_expire:type_name -> saasapi.FlagWithExpire
|
33, // [33:33] is the sub-list for method output_type
|
||||||
15, // 34: saasapi.TaskListRes.tasks:type_name -> saasapi.Task
|
33, // [33:33] is the sub-list for method input_type
|
||||||
35, // [35:35] is the sub-list for method output_type
|
33, // [33:33] is the sub-list for extension type_name
|
||||||
35, // [35:35] is the sub-list for method input_type
|
33, // [33:33] is the sub-list for extension extendee
|
||||||
35, // [35:35] is the sub-list for extension type_name
|
0, // [0:33] is the sub-list for field type_name
|
||||||
35, // [35:35] is the sub-list for extension extendee
|
|
||||||
0, // [0:35] is the sub-list for field type_name
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_cmd_proto_init() }
|
func init() { file_cmd_proto_init() }
|
||||||
@@ -2162,7 +2074,7 @@ func file_cmd_proto_init() {
|
|||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_cmd_proto_rawDesc), len(file_cmd_proto_rawDesc)),
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_cmd_proto_rawDesc), len(file_cmd_proto_rawDesc)),
|
||||||
NumEnums: 5,
|
NumEnums: 3,
|
||||||
NumMessages: 22,
|
NumMessages: 22,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
|
|||||||
53
cmd.proto
53
cmd.proto
@@ -6,10 +6,6 @@ option go_package = "e.coding.net/rta/public/saasapi";
|
|||||||
|
|
||||||
// SaasReq 命令请求
|
// SaasReq 命令请求
|
||||||
message SaasReq {
|
message SaasReq {
|
||||||
UserIdType userid_type = 1; // 用户ID类型
|
|
||||||
string appid = 2; // 小程序/小游戏/公众号/视频号的appid
|
|
||||||
uint32 namespace_id = 3; // 命名空间ID
|
|
||||||
|
|
||||||
oneof cmd {
|
oneof cmd {
|
||||||
Read read = 10; // 批量读取
|
Read read = 10; // 批量读取
|
||||||
Write write = 11; // 批量写入
|
Write write = 11; // 批量写入
|
||||||
@@ -25,7 +21,9 @@ message SaasReq {
|
|||||||
|
|
||||||
// Read 批量读取命令
|
// Read 批量读取命令
|
||||||
message Read {
|
message Read {
|
||||||
repeated ReadItem read_items = 1; // 批量获取命令
|
string dataspace_id = 1; // 数据空间ID
|
||||||
|
string appid = 2; // 小程序/小游戏/公众号/视频号的appid
|
||||||
|
repeated ReadItem read_items = 3; // 批量获取命令
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadItem 读取命令
|
// ReadItem 读取命令
|
||||||
@@ -35,8 +33,10 @@ message ReadItem {
|
|||||||
|
|
||||||
// Write 批量写入命令
|
// Write 批量写入命令
|
||||||
message Write {
|
message Write {
|
||||||
bool is_clear_all_first = 1; // 是否先清空该用户所有数据
|
string dataspace_id = 1; // 数据空间ID
|
||||||
repeated WriteItem write_items = 2; // 批量写入命令
|
string appid = 2; // 小程序/小游戏/公众号/视频号的appid
|
||||||
|
bool is_clear_all_first = 3; // 是否先清空该用户所有数据
|
||||||
|
repeated WriteItem write_items = 4; // 批量写入命令
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteItem 写入命令
|
// WriteItem 写入命令
|
||||||
@@ -74,32 +74,22 @@ message FlagWithExpire {
|
|||||||
uint32 expire = 3; // 过期时间,为 0 则永不过期
|
uint32 expire = 3; // 过期时间,为 0 则永不过期
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserIdType 用户 ID 类型
|
|
||||||
enum UserIdType {
|
|
||||||
DEVICEID = 0; // 设备号
|
|
||||||
OPENID = 1; // OpenId
|
|
||||||
INNERID1 = 10; // 内部ID1
|
|
||||||
}
|
|
||||||
|
|
||||||
// NameSpaceId 用户 ID 类型
|
|
||||||
enum NameSpaceId {
|
|
||||||
DID = 0; // 默认设备号命名空间
|
|
||||||
WUID = 1; // 默认WUID命名空间
|
|
||||||
}
|
|
||||||
|
|
||||||
// ColumnWrite 全量列式写入命令
|
// ColumnWrite 全量列式写入命令
|
||||||
message ColumnWrite {
|
message ColumnWrite {
|
||||||
bool is_clear_all_first = 1; // 是否先执行清空
|
string dataspace_id = 1; // 数据空间ID
|
||||||
Bytes write_bytes = 2; // byte区域
|
bool is_clear_all_first = 2; // 是否先执行清空
|
||||||
Uint32s write_uint32s = 3; // uint32区域
|
Bytes write_bytes = 3; // byte区域
|
||||||
FlagsWithExpire write_flags_with_expire = 4; // 标志位区域
|
Uint32s write_uint32s = 4; // uint32区域
|
||||||
|
FlagsWithExpire write_flags_with_expire = 5; // 标志位区域
|
||||||
}
|
}
|
||||||
|
|
||||||
message Task {
|
message Task {
|
||||||
string task_sha256 = 1; // 任务sha256
|
string dataspace_id = 1; // 数据空间ID
|
||||||
string task_description = 2; // 任务描述
|
string appid = 2; // 小程序/小游戏/公众号/视频号的appid
|
||||||
repeated FileInfo task_file_infos = 3; // 文件列表
|
string task_sha256 = 3; // 任务sha256
|
||||||
uint64 task_block_size = 4; // 文件块字节大小(推荐200M)
|
string task_description = 4; // 任务描述
|
||||||
|
repeated FileInfo task_file_infos = 5; // 文件列表
|
||||||
|
uint64 task_block_size = 6; // 文件块字节大小(推荐200M)
|
||||||
|
|
||||||
// 以下字段只在返回时填写,用于提供服务端的任务状态。在请求时填写会被忽略
|
// 以下字段只在返回时填写,用于提供服务端的任务状态。在请求时填写会被忽略
|
||||||
string create_time = 10; // 创建时间
|
string create_time = 10; // 创建时间
|
||||||
@@ -164,9 +154,9 @@ message ReadRes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message WriteRes {
|
message WriteRes {
|
||||||
uint32 succ_cmd_count = 1; // 成功的命令数量
|
//uint32 succ_cmd_count = 1; // 成功的命令数量
|
||||||
uint32 fail_cmd_count = 2; // 失败的命令数量
|
//uint32 fail_cmd_count = 2; // 失败的命令数量
|
||||||
repeated ValueItem cmd_res = 3; // 返回的失败命令,仅填写cmd_index和cmd_code
|
repeated string failed_userid = 3; // 返回的失败的用户ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValueItem 读取命令返回内容
|
// ValueItem 读取命令返回内容
|
||||||
@@ -197,6 +187,7 @@ enum ErrorCode {
|
|||||||
QPS_LIMIT = 113; // 并发请求量超限
|
QPS_LIMIT = 113; // 并发请求量超限
|
||||||
CMDS_LIMIT = 114; // 命令数量超限
|
CMDS_LIMIT = 114; // 命令数量超限
|
||||||
CMDS_NULL = 115; // 命令为空
|
CMDS_NULL = 115; // 命令为空
|
||||||
|
DATASPACE_NOT_EXISTS = 116; // 数据空间不存在
|
||||||
|
|
||||||
TASK_EXISTS = 120; // 任务已存在
|
TASK_EXISTS = 120; // 任务已存在
|
||||||
TASK_IS_NOT_EXISTS = 121; // 任务不存在
|
TASK_IS_NOT_EXISTS = 121; // 任务不存在
|
||||||
|
|||||||
@@ -69,6 +69,10 @@ func paramClear(fs *flag.FlagSet) *bool {
|
|||||||
return fs.Bool("clear", false, "Clear all data before write")
|
return fs.Bool("clear", false, "Clear all data before write")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func paramDataSpaceId(fs *flag.FlagSet) *string {
|
||||||
|
return fs.String("ds", "", "Data space ID")
|
||||||
|
}
|
||||||
|
|
||||||
// ParseByteSize 解析字节大小字符串为字节数
|
// ParseByteSize 解析字节大小字符串为字节数
|
||||||
func ParseByteSize(sizeStr string) (uint64, error) {
|
func ParseByteSize(sizeStr string) (uint64, error) {
|
||||||
sizeStr = strings.TrimSpace(sizeStr)
|
sizeStr = strings.TrimSpace(sizeStr)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ const (
|
|||||||
type readParams struct {
|
type readParams struct {
|
||||||
cfg *Config
|
cfg *Config
|
||||||
appid string
|
appid string
|
||||||
|
ds string
|
||||||
userids []string
|
userids []string
|
||||||
saasHttp *saashttp.SaasClient
|
saasHttp *saashttp.SaasClient
|
||||||
}
|
}
|
||||||
@@ -27,6 +28,7 @@ func RunRead(args ...string) error {
|
|||||||
fs := flag.NewFlagSet("read", flag.ExitOnError)
|
fs := flag.NewFlagSet("read", flag.ExitOnError)
|
||||||
cfgFile := paramConfig(fs)
|
cfgFile := paramConfig(fs)
|
||||||
appid := paramAppid(fs)
|
appid := paramAppid(fs)
|
||||||
|
ds := paramDataSpaceId(fs)
|
||||||
userids := paramUserids(fs)
|
userids := paramUserids(fs)
|
||||||
|
|
||||||
if err := fs.Parse(args); err != nil {
|
if err := fs.Parse(args); err != nil {
|
||||||
@@ -37,11 +39,16 @@ func RunRead(args ...string) error {
|
|||||||
// 切割字符串
|
// 切割字符串
|
||||||
idsSlice := strings.Split(*userids, ",")
|
idsSlice := strings.Split(*userids, ",")
|
||||||
|
|
||||||
if fs.NArg() > 0 || len(idsSlice) == 0 || (len(idsSlice) == 1 && idsSlice[0] == "") || len(idsSlice) > getIdsMax {
|
if fs.NArg() > 0 || len(idsSlice) == 0 || (len(idsSlice) == 1 && idsSlice[0] == "") || len(idsSlice) > getIdsMax || len(*ds) == 0 {
|
||||||
fs.PrintDefaults()
|
fs.PrintDefaults()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.ToLower(*ds) == "openid" && len(*appid) == 0 {
|
||||||
|
fmt.Fprintln(os.Stderr, "appid must be set when data space is openid")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
cfg, err := LoadConfigFile(*cfgFile)
|
cfg, err := LoadConfigFile(*cfgFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "load config file error", "err", err)
|
fmt.Fprintln(os.Stderr, "load config file error", "err", err)
|
||||||
@@ -52,6 +59,7 @@ func RunRead(args ...string) error {
|
|||||||
cfg: cfg,
|
cfg: cfg,
|
||||||
userids: idsSlice,
|
userids: idsSlice,
|
||||||
appid: *appid,
|
appid: *appid,
|
||||||
|
ds: *ds,
|
||||||
saasHttp: &saashttp.SaasClient{
|
saasHttp: &saashttp.SaasClient{
|
||||||
Client: &http.Client{},
|
Client: &http.Client{},
|
||||||
ApiUrls: &cfg.ApiUrls,
|
ApiUrls: &cfg.ApiUrls,
|
||||||
@@ -63,16 +71,17 @@ func RunRead(args ...string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func doRead(readParams readParams) error {
|
func doRead(readParams readParams) error {
|
||||||
|
read := &saasapi.Read{
|
||||||
|
DataspaceId: readParams.ds,
|
||||||
|
Appid: readParams.appid,
|
||||||
|
}
|
||||||
|
|
||||||
saasReq := &saasapi.SaasReq{
|
saasReq := &saasapi.SaasReq{
|
||||||
Cmd: &saasapi.SaasReq_Read{
|
Cmd: &saasapi.SaasReq_Read{
|
||||||
Read: &saasapi.Read{},
|
Read: read,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if readParams.appid != "" {
|
|
||||||
saasReq.UseridType = saasapi.UserIdType_OPENID
|
|
||||||
saasReq.Appid = readParams.appid
|
|
||||||
}
|
|
||||||
saasReadItems := []*saasapi.ReadItem{}
|
saasReadItems := []*saasapi.ReadItem{}
|
||||||
for _, userid := range readParams.userids {
|
for _, userid := range readParams.userids {
|
||||||
saasReadItems = append(saasReadItems, &saasapi.ReadItem{
|
saasReadItems = append(saasReadItems, &saasapi.ReadItem{
|
||||||
@@ -80,7 +89,7 @@ func doRead(readParams readParams) error {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
saasReq.Cmd.(*saasapi.SaasReq_Read).Read.ReadItems = saasReadItems
|
read.ReadItems = saasReadItems
|
||||||
|
|
||||||
res, err := readParams.saasHttp.Read(saasReq)
|
res, err := readParams.saasHttp.Read(saasReq)
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import (
|
|||||||
|
|
||||||
type createTaskParams struct {
|
type createTaskParams struct {
|
||||||
hashFile string
|
hashFile string
|
||||||
appid string
|
|
||||||
task *saasapi.Task
|
task *saasapi.Task
|
||||||
saasHttp *saashttp.SaasClient
|
saasHttp *saashttp.SaasClient
|
||||||
}
|
}
|
||||||
@@ -21,9 +20,7 @@ type createTaskParams struct {
|
|||||||
func RunTaskCreate(args ...string) error {
|
func RunTaskCreate(args ...string) error {
|
||||||
fs := flag.NewFlagSet("create", flag.ExitOnError)
|
fs := flag.NewFlagSet("create", flag.ExitOnError)
|
||||||
cfgFile := paramConfig(fs)
|
cfgFile := paramConfig(fs)
|
||||||
// sourcePath := paramSourceConvertedPath(fs)
|
|
||||||
hashFile := paramInputHashFile(fs)
|
hashFile := paramInputHashFile(fs)
|
||||||
appid := paramAppid(fs)
|
|
||||||
|
|
||||||
if err := fs.Parse(args); err != nil {
|
if err := fs.Parse(args); err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "command line parse error", "err", err)
|
fmt.Fprintln(os.Stderr, "command line parse error", "err", err)
|
||||||
@@ -43,7 +40,6 @@ func RunTaskCreate(args ...string) error {
|
|||||||
|
|
||||||
createTaskParams := createTaskParams{
|
createTaskParams := createTaskParams{
|
||||||
hashFile: *hashFile,
|
hashFile: *hashFile,
|
||||||
appid: *appid,
|
|
||||||
saasHttp: &saashttp.SaasClient{
|
saasHttp: &saashttp.SaasClient{
|
||||||
Client: &http.Client{},
|
Client: &http.Client{},
|
||||||
ApiUrls: &cfg.ApiUrls,
|
ApiUrls: &cfg.ApiUrls,
|
||||||
@@ -72,11 +68,6 @@ func doTaskCreate(createTaskParams createTaskParams) error {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if createTaskParams.appid != "" {
|
|
||||||
saasReq.UseridType = saasapi.UserIdType_OPENID
|
|
||||||
saasReq.Appid = createTaskParams.appid
|
|
||||||
}
|
|
||||||
|
|
||||||
res, err := createTaskParams.saasHttp.TaskCreate(saasReq)
|
res, err := createTaskParams.saasHttp.TaskCreate(saasReq)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"e.coding.net/rta/public/saasapi"
|
"e.coding.net/rta/public/saasapi"
|
||||||
@@ -49,17 +50,24 @@ func RunTaskMake(args ...string) error {
|
|||||||
hashFile := paramOutputHashFile(fs)
|
hashFile := paramOutputHashFile(fs)
|
||||||
blockSize := paramBlockSize(fs)
|
blockSize := paramBlockSize(fs)
|
||||||
desc := paramTaskDesc(fs)
|
desc := paramTaskDesc(fs)
|
||||||
|
appid := paramAppid(fs)
|
||||||
|
ds := paramDataSpaceId(fs)
|
||||||
|
|
||||||
if err := fs.Parse(args); err != nil {
|
if err := fs.Parse(args); err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "command line parse error", "err", err)
|
fmt.Fprintln(os.Stderr, "command line parse error", "err", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if fs.NArg() > 0 || len(*sourcePath) == 0 || len(*hashFile) == 0 {
|
if fs.NArg() > 0 || len(*sourcePath) == 0 || len(*hashFile) == 0 || len(*ds) == 0 {
|
||||||
fs.PrintDefaults()
|
fs.PrintDefaults()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.ToLower(*ds) == "openid" && len(*appid) == 0 {
|
||||||
|
fmt.Fprintln(os.Stderr, "appid must be set when data space is openid")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
blockSizeNum, err := ParseByteSize(*blockSize)
|
blockSizeNum, err := ParseByteSize(*blockSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "Error parsing block size", "err", err)
|
fmt.Fprintln(os.Stderr, "Error parsing block size", "err", err)
|
||||||
@@ -79,6 +87,8 @@ func RunTaskMake(args ...string) error {
|
|||||||
task: &saasapi.Task{
|
task: &saasapi.Task{
|
||||||
TaskBlockSize: blockSizeNum,
|
TaskBlockSize: blockSizeNum,
|
||||||
TaskDescription: *desc,
|
TaskDescription: *desc,
|
||||||
|
Appid: *appid,
|
||||||
|
DataspaceId: *ds,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return doMakeHash(makeTaskParams)
|
return doMakeHash(makeTaskParams)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"e.coding.net/rta/public/saasapi"
|
"e.coding.net/rta/public/saasapi"
|
||||||
"e.coding.net/rta/public/saasapi/pkg/saashttp"
|
"e.coding.net/rta/public/saasapi/pkg/saashttp"
|
||||||
@@ -17,6 +18,7 @@ type writeParams struct {
|
|||||||
cfg *Config
|
cfg *Config
|
||||||
sourcePath string
|
sourcePath string
|
||||||
appid string
|
appid string
|
||||||
|
ds string
|
||||||
batchSize uint
|
batchSize uint
|
||||||
clear bool
|
clear bool
|
||||||
saasHttp *saashttp.SaasClient
|
saasHttp *saashttp.SaasClient
|
||||||
@@ -27,6 +29,7 @@ func RunWrite(args ...string) error {
|
|||||||
cfgFile := paramConfig(fs)
|
cfgFile := paramConfig(fs)
|
||||||
sourcePath := paramSourcePath(fs)
|
sourcePath := paramSourcePath(fs)
|
||||||
appid := paramAppid(fs)
|
appid := paramAppid(fs)
|
||||||
|
ds := paramDataSpaceId(fs)
|
||||||
batchSize := paramBatchSize(fs)
|
batchSize := paramBatchSize(fs)
|
||||||
clear := paramClear(fs)
|
clear := paramClear(fs)
|
||||||
|
|
||||||
@@ -35,11 +38,16 @@ func RunWrite(args ...string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if fs.NArg() > 0 || len(*sourcePath) == 0 {
|
if fs.NArg() > 0 || len(*sourcePath) == 0 || len(*ds) == 0 {
|
||||||
fs.PrintDefaults()
|
fs.PrintDefaults()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.ToLower(*ds) == "openid" && len(*appid) == 0 {
|
||||||
|
fmt.Fprintln(os.Stderr, "appid must be set when data space is openid")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
cfg, err := LoadConfigFile(*cfgFile)
|
cfg, err := LoadConfigFile(*cfgFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "load config file error", "err", err)
|
fmt.Fprintln(os.Stderr, "load config file error", "err", err)
|
||||||
@@ -50,6 +58,7 @@ func RunWrite(args ...string) error {
|
|||||||
cfg: cfg,
|
cfg: cfg,
|
||||||
sourcePath: *sourcePath,
|
sourcePath: *sourcePath,
|
||||||
appid: *appid,
|
appid: *appid,
|
||||||
|
ds: *ds,
|
||||||
batchSize: *batchSize,
|
batchSize: *batchSize,
|
||||||
clear: *clear,
|
clear: *clear,
|
||||||
saasHttp: &saashttp.SaasClient{
|
saasHttp: &saashttp.SaasClient{
|
||||||
@@ -107,9 +116,9 @@ func doLoadFileToWrite(writeParams writeParams) error {
|
|||||||
|
|
||||||
saasWriteItems := []*saasapi.WriteItem{}
|
saasWriteItems := []*saasapi.WriteItem{}
|
||||||
|
|
||||||
succ := uint32(0)
|
errCount := 0
|
||||||
succTotal := uint32(0)
|
errTotal := 0
|
||||||
total := uint32(0)
|
total := 0
|
||||||
for scaner.Scan() {
|
for scaner.Scan() {
|
||||||
total++
|
total++
|
||||||
line := scaner.Text()
|
line := scaner.Text()
|
||||||
@@ -125,45 +134,42 @@ func doLoadFileToWrite(writeParams writeParams) error {
|
|||||||
saasWriteItems = append(saasWriteItems, saasWriteItem)
|
saasWriteItems = append(saasWriteItems, saasWriteItem)
|
||||||
|
|
||||||
if len(saasWriteItems) == int(writeParams.batchSize) {
|
if len(saasWriteItems) == int(writeParams.batchSize) {
|
||||||
if succ, _, err = submitWrite(writeParams, saasWriteItems); err != nil {
|
if errCount, err = submitWrite(writeParams, saasWriteItems); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
succTotal += succ
|
errTotal += errCount
|
||||||
fmt.Printf("[%v] batch_succ = %v, succ_total = %v, total_processed = %v\n", writeParams.sourcePath, succ, succTotal, total)
|
fmt.Printf("[%v] err_batch = %v, err_total = %v, total_processed = %v\n", writeParams.sourcePath, errCount, errTotal, total)
|
||||||
|
|
||||||
saasWriteItems = saasWriteItems[:0]
|
saasWriteItems = saasWriteItems[:0]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(saasWriteItems) > 0 {
|
if len(saasWriteItems) > 0 {
|
||||||
if succ, _, err = submitWrite(writeParams, saasWriteItems); err != nil {
|
if errCount, err = submitWrite(writeParams, saasWriteItems); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
succTotal += succ
|
errTotal += errCount
|
||||||
fmt.Printf("[%v] batch_succ = %v, succ_total = %v, total_processed = %v\n", writeParams.sourcePath, succ, succTotal, total)
|
fmt.Printf("[%v] err_batch = %v, err_total = %v, total_processed = %v\n", writeParams.sourcePath, errCount, errTotal, total)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func submitWrite(writeParams writeParams, saasWriteCmds []*saasapi.WriteItem) (succ, total uint32, err error) {
|
func submitWrite(writeParams writeParams, saasWriteCmds []*saasapi.WriteItem) (errcount int, err error) {
|
||||||
|
write := &saasapi.Write{
|
||||||
|
DataspaceId: writeParams.ds,
|
||||||
|
Appid: writeParams.appid,
|
||||||
|
IsClearAllFirst: writeParams.clear,
|
||||||
|
}
|
||||||
saasReq := &saasapi.SaasReq{
|
saasReq := &saasapi.SaasReq{
|
||||||
Cmd: &saasapi.SaasReq_Write{
|
Cmd: &saasapi.SaasReq_Write{
|
||||||
Write: &saasapi.Write{
|
Write: write,
|
||||||
IsClearAllFirst: writeParams.clear,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if writeParams.appid != "" {
|
write.WriteItems = saasWriteCmds
|
||||||
saasReq.UseridType = saasapi.UserIdType_OPENID
|
|
||||||
saasReq.Appid = writeParams.appid
|
|
||||||
}
|
|
||||||
|
|
||||||
saasReq.Cmd.(*saasapi.SaasReq_Write).Write.WriteItems = saasWriteCmds
|
|
||||||
|
|
||||||
total = uint32(len(saasWriteCmds))
|
|
||||||
res, err := writeParams.saasHttp.Write(saasReq)
|
res, err := writeParams.saasHttp.Write(saasReq)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -177,5 +183,5 @@ func submitWrite(writeParams writeParams, saasWriteCmds []*saasapi.WriteItem) (s
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
return res.GetWriteRes().GetSuccCmdCount(), total, nil
|
return len(res.GetWriteRes().GetFailedUserid()), nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user