-
Notifications
You must be signed in to change notification settings - Fork 0
/
backend.go
390 lines (333 loc) · 14.6 KB
/
backend.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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/wuhuizuo/tidb6/br/pkg/lightning/backend (interfaces: AbstractBackend,EngineWriter)
// Package mock is a generated GoMock package.
package mock
import (
context "context"
reflect "reflect"
time "time"
gomock "github.com/golang/mock/gomock"
uuid "github.com/google/uuid"
backend "github.com/wuhuizuo/tidb6/br/pkg/lightning/backend"
kv "github.com/wuhuizuo/tidb6/br/pkg/lightning/backend/kv"
config "github.com/wuhuizuo/tidb6/br/pkg/lightning/config"
model "github.com/wuhuizuo/tidb6/parser/model"
table "github.com/wuhuizuo/tidb6/table"
)
// MockBackend is a mock of AbstractBackend interface.
type MockBackend struct {
ctrl *gomock.Controller
recorder *MockBackendMockRecorder
}
// MockBackendMockRecorder is the mock recorder for MockBackend.
type MockBackendMockRecorder struct {
mock *MockBackend
}
// NewMockBackend creates a new mock instance.
func NewMockBackend(ctrl *gomock.Controller) *MockBackend {
mock := &MockBackend{ctrl: ctrl}
mock.recorder = &MockBackendMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockBackend) EXPECT() *MockBackendMockRecorder {
return m.recorder
}
// CheckRequirements mocks base method.
func (m *MockBackend) CheckRequirements(arg0 context.Context, arg1 *backend.CheckCtx) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CheckRequirements", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
}
// CheckRequirements indicates an expected call of CheckRequirements.
func (mr *MockBackendMockRecorder) CheckRequirements(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckRequirements", reflect.TypeOf((*MockBackend)(nil).CheckRequirements), arg0, arg1)
}
// CleanupEngine mocks base method.
func (m *MockBackend) CleanupEngine(arg0 context.Context, arg1 uuid.UUID) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CleanupEngine", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
}
// CleanupEngine indicates an expected call of CleanupEngine.
func (mr *MockBackendMockRecorder) CleanupEngine(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CleanupEngine", reflect.TypeOf((*MockBackend)(nil).CleanupEngine), arg0, arg1)
}
// Close mocks base method.
func (m *MockBackend) Close() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "Close")
}
// Close indicates an expected call of Close.
func (mr *MockBackendMockRecorder) Close() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockBackend)(nil).Close))
}
// CloseEngine mocks base method.
func (m *MockBackend) CloseEngine(arg0 context.Context, arg1 *backend.EngineConfig, arg2 uuid.UUID) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CloseEngine", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
return ret0
}
// CloseEngine indicates an expected call of CloseEngine.
func (mr *MockBackendMockRecorder) CloseEngine(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseEngine", reflect.TypeOf((*MockBackend)(nil).CloseEngine), arg0, arg1, arg2)
}
// CollectLocalDuplicateRows mocks base method.
func (m *MockBackend) CollectLocalDuplicateRows(arg0 context.Context, arg1 table.Table, arg2 string, arg3 *kv.SessionOptions) (bool, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CollectLocalDuplicateRows", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(bool)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// CollectLocalDuplicateRows indicates an expected call of CollectLocalDuplicateRows.
func (mr *MockBackendMockRecorder) CollectLocalDuplicateRows(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CollectLocalDuplicateRows", reflect.TypeOf((*MockBackend)(nil).CollectLocalDuplicateRows), arg0, arg1, arg2, arg3)
}
// CollectRemoteDuplicateRows mocks base method.
func (m *MockBackend) CollectRemoteDuplicateRows(arg0 context.Context, arg1 table.Table, arg2 string, arg3 *kv.SessionOptions) (bool, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CollectRemoteDuplicateRows", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(bool)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// CollectRemoteDuplicateRows indicates an expected call of CollectRemoteDuplicateRows.
func (mr *MockBackendMockRecorder) CollectRemoteDuplicateRows(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CollectRemoteDuplicateRows", reflect.TypeOf((*MockBackend)(nil).CollectRemoteDuplicateRows), arg0, arg1, arg2, arg3)
}
// EngineFileSizes mocks base method.
func (m *MockBackend) EngineFileSizes() []backend.EngineFileSize {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "EngineFileSizes")
ret0, _ := ret[0].([]backend.EngineFileSize)
return ret0
}
// EngineFileSizes indicates an expected call of EngineFileSizes.
func (mr *MockBackendMockRecorder) EngineFileSizes() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EngineFileSizes", reflect.TypeOf((*MockBackend)(nil).EngineFileSizes))
}
// FetchRemoteTableModels mocks base method.
func (m *MockBackend) FetchRemoteTableModels(arg0 context.Context, arg1 string) ([]*model.TableInfo, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FetchRemoteTableModels", arg0, arg1)
ret0, _ := ret[0].([]*model.TableInfo)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// FetchRemoteTableModels indicates an expected call of FetchRemoteTableModels.
func (mr *MockBackendMockRecorder) FetchRemoteTableModels(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchRemoteTableModels", reflect.TypeOf((*MockBackend)(nil).FetchRemoteTableModels), arg0, arg1)
}
// FlushAllEngines mocks base method.
func (m *MockBackend) FlushAllEngines(arg0 context.Context) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FlushAllEngines", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// FlushAllEngines indicates an expected call of FlushAllEngines.
func (mr *MockBackendMockRecorder) FlushAllEngines(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FlushAllEngines", reflect.TypeOf((*MockBackend)(nil).FlushAllEngines), arg0)
}
// FlushEngine mocks base method.
func (m *MockBackend) FlushEngine(arg0 context.Context, arg1 uuid.UUID) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FlushEngine", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
}
// FlushEngine indicates an expected call of FlushEngine.
func (mr *MockBackendMockRecorder) FlushEngine(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FlushEngine", reflect.TypeOf((*MockBackend)(nil).FlushEngine), arg0, arg1)
}
// ImportEngine mocks base method.
func (m *MockBackend) ImportEngine(arg0 context.Context, arg1 uuid.UUID, arg2, arg3 int64) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ImportEngine", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(error)
return ret0
}
// ImportEngine indicates an expected call of ImportEngine.
func (mr *MockBackendMockRecorder) ImportEngine(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImportEngine", reflect.TypeOf((*MockBackend)(nil).ImportEngine), arg0, arg1, arg2, arg3)
}
// LocalWriter mocks base method.
func (m *MockBackend) LocalWriter(arg0 context.Context, arg1 *backend.LocalWriterConfig, arg2 uuid.UUID) (backend.EngineWriter, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "LocalWriter", arg0, arg1, arg2)
ret0, _ := ret[0].(backend.EngineWriter)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// LocalWriter indicates an expected call of LocalWriter.
func (mr *MockBackendMockRecorder) LocalWriter(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LocalWriter", reflect.TypeOf((*MockBackend)(nil).LocalWriter), arg0, arg1, arg2)
}
// MakeEmptyRows mocks base method.
func (m *MockBackend) MakeEmptyRows() kv.Rows {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "MakeEmptyRows")
ret0, _ := ret[0].(kv.Rows)
return ret0
}
// MakeEmptyRows indicates an expected call of MakeEmptyRows.
func (mr *MockBackendMockRecorder) MakeEmptyRows() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MakeEmptyRows", reflect.TypeOf((*MockBackend)(nil).MakeEmptyRows))
}
// NewEncoder mocks base method.
func (m *MockBackend) NewEncoder(arg0 context.Context, arg1 table.Table, arg2 *kv.SessionOptions) (kv.Encoder, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "NewEncoder", arg0, arg1, arg2)
ret0, _ := ret[0].(kv.Encoder)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// NewEncoder indicates an expected call of NewEncoder.
func (mr *MockBackendMockRecorder) NewEncoder(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewEncoder", reflect.TypeOf((*MockBackend)(nil).NewEncoder), arg0, arg1, arg2)
}
// OpenEngine mocks base method.
func (m *MockBackend) OpenEngine(arg0 context.Context, arg1 *backend.EngineConfig, arg2 uuid.UUID) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "OpenEngine", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
return ret0
}
// OpenEngine indicates an expected call of OpenEngine.
func (mr *MockBackendMockRecorder) OpenEngine(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenEngine", reflect.TypeOf((*MockBackend)(nil).OpenEngine), arg0, arg1, arg2)
}
// ResetEngine mocks base method.
func (m *MockBackend) ResetEngine(arg0 context.Context, arg1 uuid.UUID) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ResetEngine", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
}
// ResetEngine indicates an expected call of ResetEngine.
func (mr *MockBackendMockRecorder) ResetEngine(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetEngine", reflect.TypeOf((*MockBackend)(nil).ResetEngine), arg0, arg1)
}
// ResolveDuplicateRows mocks base method.
func (m *MockBackend) ResolveDuplicateRows(arg0 context.Context, arg1 table.Table, arg2 string, arg3 config.DuplicateResolutionAlgorithm) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ResolveDuplicateRows", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(error)
return ret0
}
// ResolveDuplicateRows indicates an expected call of ResolveDuplicateRows.
func (mr *MockBackendMockRecorder) ResolveDuplicateRows(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResolveDuplicateRows", reflect.TypeOf((*MockBackend)(nil).ResolveDuplicateRows), arg0, arg1, arg2, arg3)
}
// RetryImportDelay mocks base method.
func (m *MockBackend) RetryImportDelay() time.Duration {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RetryImportDelay")
ret0, _ := ret[0].(time.Duration)
return ret0
}
// RetryImportDelay indicates an expected call of RetryImportDelay.
func (mr *MockBackendMockRecorder) RetryImportDelay() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetryImportDelay", reflect.TypeOf((*MockBackend)(nil).RetryImportDelay))
}
// ShouldPostProcess mocks base method.
func (m *MockBackend) ShouldPostProcess() bool {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ShouldPostProcess")
ret0, _ := ret[0].(bool)
return ret0
}
// ShouldPostProcess indicates an expected call of ShouldPostProcess.
func (mr *MockBackendMockRecorder) ShouldPostProcess() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ShouldPostProcess", reflect.TypeOf((*MockBackend)(nil).ShouldPostProcess))
}
// MockEngineWriter is a mock of EngineWriter interface.
type MockEngineWriter struct {
ctrl *gomock.Controller
recorder *MockEngineWriterMockRecorder
}
// MockEngineWriterMockRecorder is the mock recorder for MockEngineWriter.
type MockEngineWriterMockRecorder struct {
mock *MockEngineWriter
}
// NewMockEngineWriter creates a new mock instance.
func NewMockEngineWriter(ctrl *gomock.Controller) *MockEngineWriter {
mock := &MockEngineWriter{ctrl: ctrl}
mock.recorder = &MockEngineWriterMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockEngineWriter) EXPECT() *MockEngineWriterMockRecorder {
return m.recorder
}
// AppendRows mocks base method.
func (m *MockEngineWriter) AppendRows(arg0 context.Context, arg1 string, arg2 []string, arg3 kv.Rows) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AppendRows", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(error)
return ret0
}
// AppendRows indicates an expected call of AppendRows.
func (mr *MockEngineWriterMockRecorder) AppendRows(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppendRows", reflect.TypeOf((*MockEngineWriter)(nil).AppendRows), arg0, arg1, arg2, arg3)
}
// Close mocks base method.
func (m *MockEngineWriter) Close(arg0 context.Context) (backend.ChunkFlushStatus, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Close", arg0)
ret0, _ := ret[0].(backend.ChunkFlushStatus)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Close indicates an expected call of Close.
func (mr *MockEngineWriterMockRecorder) Close(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockEngineWriter)(nil).Close), arg0)
}
// IsSynced mocks base method.
func (m *MockEngineWriter) IsSynced() bool {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "IsSynced")
ret0, _ := ret[0].(bool)
return ret0
}
// IsSynced indicates an expected call of IsSynced.
func (mr *MockEngineWriterMockRecorder) IsSynced() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSynced", reflect.TypeOf((*MockEngineWriter)(nil).IsSynced))
}
func (m *MockBackend) TotalMemoryConsume() int64 {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "TotalMemoryConsume")
ret0, _ := ret[0].(int64)
return ret0
}
// LocalWriter indicates an expected call of LocalWriter.
func (mr *MockBackendMockRecorder) TotalMemoryConsume() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TotalMemoryConsume", reflect.TypeOf((*MockBackend)(nil).OpenEngine))
}