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.

takFIFO.go 851 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package fifo
  2. import "strings"
  3. const (
  4. CLOUD string = "Cloud"
  5. AI string = "Ai"
  6. HPC string = "Hpc"
  7. )
  8. type TaskFIFO struct {
  9. Queues []*Queue
  10. }
  11. // NewChannel 初始化队列
  12. func NewChannel() *TaskFIFO {
  13. channel := TaskFIFO{
  14. Queues: []*Queue{
  15. {
  16. ResourceType: CLOUD,
  17. },
  18. {
  19. ResourceType: AI,
  20. },
  21. {
  22. ResourceType: HPC,
  23. },
  24. },
  25. }
  26. return &channel
  27. }
  28. // SelectQueue 根据资源类型查询队列数组
  29. func (c *TaskFIFO) SelectQueue(resourceType string) *Queue {
  30. for _, queue := range c.Queues {
  31. if strings.EqualFold(queue.ResourceType, resourceType) {
  32. return queue
  33. }
  34. }
  35. return nil
  36. }
  37. func main() {
  38. channel := NewChannel()
  39. cloudQueue := channel.SelectQueue("cloud")
  40. dataList := []IData{
  41. &Data{
  42. TaskType: "cloud",
  43. Data: &Cloud{}},
  44. }
  45. cloudQueue.Push(&dataList)
  46. println(len(dataList))
  47. }

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.