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.

cloudlistlogic.go 921 B

123456789101112131415161718192021222324252627282930313233343536
  1. package cloud
  2. import (
  3. "context"
  4. "github.com/zeromicro/go-zero/core/logx"
  5. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
  6. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
  7. "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models"
  8. "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/utils"
  9. )
  10. type CloudListLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewCloudListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CloudListLogic {
  16. return &CloudListLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *CloudListLogic) CloudList() (resp *types.CloudListResp, err error) {
  23. // 查询数据库中数算任务列表
  24. var clouds []*models.Cloud
  25. tx := l.svcCtx.DbEngin.Find(&clouds)
  26. if tx.Error != nil {
  27. return nil, tx.Error
  28. }
  29. result := types.CloudListResp{}
  30. utils.Convert(clouds, &result.Clouds)
  31. return &result, nil
  32. }

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.