forked from keybase/client
/
notify_runtimestats.go
183 lines (158 loc) · 4.97 KB
/
notify_runtimestats.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
// Auto-generated by avdl-compiler v1.4.0 (https://github.com/keybase/node-avdl-compiler)
// Input file: avdl/keybase1/notify_runtimestats.avdl
package keybase1
import (
"github.com/keybase/go-framed-msgpack-rpc/rpc"
context "golang.org/x/net/context"
)
type StatsSeverityLevel int
const (
StatsSeverityLevel_NORMAL StatsSeverityLevel = 0
StatsSeverityLevel_WARNING StatsSeverityLevel = 1
StatsSeverityLevel_SEVERE StatsSeverityLevel = 2
)
func (o StatsSeverityLevel) DeepCopy() StatsSeverityLevel { return o }
var StatsSeverityLevelMap = map[string]StatsSeverityLevel{
"NORMAL": 0,
"WARNING": 1,
"SEVERE": 2,
}
var StatsSeverityLevelRevMap = map[StatsSeverityLevel]string{
0: "NORMAL",
1: "WARNING",
2: "SEVERE",
}
func (e StatsSeverityLevel) String() string {
if v, ok := StatsSeverityLevelRevMap[e]; ok {
return v
}
return ""
}
type DbStats struct {
Type DbType `codec:"type" json:"type"`
MemCompActive bool `codec:"memCompActive" json:"memCompActive"`
TableCompActive bool `codec:"tableCompActive" json:"tableCompActive"`
}
func (o DbStats) DeepCopy() DbStats {
return DbStats{
Type: o.Type.DeepCopy(),
MemCompActive: o.MemCompActive,
TableCompActive: o.TableCompActive,
}
}
type ProcessType int
const (
ProcessType_MAIN ProcessType = 0
ProcessType_KBFS ProcessType = 1
)
func (o ProcessType) DeepCopy() ProcessType { return o }
var ProcessTypeMap = map[string]ProcessType{
"MAIN": 0,
"KBFS": 1,
}
var ProcessTypeRevMap = map[ProcessType]string{
0: "MAIN",
1: "KBFS",
}
func (e ProcessType) String() string {
if v, ok := ProcessTypeRevMap[e]; ok {
return v
}
return ""
}
type ProcessRuntimeStats struct {
Type ProcessType `codec:"type" json:"type"`
Cpu string `codec:"cpu" json:"cpu"`
Resident string `codec:"resident" json:"resident"`
Virt string `codec:"virt" json:"virt"`
Free string `codec:"free" json:"free"`
Goheap string `codec:"goheap" json:"goheap"`
Goheapsys string `codec:"goheapsys" json:"goheapsys"`
Goreleased string `codec:"goreleased" json:"goreleased"`
CpuSeverity StatsSeverityLevel `codec:"cpuSeverity" json:"cpuSeverity"`
ResidentSeverity StatsSeverityLevel `codec:"residentSeverity" json:"residentSeverity"`
}
func (o ProcessRuntimeStats) DeepCopy() ProcessRuntimeStats {
return ProcessRuntimeStats{
Type: o.Type.DeepCopy(),
Cpu: o.Cpu,
Resident: o.Resident,
Virt: o.Virt,
Free: o.Free,
Goheap: o.Goheap,
Goheapsys: o.Goheapsys,
Goreleased: o.Goreleased,
CpuSeverity: o.CpuSeverity.DeepCopy(),
ResidentSeverity: o.ResidentSeverity.DeepCopy(),
}
}
type RuntimeStats struct {
ProcessStats []ProcessRuntimeStats `codec:"processStats" json:"processStats"`
DbStats []DbStats `codec:"dbStats" json:"dbStats"`
ConvLoaderActive bool `codec:"convLoaderActive" json:"convLoaderActive"`
SelectiveSyncActive bool `codec:"selectiveSyncActive" json:"selectiveSyncActive"`
}
func (o RuntimeStats) DeepCopy() RuntimeStats {
return RuntimeStats{
ProcessStats: (func(x []ProcessRuntimeStats) []ProcessRuntimeStats {
if x == nil {
return nil
}
ret := make([]ProcessRuntimeStats, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.ProcessStats),
DbStats: (func(x []DbStats) []DbStats {
if x == nil {
return nil
}
ret := make([]DbStats, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.DbStats),
ConvLoaderActive: o.ConvLoaderActive,
SelectiveSyncActive: o.SelectiveSyncActive,
}
}
type RuntimeStatsUpdateArg struct {
Stats *RuntimeStats `codec:"stats,omitempty" json:"stats,omitempty"`
}
type NotifyRuntimeStatsInterface interface {
RuntimeStatsUpdate(context.Context, *RuntimeStats) error
}
func NotifyRuntimeStatsProtocol(i NotifyRuntimeStatsInterface) rpc.Protocol {
return rpc.Protocol{
Name: "keybase.1.NotifyRuntimeStats",
Methods: map[string]rpc.ServeHandlerDescription{
"runtimeStatsUpdate": {
MakeArg: func() interface{} {
var ret [1]RuntimeStatsUpdateArg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]RuntimeStatsUpdateArg)
if !ok {
err = rpc.NewTypeError((*[1]RuntimeStatsUpdateArg)(nil), args)
return
}
err = i.RuntimeStatsUpdate(ctx, typedArgs[0].Stats)
return
},
},
},
}
}
type NotifyRuntimeStatsClient struct {
Cli rpc.GenericClient
}
func (c NotifyRuntimeStatsClient) RuntimeStatsUpdate(ctx context.Context, stats *RuntimeStats) (err error) {
__arg := RuntimeStatsUpdateArg{Stats: stats}
err = c.Cli.Notify(ctx, "keybase.1.NotifyRuntimeStats.runtimeStatsUpdate", []interface{}{__arg})
return
}