You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

submitlinktasklogic.go 1.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package storelink
  2. import (
  3. "context"
  4. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/storeLink"
  5. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
  6. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type SubmitLinkTaskLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewSubmitLinkTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SubmitLinkTaskLogic {
  15. return &SubmitLinkTaskLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *SubmitLinkTaskLogic) SubmitLinkTask(req *types.SubmitLinkTaskReq) (resp *types.SubmitLinkTaskResp, err error) {
  22. storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, req.PartId)
  23. var envs []string
  24. if len(req.Envs) != 0 {
  25. for _, v := range req.Envs {
  26. env := v.Key + storeLink.COMMA + v.Val
  27. envs = append(envs, env)
  28. }
  29. }
  30. task, err := storelink.ILinkage.SubmitTask(req.ImageId, req.Cmd, envs)
  31. if err != nil {
  32. return nil, err
  33. }
  34. taskResp := task.(types.SubmitLinkTaskResp)
  35. return &taskResp, nil
  36. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.