-
Notifications
You must be signed in to change notification settings - Fork 4
/
event_types.go
104 lines (78 loc) · 2.85 KB
/
event_types.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package hush
import "time"
type InstallEvent struct {
Type InstallEventType `json:"type"`
Timestamp time.Time `json:"timestamp"`
Heal *HealInstallEvent `json:"heal,omitempty"`
Install *InstallInstallEvent `json:"install,omitempty"`
Upgrade *UpgradeInstallEvent `json:"upgrade,omitempty"`
GhostBusting *GhostBustingInstallEvent `json:"ghostBusting,omitempty"`
Patching *PatchingInstallEvent `json:"patching,omitempty"`
Problem *ProblemInstallEvent `json:"problem,omitempty"`
Fallback *FallbackInstallEvent `json:"fallback,omitempty"`
}
type InstallEventType string
const (
// Started for the first time or resumed after a pause
// or exit or whatever
InstallEventResume InstallEventType = "resume"
// Stopped explicitly (pausing downloads), can't rely
// on this being present because BRÜTAL PÖWER LÖSS will
// not announce itself 🔥
InstallEventStop InstallEventType = "stop"
// Regular install from archive or naked file
InstallEventInstall InstallEventType = "install"
// Reverting to previous version or re-installing
// wharf-powered upload
InstallEventHeal InstallEventType = "heal"
// Applying one or more wharf patches
InstallEventUpgrade InstallEventType = "upgrade"
// Applying a single wharf patch
InstallEventPatching InstallEventType = "patching"
// Cleaning up ghost files
InstallEventGhostBusting InstallEventType = "ghostBusting"
// Any kind of step failing
InstallEventProblem InstallEventType = "problem"
// Any operation we do as a result of another one failing,
// but in a case where we're still expecting a favorable
// outcome eventually.
InstallEventFallback InstallEventType = "fallback"
)
type InstallInstallEvent struct {
Manager string `json:"manager"`
}
type HealInstallEvent struct {
TotalCorrupted int64 `json:"totalCorrupted"`
AppliedCaseFixes bool `json:"appliedCaseFixes"`
}
type UpgradeInstallEvent struct {
NumPatches int `json:"numPatches"`
}
type ProblemInstallEvent struct {
// Short error
Error string `json:"error"`
// Longer error
ErrorStack string `json:"errorStack"`
}
type FallbackInstallEvent struct {
// Name of the operation we were trying to do
Attempted string `json:"attempted"`
// Problem encountered while trying "attempted"
Problem ProblemInstallEvent `json:"problem"`
// Name of the operation we're falling back to
NowTrying string `json:"nowTrying"`
}
type PatchingInstallEvent struct {
// Build we patched to
BuildID int64 `json:"buildID"`
// "default" or "optimized" (for the +bsdiff variant)
Subtype string `json:"subtype"`
}
type GhostBustingInstallEvent struct {
// Operation that requested the ghost busting (install, upgrade, heal)
Operation string `json:"operation"`
// Number of ghost files found
Found int64 `json:"found"`
// Number of ghost files removed
Removed int64 `json:"removed"`
}