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.

aiStorage.go 1.0 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package database
  2. import (
  3. "github.com/zeromicro/go-zero/core/logx"
  4. "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
  5. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants"
  6. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
  7. "gorm.io/gorm"
  8. "time"
  9. )
  10. type AiStorage struct {
  11. DbEngin *gorm.DB
  12. }
  13. func (s *AiStorage) GetParticipants() (*types.ClusterListResp, error) {
  14. var resp types.ClusterListResp
  15. tx := s.DbEngin.Raw("select * from t_cluster where `deleted_at` IS NULL ORDER BY create_time Desc").Scan(&resp.List)
  16. if tx.Error != nil {
  17. logx.Errorf(tx.Error.Error())
  18. return nil, tx.Error
  19. }
  20. return &resp, nil
  21. }
  22. func (s *AiStorage) SaveTask(name string) error {
  23. // 构建主任务结构体
  24. taskModel := models.Task{
  25. Status: constants.Saved,
  26. Description: "ai task",
  27. Name: name,
  28. CommitTime: time.Now(),
  29. }
  30. // 保存任务数据到数据库
  31. tx := s.DbEngin.Create(&taskModel)
  32. if tx.Error != nil {
  33. return tx.Error
  34. }
  35. return nil
  36. }
  37. func (s *AiStorage) UpdateTask() error {
  38. return nil
  39. }

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.