minewebgen - internal/data/serverSettings.go
1 package data
2
3 import "sync"
4
5 type State int
6
7 const (
8 StateStopped State = iota
9 StateStarting
10 StateRunning
11 StateStopping
12 StateBusy
13 )
14
15 func (s State) String() string {
16 switch s {
17 case StateStopped:
18 return "Stopped"
19 case StateStarting:
20 return "Starting"
21 case StateRunning:
22 return "Running"
23 case StateStopping:
24 return "Stopping"
25 case StateBusy:
26 return "Busy"
27 }
28 return ""
29 }
30
31 type ServerSettings struct {
32 ServerName string
33 ListenAddr string
34 DirServers, DirMaps, DirGenerators string
35 GeneratorExecutable string
36 GeneratorMaxMem uint64
37 }
38
39 type Server struct {
40 ID int
41 Path string
42
43 sync.RWMutex `json:"-"`
44 Name string
45 Args []string
46 Map int
47 State State
48 }
49
50 type Map struct {
51 ID int
52 Path string
53
54 sync.RWMutex `json:"-"`
55 Name string
56 Server int
57 }
58
59 type Generator struct {
60 ID int
61 Path string
62 Name string
63 }