forked from lovoo/goka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sarama.go
474 lines (406 loc) · 15.6 KB
/
sarama.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
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/Shopify/sarama (interfaces: Client,Consumer,PartitionConsumer)
// Package mock is a generated GoMock package.
package mock
import (
sarama "github.com/Shopify/sarama"
gomock "github.com/golang/mock/gomock"
reflect "reflect"
)
// MockClient is a mock of Client interface
type MockClient struct {
ctrl *gomock.Controller
recorder *MockClientMockRecorder
}
// MockClientMockRecorder is the mock recorder for MockClient
type MockClientMockRecorder struct {
mock *MockClient
}
// NewMockClient creates a new mock instance
func NewMockClient(ctrl *gomock.Controller) *MockClient {
mock := &MockClient{ctrl: ctrl}
mock.recorder = &MockClientMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockClient) EXPECT() *MockClientMockRecorder {
return m.recorder
}
// Brokers mocks base method
func (m *MockClient) Brokers() []*sarama.Broker {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Brokers")
ret0, _ := ret[0].([]*sarama.Broker)
return ret0
}
// Brokers indicates an expected call of Brokers
func (mr *MockClientMockRecorder) Brokers() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Brokers", reflect.TypeOf((*MockClient)(nil).Brokers))
}
// Close mocks base method
func (m *MockClient) Close() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Close")
ret0, _ := ret[0].(error)
return ret0
}
// Close indicates an expected call of Close
func (mr *MockClientMockRecorder) Close() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockClient)(nil).Close))
}
// Closed mocks base method
func (m *MockClient) Closed() bool {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Closed")
ret0, _ := ret[0].(bool)
return ret0
}
// Closed indicates an expected call of Closed
func (mr *MockClientMockRecorder) Closed() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Closed", reflect.TypeOf((*MockClient)(nil).Closed))
}
// Config mocks base method
func (m *MockClient) Config() *sarama.Config {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Config")
ret0, _ := ret[0].(*sarama.Config)
return ret0
}
// Config indicates an expected call of Config
func (mr *MockClientMockRecorder) Config() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Config", reflect.TypeOf((*MockClient)(nil).Config))
}
// Controller mocks base method
func (m *MockClient) Controller() (*sarama.Broker, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Controller")
ret0, _ := ret[0].(*sarama.Broker)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Controller indicates an expected call of Controller
func (mr *MockClientMockRecorder) Controller() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Controller", reflect.TypeOf((*MockClient)(nil).Controller))
}
// Coordinator mocks base method
func (m *MockClient) Coordinator(arg0 string) (*sarama.Broker, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Coordinator", arg0)
ret0, _ := ret[0].(*sarama.Broker)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Coordinator indicates an expected call of Coordinator
func (mr *MockClientMockRecorder) Coordinator(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Coordinator", reflect.TypeOf((*MockClient)(nil).Coordinator), arg0)
}
// GetOffset mocks base method
func (m *MockClient) GetOffset(arg0 string, arg1 int32, arg2 int64) (int64, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetOffset", arg0, arg1, arg2)
ret0, _ := ret[0].(int64)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetOffset indicates an expected call of GetOffset
func (mr *MockClientMockRecorder) GetOffset(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOffset", reflect.TypeOf((*MockClient)(nil).GetOffset), arg0, arg1, arg2)
}
// InSyncReplicas mocks base method
func (m *MockClient) InSyncReplicas(arg0 string, arg1 int32) ([]int32, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "InSyncReplicas", arg0, arg1)
ret0, _ := ret[0].([]int32)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// InSyncReplicas indicates an expected call of InSyncReplicas
func (mr *MockClientMockRecorder) InSyncReplicas(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InSyncReplicas", reflect.TypeOf((*MockClient)(nil).InSyncReplicas), arg0, arg1)
}
// InitProducerID mocks base method
func (m *MockClient) InitProducerID() (*sarama.InitProducerIDResponse, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "InitProducerID")
ret0, _ := ret[0].(*sarama.InitProducerIDResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// InitProducerID indicates an expected call of InitProducerID
func (mr *MockClientMockRecorder) InitProducerID() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitProducerID", reflect.TypeOf((*MockClient)(nil).InitProducerID))
}
// Leader mocks base method
func (m *MockClient) Leader(arg0 string, arg1 int32) (*sarama.Broker, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Leader", arg0, arg1)
ret0, _ := ret[0].(*sarama.Broker)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Leader indicates an expected call of Leader
func (mr *MockClientMockRecorder) Leader(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Leader", reflect.TypeOf((*MockClient)(nil).Leader), arg0, arg1)
}
// OfflineReplicas mocks base method
func (m *MockClient) OfflineReplicas(arg0 string, arg1 int32) ([]int32, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "OfflineReplicas", arg0, arg1)
ret0, _ := ret[0].([]int32)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// OfflineReplicas indicates an expected call of OfflineReplicas
func (mr *MockClientMockRecorder) OfflineReplicas(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OfflineReplicas", reflect.TypeOf((*MockClient)(nil).OfflineReplicas), arg0, arg1)
}
// Partitions mocks base method
func (m *MockClient) Partitions(arg0 string) ([]int32, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Partitions", arg0)
ret0, _ := ret[0].([]int32)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Partitions indicates an expected call of Partitions
func (mr *MockClientMockRecorder) Partitions(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Partitions", reflect.TypeOf((*MockClient)(nil).Partitions), arg0)
}
// RefreshCoordinator mocks base method
func (m *MockClient) RefreshCoordinator(arg0 string) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RefreshCoordinator", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// RefreshCoordinator indicates an expected call of RefreshCoordinator
func (mr *MockClientMockRecorder) RefreshCoordinator(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RefreshCoordinator", reflect.TypeOf((*MockClient)(nil).RefreshCoordinator), arg0)
}
// RefreshMetadata mocks base method
func (m *MockClient) RefreshMetadata(arg0 ...string) error {
m.ctrl.T.Helper()
varargs := []interface{}{}
for _, a := range arg0 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "RefreshMetadata", varargs...)
ret0, _ := ret[0].(error)
return ret0
}
// RefreshMetadata indicates an expected call of RefreshMetadata
func (mr *MockClientMockRecorder) RefreshMetadata(arg0 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RefreshMetadata", reflect.TypeOf((*MockClient)(nil).RefreshMetadata), arg0...)
}
// Replicas mocks base method
func (m *MockClient) Replicas(arg0 string, arg1 int32) ([]int32, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Replicas", arg0, arg1)
ret0, _ := ret[0].([]int32)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Replicas indicates an expected call of Replicas
func (mr *MockClientMockRecorder) Replicas(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Replicas", reflect.TypeOf((*MockClient)(nil).Replicas), arg0, arg1)
}
// Topics mocks base method
func (m *MockClient) Topics() ([]string, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Topics")
ret0, _ := ret[0].([]string)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Topics indicates an expected call of Topics
func (mr *MockClientMockRecorder) Topics() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Topics", reflect.TypeOf((*MockClient)(nil).Topics))
}
// WritablePartitions mocks base method
func (m *MockClient) WritablePartitions(arg0 string) ([]int32, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "WritablePartitions", arg0)
ret0, _ := ret[0].([]int32)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// WritablePartitions indicates an expected call of WritablePartitions
func (mr *MockClientMockRecorder) WritablePartitions(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WritablePartitions", reflect.TypeOf((*MockClient)(nil).WritablePartitions), arg0)
}
// MockConsumer is a mock of Consumer interface
type MockConsumer struct {
ctrl *gomock.Controller
recorder *MockConsumerMockRecorder
}
// MockConsumerMockRecorder is the mock recorder for MockConsumer
type MockConsumerMockRecorder struct {
mock *MockConsumer
}
// NewMockConsumer creates a new mock instance
func NewMockConsumer(ctrl *gomock.Controller) *MockConsumer {
mock := &MockConsumer{ctrl: ctrl}
mock.recorder = &MockConsumerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockConsumer) EXPECT() *MockConsumerMockRecorder {
return m.recorder
}
// Close mocks base method
func (m *MockConsumer) Close() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Close")
ret0, _ := ret[0].(error)
return ret0
}
// Close indicates an expected call of Close
func (mr *MockConsumerMockRecorder) Close() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockConsumer)(nil).Close))
}
// ConsumePartition mocks base method
func (m *MockConsumer) ConsumePartition(arg0 string, arg1 int32, arg2 int64) (sarama.PartitionConsumer, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ConsumePartition", arg0, arg1, arg2)
ret0, _ := ret[0].(sarama.PartitionConsumer)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ConsumePartition indicates an expected call of ConsumePartition
func (mr *MockConsumerMockRecorder) ConsumePartition(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConsumePartition", reflect.TypeOf((*MockConsumer)(nil).ConsumePartition), arg0, arg1, arg2)
}
// HighWaterMarks mocks base method
func (m *MockConsumer) HighWaterMarks() map[string]map[int32]int64 {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "HighWaterMarks")
ret0, _ := ret[0].(map[string]map[int32]int64)
return ret0
}
// HighWaterMarks indicates an expected call of HighWaterMarks
func (mr *MockConsumerMockRecorder) HighWaterMarks() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HighWaterMarks", reflect.TypeOf((*MockConsumer)(nil).HighWaterMarks))
}
// Partitions mocks base method
func (m *MockConsumer) Partitions(arg0 string) ([]int32, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Partitions", arg0)
ret0, _ := ret[0].([]int32)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Partitions indicates an expected call of Partitions
func (mr *MockConsumerMockRecorder) Partitions(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Partitions", reflect.TypeOf((*MockConsumer)(nil).Partitions), arg0)
}
// Topics mocks base method
func (m *MockConsumer) Topics() ([]string, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Topics")
ret0, _ := ret[0].([]string)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Topics indicates an expected call of Topics
func (mr *MockConsumerMockRecorder) Topics() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Topics", reflect.TypeOf((*MockConsumer)(nil).Topics))
}
// MockPartitionConsumer is a mock of PartitionConsumer interface
type MockPartitionConsumer struct {
ctrl *gomock.Controller
recorder *MockPartitionConsumerMockRecorder
}
// MockPartitionConsumerMockRecorder is the mock recorder for MockPartitionConsumer
type MockPartitionConsumerMockRecorder struct {
mock *MockPartitionConsumer
}
// NewMockPartitionConsumer creates a new mock instance
func NewMockPartitionConsumer(ctrl *gomock.Controller) *MockPartitionConsumer {
mock := &MockPartitionConsumer{ctrl: ctrl}
mock.recorder = &MockPartitionConsumerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockPartitionConsumer) EXPECT() *MockPartitionConsumerMockRecorder {
return m.recorder
}
// AsyncClose mocks base method
func (m *MockPartitionConsumer) AsyncClose() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "AsyncClose")
}
// AsyncClose indicates an expected call of AsyncClose
func (mr *MockPartitionConsumerMockRecorder) AsyncClose() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AsyncClose", reflect.TypeOf((*MockPartitionConsumer)(nil).AsyncClose))
}
// Close mocks base method
func (m *MockPartitionConsumer) Close() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Close")
ret0, _ := ret[0].(error)
return ret0
}
// Close indicates an expected call of Close
func (mr *MockPartitionConsumerMockRecorder) Close() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockPartitionConsumer)(nil).Close))
}
// Errors mocks base method
func (m *MockPartitionConsumer) Errors() <-chan *sarama.ConsumerError {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Errors")
ret0, _ := ret[0].(<-chan *sarama.ConsumerError)
return ret0
}
// Errors indicates an expected call of Errors
func (mr *MockPartitionConsumerMockRecorder) Errors() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Errors", reflect.TypeOf((*MockPartitionConsumer)(nil).Errors))
}
// HighWaterMarkOffset mocks base method
func (m *MockPartitionConsumer) HighWaterMarkOffset() int64 {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "HighWaterMarkOffset")
ret0, _ := ret[0].(int64)
return ret0
}
// HighWaterMarkOffset indicates an expected call of HighWaterMarkOffset
func (mr *MockPartitionConsumerMockRecorder) HighWaterMarkOffset() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HighWaterMarkOffset", reflect.TypeOf((*MockPartitionConsumer)(nil).HighWaterMarkOffset))
}
// Messages mocks base method
func (m *MockPartitionConsumer) Messages() <-chan *sarama.ConsumerMessage {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Messages")
ret0, _ := ret[0].(<-chan *sarama.ConsumerMessage)
return ret0
}
// Messages indicates an expected call of Messages
func (mr *MockPartitionConsumerMockRecorder) Messages() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Messages", reflect.TypeOf((*MockPartitionConsumer)(nil).Messages))
}