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.

datasetchecklogic.go 867 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package image
  2. import (
  3. "context"
  4. "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models"
  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 DataSetCheckLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewDataSetCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DataSetCheckLogic {
  15. return &DataSetCheckLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *DataSetCheckLogic) DataSetCheck(req *types.CheckReq) (resp *types.CheckResp, err error) {
  22. resp = &types.CheckResp{}
  23. var dataSets []models.File
  24. l.svcCtx.DbEngin.Find(&dataSets).Where("md5", req.FileMd5)
  25. if len(dataSets) != 0 {
  26. resp.Exist = true
  27. } else {
  28. resp.Exist = false
  29. }
  30. return resp, nil
  31. }

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.