存算联动接口修改
Former-commit-id: 5c89390c0869093f5e9d33a1fa40cb283b90ba5b
This commit is contained in:
parent
68cde61a44
commit
6abe1381e7
|
@ -300,4 +300,16 @@ service pcm {
|
||||||
|
|
||||||
@handler GetLinkImageListHandler
|
@handler GetLinkImageListHandler
|
||||||
get /storelink/getImageList (GetLinkImageListReq) returns (GetLinkImageListResp)
|
get /storelink/getImageList (GetLinkImageListReq) returns (GetLinkImageListResp)
|
||||||
|
|
||||||
|
@handler DeleteLinkImageHandler
|
||||||
|
delete /storelink/deleteImageList (DeleteLinkImageReq) returns (DeleteLinkImageResp)
|
||||||
|
|
||||||
|
@handler SubmitLinkTaskHandler
|
||||||
|
post /storelink/submitLinkTask (SubmitLinkTaskReq) returns (SubmitLinkTaskResp)
|
||||||
|
|
||||||
|
@handler GetLinkTaskHandler
|
||||||
|
get /storelink/getLinkTask (GetLinkTaskReq) returns (GetLinkTaskResp)
|
||||||
|
|
||||||
|
@handler DeleteLinkTaskHandler
|
||||||
|
delete /storelink/deleteLinkTask (DeleteLinkTaskReq) returns (DeleteLinkTaskResp)
|
||||||
}
|
}
|
|
@ -9,7 +9,8 @@ info(
|
||||||
|
|
||||||
type (
|
type (
|
||||||
UploadLinkImageReq {
|
UploadLinkImageReq {
|
||||||
|
PartId int64 `json:"partId"`
|
||||||
|
FilePath string `json:"filePath"`
|
||||||
}
|
}
|
||||||
|
|
||||||
UploadLinkImageImageResp {
|
UploadLinkImageImageResp {
|
||||||
|
@ -23,4 +24,34 @@ type (
|
||||||
GetLinkImageListResp {
|
GetLinkImageListResp {
|
||||||
ImageIds []int64 `json:"imageIds"`
|
ImageIds []int64 `json:"imageIds"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeleteLinkImageReq {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
DeleteLinkImageResp {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SubmitLinkTaskReq {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SubmitLinkTaskResp {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GetLinkTaskReq {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GetLinkTaskResp {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
DeleteLinkTaskReq {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
DeleteLinkTaskResp {}
|
||||||
)
|
)
|
|
@ -20,7 +20,7 @@ func NewOctopusLink(ctx context.Context, svcCtx *svc.ServiceContext, platform st
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OctopusLink) UploadImage() (interface{}, error) {
|
func (o *OctopusLink) UploadImage() (interface{}, error) {
|
||||||
var uploadResp types.UploadLinkImageImageResp
|
var resp types.UploadLinkImageImageResp
|
||||||
|
|
||||||
createReq := &octopus.CreateImageReq{
|
createReq := &octopus.CreateImageReq{
|
||||||
Platform: o.platform,
|
Platform: o.platform,
|
||||||
|
@ -36,22 +36,32 @@ func (o *OctopusLink) UploadImage() (interface{}, error) {
|
||||||
ImageId: createResp.Payload.ImageId,
|
ImageId: createResp.Payload.ImageId,
|
||||||
Params: &octopus.UploadImageParam{},
|
Params: &octopus.UploadImageParam{},
|
||||||
}
|
}
|
||||||
octUpResp, err := o.svcCtx.OctopusRpc.UploadImage(o.ctx, uploadReq)
|
uploadResp, err := o.svcCtx.OctopusRpc.UploadImage(o.ctx, uploadReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
octUpResp.String()
|
uploadResp.String()
|
||||||
return uploadResp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OctopusLink) DeleteImage() (interface{}, error) {
|
func (o *OctopusLink) DeleteImage() (interface{}, error) {
|
||||||
//TODO implement me
|
req := &octopus.DeleteImageReq{
|
||||||
panic("implement me")
|
Platform: o.platform,
|
||||||
|
}
|
||||||
|
resp, err := o.svcCtx.OctopusRpc.DeleteImage(o.ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteResp, err := ConvertType[octopus.DeleteImageResp](resp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return deleteResp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OctopusLink) QueryImageList() (interface{}, error) {
|
func (o *OctopusLink) QueryImageList() (interface{}, error) {
|
||||||
var imgListResp types.GetLinkImageListResp
|
|
||||||
|
|
||||||
req := &octopus.GetUserImageListReq{
|
req := &octopus.GetUserImageListReq{
|
||||||
Platform: o.platform,
|
Platform: o.platform,
|
||||||
PageIndex: o.pageIndex,
|
PageIndex: o.pageIndex,
|
||||||
|
@ -62,26 +72,62 @@ func (o *OctopusLink) QueryImageList() (interface{}, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
imgListResp.ImageIds = append(imgListResp.ImageIds, resp.Payload.Images[0].Image.CreatedAt)
|
imgListResp, err := ConvertType[octopus.GetUserImageListResp](resp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return imgListResp, nil
|
return imgListResp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OctopusLink) SubmitTask() (interface{}, error) {
|
func (o *OctopusLink) SubmitTask() (interface{}, error) {
|
||||||
//req := &octopus.CreateTrainJobReq{}
|
req := &octopus.CreateTrainJobReq{
|
||||||
//TODO implement me
|
Platform: o.platform,
|
||||||
panic("implement me")
|
Params: &octopus.CreateTrainJobParam{},
|
||||||
|
}
|
||||||
|
resp, err := o.svcCtx.OctopusRpc.CreateTrainJob(o.ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
submitResp, err := ConvertType[octopus.CreateTrainJobResp](resp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return submitResp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OctopusLink) QueryTask() (interface{}, error) {
|
func (o *OctopusLink) QueryTask() (interface{}, error) {
|
||||||
//TODO implement me
|
req := &octopus.GetTrainJobReq{
|
||||||
panic("implement me")
|
Platform: o.platform,
|
||||||
|
}
|
||||||
|
resp, err := o.svcCtx.OctopusRpc.GetTrainJob(o.ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
taskResp, err := ConvertType[octopus.GetTrainJobResp](resp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return taskResp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OctopusLink) DeleteTask() (interface{}, error) {
|
func (o *OctopusLink) DeleteTask() (interface{}, error) {
|
||||||
//TODO implement me
|
req := &octopus.DeleteTrainJobReq{
|
||||||
panic("implement me")
|
Platform: o.platform,
|
||||||
}
|
}
|
||||||
|
resp, err := o.svcCtx.OctopusRpc.DeleteTrainJob(o.ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
func (o *OctopusLink) name() {
|
deleteResp, err := ConvertType[octopus.DeleteTrainJobResp](resp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return deleteResp, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,10 @@ package storeLink
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"github.com/pkg/errors"
|
||||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
|
||||||
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
|
||||||
|
"gitlink.org.cn/jcce-pcm/pcm-participant-octopus/octopus"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Linkage interface {
|
type Linkage interface {
|
||||||
|
@ -22,3 +25,17 @@ func NewStoreLink(ctx context.Context, svcCtx *svc.ServiceContext, partId int64)
|
||||||
linkStruct := NewOctopusLink(ctx, svcCtx, "hanwuji")
|
linkStruct := NewOctopusLink(ctx, svcCtx, "hanwuji")
|
||||||
return &StoreLink{ILinkage: linkStruct}
|
return &StoreLink{ILinkage: linkStruct}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ConvertType[T any](in *T) (interface{}, error) {
|
||||||
|
|
||||||
|
switch (interface{})(in).(type) {
|
||||||
|
case *octopus.GetUserImageListResp:
|
||||||
|
var imgListResp types.GetLinkImageListResp
|
||||||
|
resp := (interface{})(in).(*octopus.GetUserImageListResp)
|
||||||
|
imgListResp.ImageIds = append(imgListResp.ImageIds, resp.Payload.Images[0].Image.CreatedAt)
|
||||||
|
imgListResp.ImageIds = append(imgListResp.ImageIds, resp.Payload.Images[0].Image.CreatedAt)
|
||||||
|
return imgListResp, nil
|
||||||
|
default:
|
||||||
|
return nil, errors.New("type convert fail")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue