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.

getaispecslogic.go 1.2 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package storelink
  2. import (
  3. "context"
  4. "github.com/zeromicro/go-zero/core/logx"
  5. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/storeLink"
  6. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
  7. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
  8. "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models"
  9. )
  10. type GetAISpecsLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewGetAISpecsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAISpecsLogic {
  16. return &GetAISpecsLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *GetAISpecsLogic) GetAISpecs(req *types.GetResourceSpecsReq) (resp *types.GetResourceSpecsResp, err error) {
  23. participant := storeLink.GetParticipantById(req.PartId, l.svcCtx.DbEngin)
  24. if *participant == (models.StorelinkCenter{}) {
  25. resp = &types.GetResourceSpecsResp{}
  26. resp.Success = false
  27. resp.ResourceSpecs = nil
  28. resp.ErrorMsg = "partId不存在"
  29. return resp, nil
  30. }
  31. storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant)
  32. specs, err := storelink.ILinkage.QuerySpecs()
  33. if err != nil {
  34. return nil, err
  35. }
  36. specsResp := specs.(types.GetResourceSpecsResp)
  37. return &specsResp, nil
  38. }

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.