types.go 556 B

123456789101112131415161718192021222324252627282930313233343536
  1. package server
  2. import (
  3. "time"
  4. "github.com/gorilla/websocket"
  5. )
  6. type Agent struct {
  7. Name string
  8. Reg time.Time
  9. Cores int
  10. Cpu []int
  11. Mem_max float64
  12. Mem_usg []float64
  13. TaskId int
  14. conn *websocket.Conn
  15. }
  16. type Task struct {
  17. Status int // 0: Available; 1: Busy; 2: (Un)solved;
  18. Puzzle [9]string
  19. Solutions [][]string
  20. }
  21. type Server struct {
  22. ListenAddress string
  23. ListenPort int
  24. Agents map[string]*Agent
  25. Tasks []*Task
  26. }
  27. var upgrader = websocket.Upgrader{
  28. ReadBufferSize: 1024,
  29. WriteBufferSize: 1024,
  30. }