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.

getclusterlogic.go 846 B

123456789101112131415161718192021222324252627282930313233343536
  1. package adapters
  2. import (
  3. "context"
  4. "github.com/pkg/errors"
  5. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
  6. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type GetClusterLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewGetClusterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetClusterLogic {
  15. return &GetClusterLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *GetClusterLogic) GetCluster(req *types.FId) (resp *types.ClusterInfo, err error) {
  22. resp = &types.ClusterInfo{}
  23. db := l.svcCtx.DbEngin.Table("t_cluster").Where("id = ?", req.Id).First(&resp)
  24. if db.Error != nil {
  25. logx.Errorf("err %v", db.Error.Error())
  26. return nil, errors.New("Adapter does not exist")
  27. }
  28. return
  29. }

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.