2022-06-02 15:34:04 +08:00
|
|
|
package proxy
|
|
|
|
|
|
|
|
type getVChannelsFuncType = func(collectionID UniqueID) ([]vChan, error)
|
|
|
|
type removeDMLStreamFuncType = func(collectionID UniqueID) error
|
|
|
|
|
|
|
|
type mockChannelsMgr struct {
|
|
|
|
channelsMgr
|
2023-04-11 11:00:31 +08:00
|
|
|
getChannelsFunc func(collectionID UniqueID) ([]pChan, error)
|
2022-06-02 15:34:04 +08:00
|
|
|
getVChannelsFuncType
|
|
|
|
removeDMLStreamFuncType
|
|
|
|
}
|
|
|
|
|
2023-04-11 11:00:31 +08:00
|
|
|
func (m *mockChannelsMgr) getChannels(collectionID UniqueID) ([]pChan, error) {
|
|
|
|
if m.getChannelsFunc != nil {
|
|
|
|
return m.getChannelsFunc(collectionID)
|
|
|
|
}
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
2022-06-02 15:34:04 +08:00
|
|
|
func (m *mockChannelsMgr) getVChannels(collectionID UniqueID) ([]vChan, error) {
|
|
|
|
if m.getVChannelsFuncType != nil {
|
|
|
|
return m.getVChannelsFuncType(collectionID)
|
|
|
|
}
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
2022-10-18 19:17:27 +08:00
|
|
|
func (m *mockChannelsMgr) removeDMLStream(collectionID UniqueID) {
|
2022-06-02 15:34:04 +08:00
|
|
|
if m.removeDMLStreamFuncType != nil {
|
2022-10-18 19:17:27 +08:00
|
|
|
m.removeDMLStreamFuncType(collectionID)
|
2022-06-02 15:34:04 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func newMockChannelsMgr() *mockChannelsMgr {
|
|
|
|
return &mockChannelsMgr{}
|
|
|
|
}
|