Zhen Ye 15a6631147
enhance: add quota limit based on sn consuming lag (#43105)
issue: #42995

- The consuming lag at streaming node will be reported to coordinator.
- The consuming lag will trigger the write limit and deny by quota
center.
- Set the ttProtection by default.

---------

Signed-off-by: chyezh <chyezh@outlook.com>
2025-07-11 14:10:49 +08:00

305 lines
9.9 KiB
Go

// Code generated by mockery v2.53.3. DO NOT EDIT.
package mock_handler
import (
context "context"
handler "github.com/milvus-io/milvus/internal/streamingnode/client/handler"
mock "github.com/stretchr/testify/mock"
types "github.com/milvus-io/milvus/pkg/v2/streaming/util/types"
)
// MockHandlerClient is an autogenerated mock type for the HandlerClient type
type MockHandlerClient struct {
mock.Mock
}
type MockHandlerClient_Expecter struct {
mock *mock.Mock
}
func (_m *MockHandlerClient) EXPECT() *MockHandlerClient_Expecter {
return &MockHandlerClient_Expecter{mock: &_m.Mock}
}
// Close provides a mock function with no fields
func (_m *MockHandlerClient) Close() {
_m.Called()
}
// MockHandlerClient_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
type MockHandlerClient_Close_Call struct {
*mock.Call
}
// Close is a helper method to define mock.On call
func (_e *MockHandlerClient_Expecter) Close() *MockHandlerClient_Close_Call {
return &MockHandlerClient_Close_Call{Call: _e.mock.On("Close")}
}
func (_c *MockHandlerClient_Close_Call) Run(run func()) *MockHandlerClient_Close_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockHandlerClient_Close_Call) Return() *MockHandlerClient_Close_Call {
_c.Call.Return()
return _c
}
func (_c *MockHandlerClient_Close_Call) RunAndReturn(run func()) *MockHandlerClient_Close_Call {
_c.Run(run)
return _c
}
// CreateConsumer provides a mock function with given fields: ctx, opts
func (_m *MockHandlerClient) CreateConsumer(ctx context.Context, opts *handler.ConsumerOptions) (handler.Consumer, error) {
ret := _m.Called(ctx, opts)
if len(ret) == 0 {
panic("no return value specified for CreateConsumer")
}
var r0 handler.Consumer
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *handler.ConsumerOptions) (handler.Consumer, error)); ok {
return rf(ctx, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, *handler.ConsumerOptions) handler.Consumer); ok {
r0 = rf(ctx, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(handler.Consumer)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *handler.ConsumerOptions) error); ok {
r1 = rf(ctx, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockHandlerClient_CreateConsumer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateConsumer'
type MockHandlerClient_CreateConsumer_Call struct {
*mock.Call
}
// CreateConsumer is a helper method to define mock.On call
// - ctx context.Context
// - opts *handler.ConsumerOptions
func (_e *MockHandlerClient_Expecter) CreateConsumer(ctx interface{}, opts interface{}) *MockHandlerClient_CreateConsumer_Call {
return &MockHandlerClient_CreateConsumer_Call{Call: _e.mock.On("CreateConsumer", ctx, opts)}
}
func (_c *MockHandlerClient_CreateConsumer_Call) Run(run func(ctx context.Context, opts *handler.ConsumerOptions)) *MockHandlerClient_CreateConsumer_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*handler.ConsumerOptions))
})
return _c
}
func (_c *MockHandlerClient_CreateConsumer_Call) Return(_a0 handler.Consumer, _a1 error) *MockHandlerClient_CreateConsumer_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockHandlerClient_CreateConsumer_Call) RunAndReturn(run func(context.Context, *handler.ConsumerOptions) (handler.Consumer, error)) *MockHandlerClient_CreateConsumer_Call {
_c.Call.Return(run)
return _c
}
// CreateProducer provides a mock function with given fields: ctx, opts
func (_m *MockHandlerClient) CreateProducer(ctx context.Context, opts *handler.ProducerOptions) (handler.Producer, error) {
ret := _m.Called(ctx, opts)
if len(ret) == 0 {
panic("no return value specified for CreateProducer")
}
var r0 handler.Producer
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *handler.ProducerOptions) (handler.Producer, error)); ok {
return rf(ctx, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, *handler.ProducerOptions) handler.Producer); ok {
r0 = rf(ctx, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(handler.Producer)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *handler.ProducerOptions) error); ok {
r1 = rf(ctx, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockHandlerClient_CreateProducer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateProducer'
type MockHandlerClient_CreateProducer_Call struct {
*mock.Call
}
// CreateProducer is a helper method to define mock.On call
// - ctx context.Context
// - opts *handler.ProducerOptions
func (_e *MockHandlerClient_Expecter) CreateProducer(ctx interface{}, opts interface{}) *MockHandlerClient_CreateProducer_Call {
return &MockHandlerClient_CreateProducer_Call{Call: _e.mock.On("CreateProducer", ctx, opts)}
}
func (_c *MockHandlerClient_CreateProducer_Call) Run(run func(ctx context.Context, opts *handler.ProducerOptions)) *MockHandlerClient_CreateProducer_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*handler.ProducerOptions))
})
return _c
}
func (_c *MockHandlerClient_CreateProducer_Call) Return(_a0 handler.Producer, _a1 error) *MockHandlerClient_CreateProducer_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockHandlerClient_CreateProducer_Call) RunAndReturn(run func(context.Context, *handler.ProducerOptions) (handler.Producer, error)) *MockHandlerClient_CreateProducer_Call {
_c.Call.Return(run)
return _c
}
// GetLatestMVCCTimestampIfLocal provides a mock function with given fields: ctx, vchannel
func (_m *MockHandlerClient) GetLatestMVCCTimestampIfLocal(ctx context.Context, vchannel string) (uint64, error) {
ret := _m.Called(ctx, vchannel)
if len(ret) == 0 {
panic("no return value specified for GetLatestMVCCTimestampIfLocal")
}
var r0 uint64
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string) (uint64, error)); ok {
return rf(ctx, vchannel)
}
if rf, ok := ret.Get(0).(func(context.Context, string) uint64); ok {
r0 = rf(ctx, vchannel)
} else {
r0 = ret.Get(0).(uint64)
}
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
r1 = rf(ctx, vchannel)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockHandlerClient_GetLatestMVCCTimestampIfLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLatestMVCCTimestampIfLocal'
type MockHandlerClient_GetLatestMVCCTimestampIfLocal_Call struct {
*mock.Call
}
// GetLatestMVCCTimestampIfLocal is a helper method to define mock.On call
// - ctx context.Context
// - vchannel string
func (_e *MockHandlerClient_Expecter) GetLatestMVCCTimestampIfLocal(ctx interface{}, vchannel interface{}) *MockHandlerClient_GetLatestMVCCTimestampIfLocal_Call {
return &MockHandlerClient_GetLatestMVCCTimestampIfLocal_Call{Call: _e.mock.On("GetLatestMVCCTimestampIfLocal", ctx, vchannel)}
}
func (_c *MockHandlerClient_GetLatestMVCCTimestampIfLocal_Call) Run(run func(ctx context.Context, vchannel string)) *MockHandlerClient_GetLatestMVCCTimestampIfLocal_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *MockHandlerClient_GetLatestMVCCTimestampIfLocal_Call) Return(_a0 uint64, _a1 error) *MockHandlerClient_GetLatestMVCCTimestampIfLocal_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockHandlerClient_GetLatestMVCCTimestampIfLocal_Call) RunAndReturn(run func(context.Context, string) (uint64, error)) *MockHandlerClient_GetLatestMVCCTimestampIfLocal_Call {
_c.Call.Return(run)
return _c
}
// GetWALMetricsIfLocal provides a mock function with given fields: ctx
func (_m *MockHandlerClient) GetWALMetricsIfLocal(ctx context.Context) (*types.StreamingNodeMetrics, error) {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for GetWALMetricsIfLocal")
}
var r0 *types.StreamingNodeMetrics
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) (*types.StreamingNodeMetrics, error)); ok {
return rf(ctx)
}
if rf, ok := ret.Get(0).(func(context.Context) *types.StreamingNodeMetrics); ok {
r0 = rf(ctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*types.StreamingNodeMetrics)
}
}
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(ctx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockHandlerClient_GetWALMetricsIfLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWALMetricsIfLocal'
type MockHandlerClient_GetWALMetricsIfLocal_Call struct {
*mock.Call
}
// GetWALMetricsIfLocal is a helper method to define mock.On call
// - ctx context.Context
func (_e *MockHandlerClient_Expecter) GetWALMetricsIfLocal(ctx interface{}) *MockHandlerClient_GetWALMetricsIfLocal_Call {
return &MockHandlerClient_GetWALMetricsIfLocal_Call{Call: _e.mock.On("GetWALMetricsIfLocal", ctx)}
}
func (_c *MockHandlerClient_GetWALMetricsIfLocal_Call) Run(run func(ctx context.Context)) *MockHandlerClient_GetWALMetricsIfLocal_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *MockHandlerClient_GetWALMetricsIfLocal_Call) Return(_a0 *types.StreamingNodeMetrics, _a1 error) *MockHandlerClient_GetWALMetricsIfLocal_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockHandlerClient_GetWALMetricsIfLocal_Call) RunAndReturn(run func(context.Context) (*types.StreamingNodeMetrics, error)) *MockHandlerClient_GetWALMetricsIfLocal_Call {
_c.Call.Return(run)
return _c
}
// NewMockHandlerClient creates a new instance of MockHandlerClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockHandlerClient(t interface {
mock.TestingT
Cleanup(func())
}) *MockHandlerClient {
mock := &MockHandlerClient{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}