2021-10-27 18:02:56 +08:00
|
|
|
// Licensed to the LF AI & Data foundation under one
|
|
|
|
// or more contributor license agreements. See the NOTICE file
|
|
|
|
// distributed with this work for additional information
|
|
|
|
// regarding copyright ownership. The ASF licenses this file
|
|
|
|
// to you under the Apache License, Version 2.0 (the
|
|
|
|
// "License"); you may not use this file except in compliance
|
2021-09-06 17:54:41 +08:00
|
|
|
// with the License. You may obtain a copy of the License at
|
|
|
|
//
|
2021-10-27 18:02:56 +08:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2021-09-06 17:54:41 +08:00
|
|
|
//
|
2021-10-27 18:02:56 +08:00
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
2021-09-06 17:54:41 +08:00
|
|
|
|
|
|
|
package indexcoord
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"errors"
|
|
|
|
"strconv"
|
2022-07-22 22:10:28 +08:00
|
|
|
"time"
|
2021-09-06 17:54:41 +08:00
|
|
|
|
2022-07-07 14:44:21 +08:00
|
|
|
"github.com/milvus-io/milvus/internal/kv"
|
|
|
|
|
2022-05-31 16:36:03 +08:00
|
|
|
"github.com/milvus-io/milvus/internal/proto/datapb"
|
|
|
|
"github.com/milvus-io/milvus/internal/storage"
|
|
|
|
|
2021-09-06 17:54:41 +08:00
|
|
|
etcdkv "github.com/milvus-io/milvus/internal/kv/etcd"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/commonpb"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/indexpb"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/internalpb"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/milvuspb"
|
2022-05-31 16:36:03 +08:00
|
|
|
"github.com/milvus-io/milvus/internal/types"
|
2021-09-06 17:54:41 +08:00
|
|
|
"github.com/milvus-io/milvus/internal/util/sessionutil"
|
|
|
|
"github.com/milvus-io/milvus/internal/util/typeutil"
|
2021-12-29 14:35:21 +08:00
|
|
|
clientv3 "go.etcd.io/etcd/client/v3"
|
2021-09-06 17:54:41 +08:00
|
|
|
)
|
|
|
|
|
2021-09-28 22:00:29 +08:00
|
|
|
// Mock is an alternative to IndexCoord, it will return specific results based on specific parameters.
|
2021-09-06 17:54:41 +08:00
|
|
|
type Mock struct {
|
2021-12-29 14:35:21 +08:00
|
|
|
etcdKV *etcdkv.EtcdKV
|
|
|
|
etcdCli *clientv3.Client
|
2021-09-06 17:54:41 +08:00
|
|
|
Failure bool
|
|
|
|
}
|
|
|
|
|
2021-09-28 22:00:29 +08:00
|
|
|
// Init initializes the Mock of IndexCoord. When param `Failure` is true, it will return an error.
|
2021-09-06 17:54:41 +08:00
|
|
|
func (icm *Mock) Init() error {
|
|
|
|
if icm.Failure {
|
|
|
|
return errors.New("IndexCoordinate init failed")
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-09-28 22:00:29 +08:00
|
|
|
// Start starts the Mock of IndexCoord. When param `Failure` is true, it will return an error.
|
2021-09-06 17:54:41 +08:00
|
|
|
func (icm *Mock) Start() error {
|
|
|
|
if icm.Failure {
|
|
|
|
return errors.New("IndexCoordinate start failed")
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-09-28 22:00:29 +08:00
|
|
|
// Stop stops the Mock of IndexCoord. When param `Failure` is true, it will return an error.
|
2021-09-06 17:54:41 +08:00
|
|
|
func (icm *Mock) Stop() error {
|
|
|
|
if icm.Failure {
|
|
|
|
return errors.New("IndexCoordinate stop failed")
|
|
|
|
}
|
|
|
|
err := icm.etcdKV.RemoveWithPrefix("session/" + typeutil.IndexCoordRole)
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-09-28 22:00:29 +08:00
|
|
|
// Register registers an IndexCoord role in ETCD, if Param `Failure` is true, it will return an error.
|
2021-09-06 17:54:41 +08:00
|
|
|
func (icm *Mock) Register() error {
|
|
|
|
if icm.Failure {
|
|
|
|
return errors.New("IndexCoordinate register failed")
|
|
|
|
}
|
2022-02-07 10:09:45 +08:00
|
|
|
icm.etcdKV = etcdkv.NewEtcdKV(icm.etcdCli, Params.EtcdCfg.MetaRootPath)
|
2021-09-06 17:54:41 +08:00
|
|
|
err := icm.etcdKV.RemoveWithPrefix("session/" + typeutil.IndexCoordRole)
|
2021-12-29 14:35:21 +08:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2022-02-07 10:09:45 +08:00
|
|
|
session := sessionutil.NewSession(context.Background(), Params.EtcdCfg.MetaRootPath, icm.etcdCli)
|
2021-12-29 14:35:21 +08:00
|
|
|
session.Init(typeutil.IndexCoordRole, Params.IndexCoordCfg.Address, true, false)
|
2021-12-15 11:47:10 +08:00
|
|
|
session.Register()
|
2021-09-06 17:54:41 +08:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-12-29 14:35:21 +08:00
|
|
|
func (icm *Mock) SetEtcdClient(client *clientv3.Client) {
|
|
|
|
icm.etcdCli = client
|
|
|
|
}
|
|
|
|
|
2022-05-31 16:36:03 +08:00
|
|
|
func (icm *Mock) SetDataCoord(dataCoord types.DataCoord) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-12-29 14:35:21 +08:00
|
|
|
func (icm *Mock) UpdateStateCode(stateCode internalpb.StateCode) {
|
|
|
|
}
|
|
|
|
|
2021-09-28 22:00:29 +08:00
|
|
|
// GetComponentStates gets the component states of the mocked IndexCoord, if Param `Failure` is true, it will return an error,
|
|
|
|
// and the state is `StateCode_Abnormal`. Under normal circumstances the state is `StateCode_Healthy`.
|
2021-09-06 17:54:41 +08:00
|
|
|
func (icm *Mock) GetComponentStates(ctx context.Context) (*internalpb.ComponentStates, error) {
|
|
|
|
if icm.Failure {
|
|
|
|
return &internalpb.ComponentStates{
|
|
|
|
State: &internalpb.ComponentInfo{
|
|
|
|
StateCode: internalpb.StateCode_Abnormal,
|
|
|
|
},
|
|
|
|
Status: &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
|
|
|
},
|
|
|
|
}, errors.New("IndexCoordinate GetComponentStates failed")
|
|
|
|
}
|
|
|
|
return &internalpb.ComponentStates{
|
|
|
|
State: &internalpb.ComponentInfo{
|
|
|
|
StateCode: internalpb.StateCode_Healthy,
|
|
|
|
},
|
|
|
|
Status: &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_Success,
|
|
|
|
},
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2021-09-28 22:00:29 +08:00
|
|
|
// GetStatisticsChannel gets the statistics channel of the mocked IndexCoord, if Param `Failure` is true, it will return an error.
|
2021-09-06 17:54:41 +08:00
|
|
|
func (icm *Mock) GetStatisticsChannel(ctx context.Context) (*milvuspb.StringResponse, error) {
|
|
|
|
if icm.Failure {
|
|
|
|
return &milvuspb.StringResponse{
|
|
|
|
Status: &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
|
|
|
},
|
|
|
|
}, errors.New("IndexCoordinate GetStatisticsChannel failed")
|
|
|
|
}
|
|
|
|
return &milvuspb.StringResponse{
|
|
|
|
Status: &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_Success,
|
|
|
|
},
|
|
|
|
Value: "",
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2021-09-28 22:00:29 +08:00
|
|
|
// GetTimeTickChannel gets the time tick channel of the mocked IndexCoord, if Param `Failure` is true, it will return an error.
|
2021-09-06 17:54:41 +08:00
|
|
|
func (icm *Mock) GetTimeTickChannel(ctx context.Context) (*milvuspb.StringResponse, error) {
|
|
|
|
if icm.Failure {
|
|
|
|
return &milvuspb.StringResponse{
|
|
|
|
Status: &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
|
|
|
},
|
|
|
|
}, errors.New("IndexCoordinate GetTimeTickChannel failed")
|
|
|
|
}
|
|
|
|
return &milvuspb.StringResponse{
|
|
|
|
Status: &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_Success,
|
|
|
|
},
|
|
|
|
Value: "",
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2021-09-28 22:00:29 +08:00
|
|
|
// BuildIndex receives a building index request, and return success, if Param `Failure` is true, it will return an error.
|
2021-09-06 17:54:41 +08:00
|
|
|
func (icm *Mock) BuildIndex(ctx context.Context, req *indexpb.BuildIndexRequest) (*indexpb.BuildIndexResponse, error) {
|
|
|
|
if icm.Failure {
|
|
|
|
return &indexpb.BuildIndexResponse{
|
|
|
|
Status: &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
|
|
|
},
|
|
|
|
IndexBuildID: 0,
|
|
|
|
}, errors.New("IndexCoordinate BuildIndex error")
|
|
|
|
}
|
|
|
|
return &indexpb.BuildIndexResponse{
|
|
|
|
Status: &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_Success,
|
|
|
|
},
|
|
|
|
IndexBuildID: 0,
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2021-09-28 22:00:29 +08:00
|
|
|
// DropIndex receives a dropping index request, and return success, if Param `Failure` is true, it will return an error.
|
2021-09-06 17:54:41 +08:00
|
|
|
func (icm *Mock) DropIndex(ctx context.Context, req *indexpb.DropIndexRequest) (*commonpb.Status, error) {
|
|
|
|
if icm.Failure {
|
|
|
|
return &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
|
|
|
}, errors.New("IndexCoordinate DropIndex failed")
|
|
|
|
}
|
|
|
|
return &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_Success,
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2021-09-28 22:00:29 +08:00
|
|
|
// GetIndexStates gets the indexes states, if Param `Failure` is true, it will return an error.
|
|
|
|
// Under normal circumstances the state of each index is `IndexState_Finished`.
|
2021-09-06 17:54:41 +08:00
|
|
|
func (icm *Mock) GetIndexStates(ctx context.Context, req *indexpb.GetIndexStatesRequest) (*indexpb.GetIndexStatesResponse, error) {
|
|
|
|
if icm.Failure {
|
|
|
|
return &indexpb.GetIndexStatesResponse{
|
|
|
|
Status: &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
|
|
|
},
|
|
|
|
}, errors.New("IndexCoordinate GetIndexStates failed")
|
|
|
|
}
|
|
|
|
states := make([]*indexpb.IndexInfo, len(req.IndexBuildIDs))
|
|
|
|
for i := range states {
|
|
|
|
states[i] = &indexpb.IndexInfo{
|
|
|
|
IndexBuildID: req.IndexBuildIDs[i],
|
|
|
|
State: commonpb.IndexState_Finished,
|
|
|
|
IndexID: 0,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return &indexpb.GetIndexStatesResponse{
|
|
|
|
Status: &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_Success,
|
|
|
|
},
|
|
|
|
States: states,
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2021-09-28 22:00:29 +08:00
|
|
|
// GetIndexFilePaths gets the index file paths, if Param `Failure` is true, it will return an error.
|
2021-09-06 17:54:41 +08:00
|
|
|
func (icm *Mock) GetIndexFilePaths(ctx context.Context, req *indexpb.GetIndexFilePathsRequest) (*indexpb.GetIndexFilePathsResponse, error) {
|
|
|
|
if icm.Failure {
|
|
|
|
return &indexpb.GetIndexFilePathsResponse{
|
|
|
|
Status: &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
|
|
|
},
|
|
|
|
}, errors.New("IndexCoordinate GetIndexFilePaths failed")
|
|
|
|
}
|
|
|
|
filePaths := make([]*indexpb.IndexFilePathInfo, len(req.IndexBuildIDs))
|
|
|
|
for i := range filePaths {
|
|
|
|
filePaths[i] = &indexpb.IndexFilePathInfo{
|
|
|
|
Status: &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_Success,
|
|
|
|
},
|
|
|
|
IndexBuildID: req.IndexBuildIDs[i],
|
|
|
|
IndexFilePaths: []string{strconv.FormatInt(req.IndexBuildIDs[i], 10)},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return &indexpb.GetIndexFilePathsResponse{
|
|
|
|
Status: &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_Success,
|
|
|
|
},
|
|
|
|
FilePaths: filePaths,
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2021-09-28 22:00:29 +08:00
|
|
|
// GetMetrics gets the metrics of mocked IndexCoord, if Param `Failure` is true, it will return an error.
|
2021-09-06 17:54:41 +08:00
|
|
|
func (icm *Mock) GetMetrics(ctx context.Context, request *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error) {
|
|
|
|
if icm.Failure {
|
|
|
|
return &milvuspb.GetMetricsResponse{
|
|
|
|
Status: &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
|
|
|
},
|
|
|
|
}, errors.New("IndexCoordinate GetMetrics failed")
|
|
|
|
}
|
|
|
|
return &milvuspb.GetMetricsResponse{
|
|
|
|
Status: &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_Success,
|
|
|
|
},
|
|
|
|
Response: "",
|
|
|
|
ComponentName: "IndexCoord",
|
|
|
|
}, nil
|
|
|
|
}
|
2022-05-31 16:36:03 +08:00
|
|
|
|
2022-06-17 18:08:12 +08:00
|
|
|
func (icm *Mock) RemoveIndex(ctx context.Context, request *indexpb.RemoveIndexRequest) (*commonpb.Status, error) {
|
|
|
|
if icm.Failure {
|
|
|
|
return &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
|
|
|
}, errors.New("IndexCoordinator RemoveIndex failed")
|
|
|
|
}
|
|
|
|
return &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_Success,
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2022-05-31 16:36:03 +08:00
|
|
|
type DataCoordMock struct {
|
|
|
|
types.DataCoord
|
|
|
|
|
|
|
|
Fail bool
|
|
|
|
Err bool
|
|
|
|
}
|
|
|
|
|
|
|
|
func (dcm *DataCoordMock) Init() error {
|
|
|
|
if dcm.Err || dcm.Fail {
|
|
|
|
return errors.New("DataCoord mock init failed")
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (dcm *DataCoordMock) Start() error {
|
|
|
|
if dcm.Err || dcm.Fail {
|
|
|
|
return errors.New("DataCoord mock start failed")
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (dcm *DataCoordMock) GetComponentStates(ctx context.Context) (*internalpb.ComponentStates, error) {
|
|
|
|
if dcm.Err {
|
|
|
|
return &internalpb.ComponentStates{
|
|
|
|
State: &internalpb.ComponentInfo{
|
|
|
|
StateCode: internalpb.StateCode_Abnormal,
|
|
|
|
},
|
|
|
|
Status: &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
|
|
|
Reason: "",
|
|
|
|
},
|
|
|
|
}, errors.New("DataCoord component state is not healthy")
|
|
|
|
}
|
|
|
|
if dcm.Fail {
|
|
|
|
return &internalpb.ComponentStates{
|
|
|
|
State: &internalpb.ComponentInfo{
|
|
|
|
StateCode: internalpb.StateCode_Abnormal,
|
|
|
|
},
|
|
|
|
Status: &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
|
|
|
Reason: "",
|
|
|
|
},
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
return &internalpb.ComponentStates{
|
|
|
|
State: &internalpb.ComponentInfo{
|
|
|
|
StateCode: internalpb.StateCode_Healthy,
|
|
|
|
},
|
|
|
|
Status: &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_Success,
|
|
|
|
Reason: "",
|
|
|
|
},
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (dcm *DataCoordMock) AcquireSegmentLock(ctx context.Context, req *datapb.AcquireSegmentLockRequest) (*commonpb.Status, error) {
|
|
|
|
if dcm.Err {
|
|
|
|
return &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
|
|
|
Reason: "",
|
|
|
|
}, errors.New("an error occurred")
|
|
|
|
}
|
|
|
|
if dcm.Fail {
|
|
|
|
return &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
|
|
|
Reason: "failure reason",
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
return &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_Success,
|
|
|
|
Reason: "",
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (dcm *DataCoordMock) ReleaseSegmentLock(ctx context.Context, req *datapb.ReleaseSegmentLockRequest) (*commonpb.Status, error) {
|
|
|
|
if dcm.Err {
|
|
|
|
return &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
|
|
|
Reason: "",
|
|
|
|
}, errors.New("an error occurred")
|
|
|
|
}
|
|
|
|
if dcm.Fail {
|
|
|
|
return &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
|
|
|
Reason: "failure reason",
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
return &commonpb.Status{
|
|
|
|
ErrorCode: commonpb.ErrorCode_Success,
|
|
|
|
Reason: "",
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2022-07-07 14:44:21 +08:00
|
|
|
// ChunkManagerMock is mock
|
|
|
|
// deprecated
|
2022-05-31 16:36:03 +08:00
|
|
|
type ChunkManagerMock struct {
|
|
|
|
storage.ChunkManager
|
|
|
|
|
|
|
|
Fail bool
|
|
|
|
Err bool
|
|
|
|
}
|
|
|
|
|
|
|
|
func (cmm *ChunkManagerMock) Exist(path string) (bool, error) {
|
|
|
|
if cmm.Err {
|
|
|
|
return false, errors.New("path not exist")
|
|
|
|
}
|
|
|
|
if cmm.Fail {
|
|
|
|
return false, nil
|
|
|
|
}
|
|
|
|
return true, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (cmm *ChunkManagerMock) RemoveWithPrefix(prefix string) error {
|
|
|
|
if cmm.Err {
|
|
|
|
return errors.New("error occurred")
|
|
|
|
}
|
|
|
|
if cmm.Fail {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
2022-07-07 14:44:21 +08:00
|
|
|
|
|
|
|
type mockETCDKV struct {
|
|
|
|
kv.MetaKv
|
|
|
|
|
|
|
|
remove func(string) error
|
|
|
|
watchWithRevision func(string, int64) clientv3.WatchChan
|
|
|
|
loadWithRevisionAndVersions func(string) ([]string, []string, []int64, int64, error)
|
|
|
|
compareVersionAndSwap func(key string, version int64, target string, opts ...clientv3.OpOption) (bool, error)
|
|
|
|
loadWithPrefix2 func(key string) ([]string, []string, []int64, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mk *mockETCDKV) Remove(key string) error {
|
|
|
|
return mk.remove(key)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mk *mockETCDKV) LoadWithRevisionAndVersions(prefix string) ([]string, []string, []int64, int64, error) {
|
|
|
|
return mk.loadWithRevisionAndVersions(prefix)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mk *mockETCDKV) CompareVersionAndSwap(key string, version int64, target string, opts ...clientv3.OpOption) (bool, error) {
|
|
|
|
return mk.compareVersionAndSwap(key, version, target, opts...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mk *mockETCDKV) LoadWithPrefix2(key string) ([]string, []string, []int64, error) {
|
|
|
|
return mk.loadWithPrefix2(key)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mk *mockETCDKV) WatchWithRevision(key string, revision int64) clientv3.WatchChan {
|
|
|
|
return mk.watchWithRevision(key, revision)
|
|
|
|
}
|
|
|
|
|
|
|
|
type chunkManagerMock struct {
|
|
|
|
storage.ChunkManager
|
|
|
|
|
|
|
|
removeWithPrefix func(string) error
|
2022-07-22 22:10:28 +08:00
|
|
|
listWithPrefix func(string, bool) ([]string, []time.Time, error)
|
2022-07-07 14:44:21 +08:00
|
|
|
remove func(string) error
|
|
|
|
}
|
|
|
|
|
|
|
|
func (cmm *chunkManagerMock) RemoveWithPrefix(prefix string) error {
|
|
|
|
return cmm.removeWithPrefix(prefix)
|
|
|
|
}
|
|
|
|
|
2022-07-22 22:10:28 +08:00
|
|
|
func (cmm *chunkManagerMock) ListWithPrefix(prefix string, recursive bool) ([]string, []time.Time, error) {
|
2022-07-07 14:44:21 +08:00
|
|
|
return cmm.listWithPrefix(prefix, recursive)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (cmm *chunkManagerMock) Remove(key string) error {
|
|
|
|
return cmm.remove(key)
|
|
|
|
}
|