| 123456789101112131415161718192021222324252627282930313233343536 |
- package server
- import (
- "time"
- "github.com/gorilla/websocket"
- )
- type Agent struct {
- Name string
- Reg time.Time
- Cores int
- Cpu []int
- Mem_max float64
- Mem_usg []float64
- TaskId int
- conn *websocket.Conn
- }
- type Task struct {
- Status int // 0: Available; 1: Busy; 2: (Un)solved;
- Puzzle [9]string
- Solutions [][]string
- }
- type Server struct {
- ListenAddress string
- ListenPort int
- Agents map[string]*Agent
- Tasks []*Task
- }
- var upgrader = websocket.Upgrader{
- ReadBufferSize: 1024,
- WriteBufferSize: 1024,
- }
|