-
Notifications
You must be signed in to change notification settings - Fork 5
/
hook_gtrace_stub.go
281 lines (266 loc) · 5.29 KB
/
hook_gtrace_stub.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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
// Code generated by gtrace. DO NOT EDIT.
//go:build !hashring_trace
// +build !hashring_trace
package hashring
// Compose returns a new traceRing which has functional fields composed
// both from t and x.
func (t traceRing) Compose(x traceRing) (ret traceRing) {
switch {
case t.OnInsert == nil:
ret.OnInsert = x.OnInsert
case x.OnInsert == nil:
ret.OnInsert = t.OnInsert
default:
h1 := t.OnInsert
h2 := x.OnInsert
ret.OnInsert = func(p *point) traceRingInsert {
r1 := h1(p)
r2 := h2(p)
switch {
case r1.isZero():
return r2
case r2.isZero():
return r1
default:
return r1.Compose(r2)
}
}
}
switch {
case t.OnDelete == nil:
ret.OnDelete = x.OnDelete
case x.OnDelete == nil:
ret.OnDelete = t.OnDelete
default:
h1 := t.OnDelete
h2 := x.OnDelete
ret.OnDelete = func(p *point) traceRingDelete {
r1 := h1(p)
r2 := h2(p)
switch {
case r1.isZero():
return r2
case r2.isZero():
return r1
default:
return r1.Compose(r2)
}
}
}
switch {
case t.OnFix == nil:
ret.OnFix = x.OnFix
case x.OnFix == nil:
ret.OnFix = t.OnFix
default:
h1 := t.OnFix
h2 := x.OnFix
ret.OnFix = func(p *point) traceRingFix {
r1 := h1(p)
r2 := h2(p)
switch {
case r1.isZero():
return r2
case r2.isZero():
return r1
default:
return r1.Compose(r2)
}
}
}
switch {
case t.OnFixNeeded == nil:
ret.OnFixNeeded = x.OnFixNeeded
case x.OnFixNeeded == nil:
ret.OnFixNeeded = t.OnFixNeeded
default:
h1 := t.OnFixNeeded
h2 := x.OnFixNeeded
ret.OnFixNeeded = func(p *point) {
h1(p)
h2(p)
}
}
return ret
}
var gtraceNoopTraceRingInsert960df076 traceRingInsert
func (traceRing) onInsert(*point) traceRingInsert {
return gtraceNoopTraceRingInsert960df076
}
var gtraceNoopTraceRingDelete58d9e55d traceRingDelete
func (traceRing) onDelete(*point) traceRingDelete {
return gtraceNoopTraceRingDelete58d9e55d
}
var gtraceNoopTraceRingFix30bafeaa traceRingFix
func (traceRing) onFix(*point) traceRingFix {
return gtraceNoopTraceRingFix30bafeaa
}
func (traceRing) onFixNeeded(*point) {
}
// Compose returns a new traceRingInsert which has functional fields composed
// both from t and x.
func (t traceRingInsert) Compose(x traceRingInsert) (ret traceRingInsert) {
switch {
case t.OnDone == nil:
ret.OnDone = x.OnDone
case x.OnDone == nil:
ret.OnDone = t.OnDone
default:
h1 := t.OnDone
h2 := x.OnDone
ret.OnDone = func(b bool) {
h1(b)
h2(b)
}
}
switch {
case t.OnCollision == nil:
ret.OnCollision = x.OnCollision
case x.OnCollision == nil:
ret.OnCollision = t.OnCollision
default:
h1 := t.OnCollision
h2 := x.OnCollision
ret.OnCollision = func(p *point) {
h1(p)
h2(p)
}
}
return ret
}
// isZero checks whether t is empty
func (t traceRingInsert) isZero() bool {
if t.OnDone != nil {
return false
}
if t.OnCollision != nil {
return false
}
return true
}
func (traceRingInsert) onDone(bool) {
}
func (traceRingInsert) onCollision(*point) {
}
// Compose returns a new traceRingDelete which has functional fields composed
// both from t and x.
func (t traceRingDelete) Compose(x traceRingDelete) (ret traceRingDelete) {
switch {
case t.OnDone == nil:
ret.OnDone = x.OnDone
case x.OnDone == nil:
ret.OnDone = t.OnDone
default:
h1 := t.OnDone
h2 := x.OnDone
ret.OnDone = func(b bool) {
h1(b)
h2(b)
}
}
switch {
case t.OnProcessing == nil:
ret.OnProcessing = x.OnProcessing
case x.OnProcessing == nil:
ret.OnProcessing = t.OnProcessing
default:
h1 := t.OnProcessing
h2 := x.OnProcessing
ret.OnProcessing = func(p *point) func() {
r1 := h1(p)
r2 := h2(p)
switch {
case r1 == nil:
return r2
case r2 == nil:
return r1
default:
return func() {
r1()
r2()
}
}
}
}
switch {
case t.OnTwinDelete == nil:
ret.OnTwinDelete = x.OnTwinDelete
case x.OnTwinDelete == nil:
ret.OnTwinDelete = t.OnTwinDelete
default:
h1 := t.OnTwinDelete
h2 := x.OnTwinDelete
ret.OnTwinDelete = func(p *point) {
h1(p)
h2(p)
}
}
switch {
case t.OnTwinRestore == nil:
ret.OnTwinRestore = x.OnTwinRestore
case x.OnTwinRestore == nil:
ret.OnTwinRestore = t.OnTwinRestore
default:
h1 := t.OnTwinRestore
h2 := x.OnTwinRestore
ret.OnTwinRestore = func(p *point) {
h1(p)
h2(p)
}
}
return ret
}
// isZero checks whether t is empty
func (t traceRingDelete) isZero() bool {
if t.OnDone != nil {
return false
}
if t.OnProcessing != nil {
return false
}
if t.OnTwinDelete != nil {
return false
}
if t.OnTwinRestore != nil {
return false
}
return true
}
func (traceRingDelete) onDone(bool) {
}
func gtraceNoopB077713e() {
}
func (traceRingDelete) onProcessing(*point) func() {
return gtraceNoopB077713e
}
func (traceRingDelete) onTwinDelete(*point) {
}
func (traceRingDelete) onTwinRestore(*point) {
}
// Compose returns a new traceRingFix which has functional fields composed
// both from t and x.
func (t traceRingFix) Compose(x traceRingFix) (ret traceRingFix) {
switch {
case t.OnDone == nil:
ret.OnDone = x.OnDone
case x.OnDone == nil:
ret.OnDone = t.OnDone
default:
h1 := t.OnDone
h2 := x.OnDone
ret.OnDone = func() {
h1()
h2()
}
}
return ret
}
// isZero checks whether t is empty
func (t traceRingFix) isZero() bool {
if t.OnDone != nil {
return false
}
return true
}
func (traceRingFix) onDone() {
}