存算联动部分接口
Former-commit-id: c6b845f908de8d5bc6e47ac588d8e1002664d2ce
This commit is contained in:
parent
ca89c90070
commit
91078c2684
|
@ -2,7 +2,7 @@ package storelink
|
|||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/pkg/storeLink"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
|
||||
|
||||
|
@ -24,7 +24,13 @@ func NewGetLinkImageListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
|
|||
}
|
||||
|
||||
func (l *GetLinkImageListLogic) GetLinkImageList(req *types.GetLinkImageListReq) (resp *types.GetLinkImageListResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var imgListResp types.GetLinkImageListResp
|
||||
storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, req.PartId)
|
||||
imageList, err := storelink.ILinkage.QueryImageList()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return
|
||||
imgListResp = imageList.(types.GetLinkImageListResp)
|
||||
return &imgListResp, nil
|
||||
}
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
package storeLink
|
||||
|
||||
import (
|
||||
"context"
|
||||
"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 OctopusLink struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
platform string
|
||||
pageIndex int32
|
||||
pageSize int32
|
||||
}
|
||||
|
||||
func NewOctopusLink(ctx context.Context, svcCtx *svc.ServiceContext, platform string) *OctopusLink {
|
||||
return &OctopusLink{ctx: ctx, svcCtx: svcCtx, platform: platform, pageIndex: 1, pageSize: 100}
|
||||
}
|
||||
|
||||
func (o *OctopusLink) UploadImage() (interface{}, error) {
|
||||
var uploadResp types.UploadLinkImageImageResp
|
||||
|
||||
createReq := &octopus.CreateImageReq{
|
||||
Platform: o.platform,
|
||||
CreateImage: &octopus.CreateImage{
|
||||
SourceType: 1,
|
||||
},
|
||||
}
|
||||
createResp, err := o.svcCtx.OctopusRpc.CreateImage(o.ctx, createReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
uploadReq := &octopus.UploadImageReq{
|
||||
ImageId: createResp.Payload.ImageId,
|
||||
Params: &octopus.UploadImageParam{},
|
||||
}
|
||||
octUpResp, err := o.svcCtx.OctopusRpc.UploadImage(o.ctx, uploadReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
octUpResp.String()
|
||||
return uploadResp, nil
|
||||
}
|
||||
|
||||
func (o *OctopusLink) DeleteImage() (interface{}, error) {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (o *OctopusLink) QueryImageList() (interface{}, error) {
|
||||
var imgListResp types.GetLinkImageListResp
|
||||
|
||||
req := &octopus.GetUserImageListReq{
|
||||
Platform: o.platform,
|
||||
PageIndex: o.pageIndex,
|
||||
PageSize: o.pageSize,
|
||||
}
|
||||
resp, err := o.svcCtx.OctopusRpc.GetUserImageList(o.ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
imgListResp.ImageIds = append(imgListResp.ImageIds, resp.Payload.Images[0].Image.CreatedAt)
|
||||
return imgListResp, nil
|
||||
}
|
||||
|
||||
func (o *OctopusLink) SubmitTask() (interface{}, error) {
|
||||
//req := &octopus.CreateTrainJobReq{}
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (o *OctopusLink) QueryTask() (interface{}, error) {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (o *OctopusLink) DeleteTask() (interface{}, error) {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (o *OctopusLink) name() {
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package storeLink
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
|
||||
)
|
||||
|
||||
type Linkage interface {
|
||||
UploadImage() (interface{}, error)
|
||||
DeleteImage() (interface{}, error)
|
||||
QueryImageList() (interface{}, error)
|
||||
SubmitTask() (interface{}, error)
|
||||
QueryTask() (interface{}, error)
|
||||
DeleteTask() (interface{}, error)
|
||||
}
|
||||
|
||||
type StoreLink struct {
|
||||
ILinkage Linkage
|
||||
}
|
||||
|
||||
func NewStoreLink(ctx context.Context, svcCtx *svc.ServiceContext, partId int64) *StoreLink {
|
||||
linkStruct := NewOctopusLink(ctx, svcCtx, "hanwuji")
|
||||
return &StoreLink{ILinkage: linkStruct}
|
||||
}
|
Loading…
Reference in New Issue