-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdata.go
49 lines (37 loc) · 1.07 KB
/
data.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"fmt"
"time"
)
// This one should create independent channels for each user and priority and
// manage their buffer sizes dynamically updating them every N seconds. Sum
// of all queue channels should be always equal to total T specified in config.
type Process struct {
Priority int
AwaitQueue chan struct{}
CapacityQueue Queue
LastActivity time.Time
}
type BrowserStatus struct {
Name string `json:"name"`
Processes map[string]ProcessStatus `json:"processes"`
}
type ProcessStatus struct {
Priority int `json:"priority"`
Queued int `json:"queued"`
Processing int `json:"processing"`
Max int `json:"max"`
LastActivity string `json:"lastActivity"`
}
type ProcessMetrics map[string]int
type BrowserState map[string]*Process
type BrowserId struct {
Name string
Version string
}
func (b BrowserId) String() string {
return fmt.Sprintf("%s_%s", b.Name, b.Version)
}
type QuotaState map[BrowserId]*BrowserState
type State map[string]*QuotaState
type Sessions map[string]*Process