Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions media/apis/prefop/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,31 @@ type Response struct {

// 返回的持久化数据处理任务中的云处理操作状态
type PfopTaskItem struct {
Command string // 云操作命令
Code int64 // 云操作状态码
Description string // 与状态码相对应的详细描述
Error string // 如果处理失败,该字段会给出失败的详细原因
Hash string // 云处理结果保存在服务端的唯一标识
ObjectName string // 云处理结果的外链对象名称
ReturnOld int64 // 是否返回了旧的数据
Command string // 云操作命令
Code int64 // 云操作状态码
Description string // 与状态码相对应的详细描述
Error string // 如果处理失败,该字段会给出失败的详细原因
Hash string // 云处理结果保存在服务端的唯一标识
ObjectName string // 云处理结果的外链对象名称
Keys []string // 云处理生成的多个结果的外链对象名称列表
ReturnOld int64 // 是否返回了旧的数据
}
type jsonPfopTaskItem struct {
Command string `json:"cmd"` // 云操作命令
Code int64 `json:"code"` // 云操作状态码
Description string `json:"desc"` // 与状态码相对应的详细描述
Error string `json:"error,omitempty"` // 如果处理失败,该字段会给出失败的详细原因
Hash string `json:"hash"` // 云处理结果保存在服务端的唯一标识
ObjectName string `json:"key"` // 云处理结果的外链对象名称
ReturnOld int64 `json:"returnOld"` // 是否返回了旧的数据
Command string `json:"cmd"` // 云操作命令
Code int64 `json:"code"` // 云操作状态码
Description string `json:"desc"` // 与状态码相对应的详细描述
Error string `json:"error,omitempty"` // 如果处理失败,该字段会给出失败的详细原因
Hash string `json:"hash"` // 云处理结果保存在服务端的唯一标识
ObjectName string `json:"key"` // 云处理结果的外链对象名称
Keys []string `json:"keys,omitempty"` // 云处理生成的多个结果的外链对象名称列表
ReturnOld int64 `json:"returnOld"` // 是否返回了旧的数据
}

func (j *PfopTaskItem) MarshalJSON() ([]byte, error) {
if err := j.validate(); err != nil {
return nil, err
}
return json.Marshal(&jsonPfopTaskItem{Command: j.Command, Code: j.Code, Description: j.Description, Error: j.Error, Hash: j.Hash, ObjectName: j.ObjectName, ReturnOld: j.ReturnOld})
return json.Marshal(&jsonPfopTaskItem{Command: j.Command, Code: j.Code, Description: j.Description, Error: j.Error, Hash: j.Hash, ObjectName: j.ObjectName, Keys: j.Keys, ReturnOld: j.ReturnOld})
}
func (j *PfopTaskItem) UnmarshalJSON(data []byte) error {
var nj jsonPfopTaskItem
Expand All @@ -67,6 +69,7 @@ func (j *PfopTaskItem) UnmarshalJSON(data []byte) error {
j.Error = nj.Error
j.Hash = nj.Hash
j.ObjectName = nj.ObjectName
j.Keys = nj.Keys
j.ReturnOld = nj.ReturnOld
return nil
}
Expand Down
1 change: 1 addition & 0 deletions storage/pfop.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ func (m *OperationManager) Prefop(persistentID string) (PrefopRet, error) {
Error: item.Error,
Hash: item.Hash,
Key: item.ObjectName,
Keys: item.Keys,
})
}
return ret, nil
Expand Down
Loading