File: expiring_hash.go

package info (click to toggle)
gitlab-agent 16.1.3-2
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid, trixie
  • size: 6,324 kB
  • sloc: makefile: 175; sh: 52; ruby: 3
file content (150 lines) | stat: -rw-r--r-- 5,706 bytes parent folder | download
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
// Code generated by MockGen. DO NOT EDIT.
// Source: ../../redistool/expiring_hash.go

// Package mock_redis is a generated GoMock package.
package mock_redis

import (
	context "context"
	reflect "reflect"
	time "time"

	gomock "github.com/golang/mock/gomock"
	redistool "gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v16/internal/tool/redistool"
)

// MockExpiringHashInterface is a mock of ExpiringHashInterface interface.
type MockExpiringHashInterface[K1 any, K2 any] struct {
	ctrl     *gomock.Controller
	recorder *MockExpiringHashInterfaceMockRecorder[K1, K2]
}

// MockExpiringHashInterfaceMockRecorder is the mock recorder for MockExpiringHashInterface.
type MockExpiringHashInterfaceMockRecorder[K1 any, K2 any] struct {
	mock *MockExpiringHashInterface[K1, K2]
}

// NewMockExpiringHashInterface creates a new mock instance.
func NewMockExpiringHashInterface[K1 any, K2 any](ctrl *gomock.Controller) *MockExpiringHashInterface[K1, K2] {
	mock := &MockExpiringHashInterface[K1, K2]{ctrl: ctrl}
	mock.recorder = &MockExpiringHashInterfaceMockRecorder[K1, K2]{mock}
	return mock
}

// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockExpiringHashInterface[K1, K2]) EXPECT() *MockExpiringHashInterfaceMockRecorder[K1, K2] {
	return m.recorder
}

// Clear mocks base method.
func (m *MockExpiringHashInterface[K1, K2]) Clear(arg0 context.Context) (int, error) {
	m.ctrl.T.Helper()
	ret := m.ctrl.Call(m, "Clear", arg0)
	ret0, _ := ret[0].(int)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}

// Clear indicates an expected call of Clear.
func (mr *MockExpiringHashInterfaceMockRecorder[K1, K2]) Clear(arg0 interface{}) *gomock.Call {
	mr.mock.ctrl.T.Helper()
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Clear", reflect.TypeOf((*MockExpiringHashInterface[K1, K2])(nil).Clear), arg0)
}

// Forget mocks base method.
func (m *MockExpiringHashInterface[K1, K2]) Forget(key K1, hashKey K2) {
	m.ctrl.T.Helper()
	m.ctrl.Call(m, "Forget", key, hashKey)
}

// Forget indicates an expected call of Forget.
func (mr *MockExpiringHashInterfaceMockRecorder[K1, K2]) Forget(key, hashKey interface{}) *gomock.Call {
	mr.mock.ctrl.T.Helper()
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Forget", reflect.TypeOf((*MockExpiringHashInterface[K1, K2])(nil).Forget), key, hashKey)
}

// GC mocks base method.
func (m *MockExpiringHashInterface[K1, K2]) GC() func(context.Context) (int, error) {
	m.ctrl.T.Helper()
	ret := m.ctrl.Call(m, "GC")
	ret0, _ := ret[0].(func(context.Context) (int, error))
	return ret0
}

// GC indicates an expected call of GC.
func (mr *MockExpiringHashInterfaceMockRecorder[K1, K2]) GC() *gomock.Call {
	mr.mock.ctrl.T.Helper()
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GC", reflect.TypeOf((*MockExpiringHashInterface[K1, K2])(nil).GC))
}

// Len mocks base method.
func (m *MockExpiringHashInterface[K1, K2]) Len(ctx context.Context, key K1) (int64, error) {
	m.ctrl.T.Helper()
	ret := m.ctrl.Call(m, "Len", ctx, key)
	ret0, _ := ret[0].(int64)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}

// Len indicates an expected call of Len.
func (mr *MockExpiringHashInterfaceMockRecorder[K1, K2]) Len(ctx, key interface{}) *gomock.Call {
	mr.mock.ctrl.T.Helper()
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Len", reflect.TypeOf((*MockExpiringHashInterface[K1, K2])(nil).Len), ctx, key)
}

// Refresh mocks base method.
func (m *MockExpiringHashInterface[K1, K2]) Refresh(nextRefresh time.Time) redistool.IOFunc {
	m.ctrl.T.Helper()
	ret := m.ctrl.Call(m, "Refresh", nextRefresh)
	ret0, _ := ret[0].(redistool.IOFunc)
	return ret0
}

// Refresh indicates an expected call of Refresh.
func (mr *MockExpiringHashInterfaceMockRecorder[K1, K2]) Refresh(nextRefresh interface{}) *gomock.Call {
	mr.mock.ctrl.T.Helper()
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Refresh", reflect.TypeOf((*MockExpiringHashInterface[K1, K2])(nil).Refresh), nextRefresh)
}

// Scan mocks base method.
func (m *MockExpiringHashInterface[K1, K2]) Scan(ctx context.Context, key K1, cb redistool.ScanCallback) (int, error) {
	m.ctrl.T.Helper()
	ret := m.ctrl.Call(m, "Scan", ctx, key, cb)
	ret0, _ := ret[0].(int)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}

// Scan indicates an expected call of Scan.
func (mr *MockExpiringHashInterfaceMockRecorder[K1, K2]) Scan(ctx, key, cb interface{}) *gomock.Call {
	mr.mock.ctrl.T.Helper()
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Scan", reflect.TypeOf((*MockExpiringHashInterface[K1, K2])(nil).Scan), ctx, key, cb)
}

// Set mocks base method.
func (m *MockExpiringHashInterface[K1, K2]) Set(key K1, hashKey K2, value []byte) redistool.IOFunc {
	m.ctrl.T.Helper()
	ret := m.ctrl.Call(m, "Set", key, hashKey, value)
	ret0, _ := ret[0].(redistool.IOFunc)
	return ret0
}

// Set indicates an expected call of Set.
func (mr *MockExpiringHashInterfaceMockRecorder[K1, K2]) Set(key, hashKey, value interface{}) *gomock.Call {
	mr.mock.ctrl.T.Helper()
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Set", reflect.TypeOf((*MockExpiringHashInterface[K1, K2])(nil).Set), key, hashKey, value)
}

// Unset mocks base method.
func (m *MockExpiringHashInterface[K1, K2]) Unset(key K1, hashKey K2) redistool.IOFunc {
	m.ctrl.T.Helper()
	ret := m.ctrl.Call(m, "Unset", key, hashKey)
	ret0, _ := ret[0].(redistool.IOFunc)
	return ret0
}

// Unset indicates an expected call of Unset.
func (mr *MockExpiringHashInterfaceMockRecorder[K1, K2]) Unset(key, hashKey interface{}) *gomock.Call {
	mr.mock.ctrl.T.Helper()
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unset", reflect.TypeOf((*MockExpiringHashInterface[K1, K2])(nil).Unset), key, hashKey)
}