From b0c8b5e0c7afb18947fb5be4532f732d1d08075e Mon Sep 17 00:00:00 2001 From: Congqi Xia Date: Wed, 3 Jan 2024 18:54:48 +0800 Subject: [PATCH 1/3] Add merr package to utilize milvus error Signed-off-by: Congqi Xia --- go.mod | 3 +- go.sum | 4 + merr/errors.go | 243 ++++++++++++++++++++++++++++++++++++++++++++ merr/errors_test.go | 77 ++++++++++++++ merr/utils.go | 230 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 556 insertions(+), 1 deletion(-) create mode 100644 merr/errors.go create mode 100644 merr/errors_test.go create mode 100644 merr/utils.go diff --git a/go.mod b/go.mod index 7585f77e..d46866cd 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-faker/faker/v4 v4.1.0 github.com/golang/protobuf v1.5.2 github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 - github.com/milvus-io/milvus-proto/go-api/v2 v2.3.3 + github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4 github.com/stretchr/testify v1.8.1 github.com/tidwall/gjson v1.14.4 google.golang.org/grpc v1.48.0 @@ -20,6 +20,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/getsentry/sentry-go v0.12.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect + github.com/klauspost/compress v1.16.7 // indirect github.com/kr/pretty v0.3.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pkg/errors v0.9.1 // indirect diff --git a/go.sum b/go.sum index a618254c..d6c075f2 100644 --- a/go.sum +++ b/go.sum @@ -133,6 +133,8 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= +github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -161,6 +163,8 @@ github.com/milvus-io/milvus-proto/go-api/v2 v2.3.2 h1:tBcKiEUcX6i3MaFYvMJO1F7R6f github.com/milvus-io/milvus-proto/go-api/v2 v2.3.2/go.mod h1:1OIl0v5PQeNxIJhCvY+K55CBUOYDZevw9g9380u1Wek= github.com/milvus-io/milvus-proto/go-api/v2 v2.3.3 h1:j6Ru7Lq421Ukp+XH8I+ny7dsVF2rLDLLoWpuFgoDZLM= github.com/milvus-io/milvus-proto/go-api/v2 v2.3.3/go.mod h1:1OIl0v5PQeNxIJhCvY+K55CBUOYDZevw9g9380u1Wek= +github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4 h1:HtNGcUb52ojnl+zDAZMmbHyVaTdBjzuCnnBHpb675TU= +github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4/go.mod h1:1OIl0v5PQeNxIJhCvY+K55CBUOYDZevw9g9380u1Wek= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= diff --git a/merr/errors.go b/merr/errors.go new file mode 100644 index 00000000..0db96333 --- /dev/null +++ b/merr/errors.go @@ -0,0 +1,243 @@ +// 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 +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +package merr + +import ( + "github.com/cockroachdb/errors" +) + +const ( + CanceledCode int32 = 10000 + TimeoutCode int32 = 10001 +) + +// Define leaf errors here, +// WARN: take care to add new error, +// check whehter you can use the erorrs below before adding a new one. +// Name: Err + related prefix + error name +var ( + // Service related + ErrServiceNotReady = newMilvusError("service not ready", 1, true) // This indicates the service is still in init + ErrServiceUnavailable = newMilvusError("service unavailable", 2, true) + ErrServiceMemoryLimitExceeded = newMilvusError("memory limit exceeded", 3, false) + ErrServiceRequestLimitExceeded = newMilvusError("request limit exceeded", 4, true) + ErrServiceInternal = newMilvusError("service internal error", 5, false) // Never return this error out of Milvus + ErrServiceCrossClusterRouting = newMilvusError("cross cluster routing", 6, false) + ErrServiceDiskLimitExceeded = newMilvusError("disk limit exceeded", 7, false) + ErrServiceRateLimit = newMilvusError("rate limit exceeded", 8, true) + ErrServiceForceDeny = newMilvusError("force deny", 9, false) + ErrServiceUnimplemented = newMilvusError("service unimplemented", 10, false) + + // Collection related + ErrCollectionNotFound = newMilvusError("collection not found", 100, false) + ErrCollectionNotLoaded = newMilvusError("collection not loaded", 101, false) + ErrCollectionNumLimitExceeded = newMilvusError("exceeded the limit number of collections", 102, false) + ErrCollectionNotFullyLoaded = newMilvusError("collection not fully loaded", 103, true) + + // Partition related + ErrPartitionNotFound = newMilvusError("partition not found", 200, false) + ErrPartitionNotLoaded = newMilvusError("partition not loaded", 201, false) + ErrPartitionNotFullyLoaded = newMilvusError("partition not fully loaded", 202, true) + + // ResourceGroup related + ErrResourceGroupNotFound = newMilvusError("resource group not found", 300, false) + + // Replica related + ErrReplicaNotFound = newMilvusError("replica not found", 400, false) + ErrReplicaNotAvailable = newMilvusError("replica not available", 401, false) + + // Channel & Delegator related + ErrChannelNotFound = newMilvusError("channel not found", 500, false) + ErrChannelLack = newMilvusError("channel lacks", 501, false) + ErrChannelReduplicate = newMilvusError("channel reduplicates", 502, false) + ErrChannelNotAvailable = newMilvusError("channel not available", 503, false) + + // Segment related + ErrSegmentNotFound = newMilvusError("segment not found", 600, false) + ErrSegmentNotLoaded = newMilvusError("segment not loaded", 601, false) + ErrSegmentLack = newMilvusError("segment lacks", 602, false) + ErrSegmentReduplicate = newMilvusError("segment reduplicates", 603, false) + + // Index related + ErrIndexNotFound = newMilvusError("index not found", 700, false) + ErrIndexNotSupported = newMilvusError("index type not supported", 701, false) + ErrIndexDuplicate = newMilvusError("index duplicates", 702, false) + + // Database related + ErrDatabaseNotFound = newMilvusError("database not found", 800, false) + ErrDatabaseNumLimitExceeded = newMilvusError("exceeded the limit number of database", 801, false) + ErrDatabaseInvalidName = newMilvusError("invalid database name", 802, false) + + // Node related + ErrNodeNotFound = newMilvusError("node not found", 901, false) + ErrNodeOffline = newMilvusError("node offline", 902, false) + ErrNodeLack = newMilvusError("node lacks", 903, false) + ErrNodeNotMatch = newMilvusError("node not match", 904, false) + ErrNodeNotAvailable = newMilvusError("node not available", 905, false) + + // IO related + ErrIoKeyNotFound = newMilvusError("key not found", 1000, false) + ErrIoFailed = newMilvusError("IO failed", 1001, false) + + // Parameter related + ErrParameterInvalid = newMilvusError("invalid parameter", 1100, false) + + // Metrics related + ErrMetricNotFound = newMilvusError("metric not found", 1200, false) + + // Message queue related + ErrMqTopicNotFound = newMilvusError("topic not found", 1300, false) + ErrMqTopicNotEmpty = newMilvusError("topic not empty", 1301, false) + ErrMqInternal = newMilvusError("message queue internal error", 1302, false) + ErrDenyProduceMsg = newMilvusError("deny to write the message to mq", 1303, false) + + // Privilege related + // this operation is denied because the user not authorized, user need to login in first + ErrPrivilegeNotAuthenticated = newMilvusError("not authenticated", 1400, false) + // this operation is denied because the user has no permission to do this, user need higher privilege + ErrPrivilegeNotPermitted = newMilvusError("privilege not permitted", 1401, false) + + // Alias related + ErrAliasNotFound = newMilvusError("alias not found", 1600, false) + ErrAliasCollectionNameConfilct = newMilvusError("alias and collection name conflict", 1601, false) + ErrAliasAlreadyExist = newMilvusError("alias already exist", 1602, false) + + // field related + ErrFieldNotFound = newMilvusError("field not found", 1700, false) + ErrFieldInvalidName = newMilvusError("field name invalid", 1701, false) + + // high-level restful api related + ErrNeedAuthenticate = newMilvusError("user hasn't authenticated", 1800, false) + ErrIncorrectParameterFormat = newMilvusError("can only accept json format request", 1801, false) + ErrMissingRequiredParameters = newMilvusError("missing required parameters", 1802, false) + ErrMarshalCollectionSchema = newMilvusError("fail to marshal collection schema", 1803, false) + ErrInvalidInsertData = newMilvusError("fail to deal the insert data", 1804, false) + ErrInvalidSearchResult = newMilvusError("fail to parse search result", 1805, false) + ErrCheckPrimaryKey = newMilvusError("please check the primary key and its' type can only in [int, string]", 1806, false) + + // replicate related + ErrDenyReplicateMessage = newMilvusError("deny to use the replicate message in the normal instance", 1900, false) + ErrInvalidMsgBytes = newMilvusError("invalid replicate msg bytes", 1901, false) + ErrNoAssignSegmentID = newMilvusError("no assign segment id", 1902, false) + ErrInvalidStreamObj = newMilvusError("invalid stream object", 1903, false) + + // Segcore related + ErrSegcore = newMilvusError("segcore error", 2000, false) + + // Do NOT export this, + // never allow programmer using this, keep only for converting unknown error to milvusError + errUnexpected = newMilvusError("unexpected error", (1<<16)-1, false) + + // import + ErrImportFailed = newMilvusError("importing data failed", 2100, false) +) + +type milvusError struct { + msg string + detail string + retriable bool + errCode int32 +} + +func newMilvusError(msg string, code int32, retriable bool) milvusError { + return milvusError{ + msg: msg, + detail: msg, + retriable: retriable, + errCode: code, + } +} + +func newMilvusErrorWithDetail(msg string, detail string, code int32, retriable bool) milvusError { + return milvusError{ + msg: msg, + detail: detail, + retriable: retriable, + errCode: code, + } +} + +func (e milvusError) code() int32 { + return e.errCode +} + +func (e milvusError) Error() string { + return e.msg +} + +func (e milvusError) Detail() string { + return e.detail +} + +func (e milvusError) Is(err error) bool { + cause := errors.Cause(err) + if cause, ok := cause.(milvusError); ok { + return e.errCode == cause.errCode + } + return false +} + +type multiErrors struct { + errs []error +} + +func (e multiErrors) Unwrap() error { + if len(e.errs) <= 1 { + return nil + } + // To make merr work for multi errors, + // we need cause of multi errors, which defined as the last error + if len(e.errs) == 2 { + return e.errs[1] + } + + return multiErrors{ + errs: e.errs[1:], + } +} + +func (e multiErrors) Error() string { + final := e.errs[0] + for i := 1; i < len(e.errs); i++ { + final = errors.Wrap(e.errs[i], final.Error()) + } + return final.Error() +} + +func (e multiErrors) Is(err error) bool { + for _, item := range e.errs { + if errors.Is(item, err) { + return true + } + } + return false +} + +func Combine(errs ...error) error { + var filtered []error + for _, e := range errs { + if e != nil { + filtered = append(filtered, e) + } + } + if len(errs) == 0 { + return nil + } + return multiErrors{ + errs, + } +} diff --git a/merr/errors_test.go b/merr/errors_test.go new file mode 100644 index 00000000..7cc82e99 --- /dev/null +++ b/merr/errors_test.go @@ -0,0 +1,77 @@ +// 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 +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +package merr + +import ( + "testing" + + "github.com/cockroachdb/errors" + "github.com/stretchr/testify/suite" + + "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" +) + +type ErrSuite struct { + suite.Suite +} + +func (s *ErrSuite) SetupSuite() { +} + +func (s *ErrSuite) TestOldCode() { + s.ErrorIs(OldCodeToMerr(commonpb.ErrorCode_NotReadyServe), ErrServiceNotReady) + s.ErrorIs(OldCodeToMerr(commonpb.ErrorCode_CollectionNotExists), ErrCollectionNotFound) + s.ErrorIs(OldCodeToMerr(commonpb.ErrorCode_IllegalArgument), ErrParameterInvalid) + s.ErrorIs(OldCodeToMerr(commonpb.ErrorCode_NodeIDNotMatch), ErrNodeNotMatch) + s.ErrorIs(OldCodeToMerr(commonpb.ErrorCode_InsufficientMemoryToLoad), ErrServiceMemoryLimitExceeded) + s.ErrorIs(OldCodeToMerr(commonpb.ErrorCode_MemoryQuotaExhausted), ErrServiceMemoryLimitExceeded) + s.ErrorIs(OldCodeToMerr(commonpb.ErrorCode_DiskQuotaExhausted), ErrServiceDiskLimitExceeded) + s.ErrorIs(OldCodeToMerr(commonpb.ErrorCode_RateLimit), ErrServiceRateLimit) + s.ErrorIs(OldCodeToMerr(commonpb.ErrorCode_ForceDeny), ErrServiceForceDeny) + s.ErrorIs(OldCodeToMerr(commonpb.ErrorCode_UnexpectedError), errUnexpected) +} + +func (s *ErrSuite) TestCombine() { + var ( + errFirst = errors.New("first") + errSecond = errors.New("second") + errThird = errors.New("third") + ) + + err := Combine(errFirst, errSecond) + s.True(errors.Is(err, errFirst)) + s.True(errors.Is(err, errSecond)) + s.False(errors.Is(err, errThird)) + + s.Equal("first: second", err.Error()) +} + +func (s *ErrSuite) TestCombineWithNil() { + err := errors.New("non-nil") + + err = Combine(nil, err) + s.NotNil(err) +} + +func (s *ErrSuite) TestCombineOnlyNil() { + err := Combine(nil, nil) + s.Nil(err) +} + +func TestErrors(t *testing.T) { + suite.Run(t, new(ErrSuite)) +} diff --git a/merr/utils.go b/merr/utils.go new file mode 100644 index 00000000..c724730c --- /dev/null +++ b/merr/utils.go @@ -0,0 +1,230 @@ +// 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 +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +package merr + +import ( + "context" + "strings" + + "github.com/cockroachdb/errors" + + "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" +) + +// Code returns the error code of the given error, +// WARN: DO NOT use this for now +func Code(err error) int32 { + if err == nil { + return 0 + } + + cause := errors.Cause(err) + switch cause := cause.(type) { + case milvusError: + return cause.code() + + default: + if errors.Is(cause, context.Canceled) { + return CanceledCode + } else if errors.Is(cause, context.DeadlineExceeded) { + return TimeoutCode + } else { + return errUnexpected.code() + } + } +} + +func IsRetryableErr(err error) bool { + if err, ok := err.(milvusError); ok { + return err.retriable + } + + return false +} + +func IsCanceledOrTimeout(err error) bool { + return errors.IsAny(err, context.Canceled, context.DeadlineExceeded) +} + +// Status returns a status according to the given err, +// returns Success status if err is nil +func Status(err error) *commonpb.Status { + if err == nil { + return &commonpb.Status{} + } + + code := Code(err) + return &commonpb.Status{ + Code: code, + Reason: previousLastError(err).Error(), + // Deprecated, for compatibility + ErrorCode: oldCode(code), + Retriable: IsRetryableErr(err), + Detail: err.Error(), + } +} + +func previousLastError(err error) error { + lastErr := err + for { + nextErr := errors.Unwrap(err) + if nextErr == nil { + break + } + lastErr = err + err = nextErr + } + return lastErr +} + +func CheckRPCCall(resp interface{}, err error) error { + if err != nil { + return err + } + if resp == nil { + return errUnexpected + } + switch resp := resp.(type) { + case interface{ GetStatus() *commonpb.Status }: + return Error(resp.GetStatus()) + case *commonpb.Status: + return Error(resp) + } + return nil +} + +func Success(reason ...string) *commonpb.Status { + status := Status(nil) + // NOLINT + status.Reason = strings.Join(reason, " ") + return status +} + +// Deprecated +func StatusWithErrorCode(err error, code commonpb.ErrorCode) *commonpb.Status { + if err == nil { + return &commonpb.Status{} + } + + return &commonpb.Status{ + Code: Code(err), + Reason: err.Error(), + ErrorCode: code, + } +} + +func oldCode(code int32) commonpb.ErrorCode { + switch code { + case ErrServiceNotReady.code(): + return commonpb.ErrorCode_NotReadyServe + + case ErrCollectionNotFound.code(): + return commonpb.ErrorCode_CollectionNotExists + + case ErrParameterInvalid.code(): + return commonpb.ErrorCode_IllegalArgument + + case ErrNodeNotMatch.code(): + return commonpb.ErrorCode_NodeIDNotMatch + + case ErrCollectionNotFound.code(), ErrPartitionNotFound.code(), ErrReplicaNotFound.code(): + return commonpb.ErrorCode_MetaFailed + + case ErrReplicaNotAvailable.code(), ErrChannelNotAvailable.code(), ErrNodeNotAvailable.code(): + return commonpb.ErrorCode_NoReplicaAvailable + + case ErrServiceMemoryLimitExceeded.code(): + return commonpb.ErrorCode_InsufficientMemoryToLoad + + case ErrServiceRateLimit.code(): + return commonpb.ErrorCode_RateLimit + + case ErrServiceForceDeny.code(): + return commonpb.ErrorCode_ForceDeny + + case ErrIndexNotFound.code(): + return commonpb.ErrorCode_IndexNotExist + + case ErrSegmentNotFound.code(): + return commonpb.ErrorCode_SegmentNotFound + + case ErrChannelLack.code(): + return commonpb.ErrorCode_MetaFailed + + default: + return commonpb.ErrorCode_UnexpectedError + } +} + +func OldCodeToMerr(code commonpb.ErrorCode) error { + switch code { + case commonpb.ErrorCode_NotReadyServe: + return ErrServiceNotReady + + case commonpb.ErrorCode_CollectionNotExists: + return ErrCollectionNotFound + + case commonpb.ErrorCode_IllegalArgument: + return ErrParameterInvalid + + case commonpb.ErrorCode_NodeIDNotMatch: + return ErrNodeNotMatch + + case commonpb.ErrorCode_InsufficientMemoryToLoad, commonpb.ErrorCode_MemoryQuotaExhausted: + return ErrServiceMemoryLimitExceeded + + case commonpb.ErrorCode_DiskQuotaExhausted: + return ErrServiceDiskLimitExceeded + + case commonpb.ErrorCode_RateLimit: + return ErrServiceRateLimit + + case commonpb.ErrorCode_ForceDeny: + return ErrServiceForceDeny + + case commonpb.ErrorCode_IndexNotExist: + return ErrIndexNotFound + + case commonpb.ErrorCode_SegmentNotFound: + return ErrSegmentNotFound + + case commonpb.ErrorCode_MetaFailed: + return ErrChannelNotFound + + default: + return errUnexpected + } +} + +func Ok(status *commonpb.Status) bool { + return status.GetErrorCode() == commonpb.ErrorCode_Success && status.GetCode() == 0 +} + +// Error returns a error according to the given status, +// returns nil if the status is a success status +func Error(status *commonpb.Status) error { + if Ok(status) { + return nil + } + + // use code first + code := status.GetCode() + if code == 0 { + return newMilvusErrorWithDetail(status.GetReason(), status.GetDetail(), Code(OldCodeToMerr(status.GetErrorCode())), false) + } + return newMilvusErrorWithDetail(status.GetReason(), status.GetDetail(), code, status.GetRetriable()) +} From ef8162c5d7d796bd23bc2b47e7cffa29834384d0 Mon Sep 17 00:00:00 2001 From: Congqi Xia Date: Wed, 3 Jan 2024 19:09:49 +0800 Subject: [PATCH 2/3] Add mock methods for new APIs Signed-off-by: Congqi Xia --- client/client_mock_test.go | 21 ++ common/common.go | 2 +- mocks/MilvusServiceServer.go | 430 ++++++++++++++++++++++------------- 3 files changed, 292 insertions(+), 161 deletions(-) diff --git a/client/client_mock_test.go b/client/client_mock_test.go index 2c06e5b1..f2a71e97 100644 --- a/client/client_mock_test.go +++ b/client/client_mock_test.go @@ -271,6 +271,7 @@ const ( MDescribeIndex ServiceMethod = 403 MGetIndexState ServiceMethod = 404 MGetIndexBuildProgress ServiceMethod = 405 + MAlterIndex ServiceMethod = 406 MCreateCredential ServiceMethod = 500 MUpdateCredential ServiceMethod = 501 @@ -285,6 +286,7 @@ const ( MDelete ServiceMethod = 605 MQuery ServiceMethod = 606 MUpsert ServiceMethod = 607 + MSearchV2 ServiceMethod = 608 MManualCompaction ServiceMethod = 700 MGetCompactionState ServiceMethod = 701 @@ -1005,3 +1007,22 @@ func (m *MockServer) Upsert(ctx context.Context, req *milvuspb.UpsertRequest) (* s, err := SuccessStatus() return &milvuspb.MutationResult{Status: s}, err } + +func (m *MockServer) AlterIndex(ctx context.Context, req *milvuspb.AlterIndexRequest) (*commonpb.Status, error) { + f := m.GetInjection(MUpsert) + if f != nil { + r, err := f(ctx, req) + return r.(*commonpb.Status), err + } + return SuccessStatus() +} + +func (m *MockServer) SearchV2(ctx context.Context, req *milvuspb.SearchRequestV2) (*milvuspb.SearchResults, error) { + f := m.GetInjection(MUpsert) + if f != nil { + r, err := f(ctx, req) + return r.(*milvuspb.SearchResults), err + } + status, err := SuccessStatus() + return &milvuspb.SearchResults{Status: status}, err +} diff --git a/common/common.go b/common/common.go index 037688e0..afef8c5d 100644 --- a/common/common.go +++ b/common/common.go @@ -2,5 +2,5 @@ package common const ( // SDKVersion const value for current version - SDKVersion = `v2.3.3` + SDKVersion = `v2.4.0-dev` ) diff --git a/mocks/MilvusServiceServer.go b/mocks/MilvusServiceServer.go index c14a7bb5..9f562bbf 100644 --- a/mocks/MilvusServiceServer.go +++ b/mocks/MilvusServiceServer.go @@ -59,8 +59,8 @@ type MilvusServiceServer_AllocTimestamp_Call struct { } // AllocTimestamp is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.AllocTimestampRequest +// - _a0 context.Context +// - _a1 *milvuspb.AllocTimestampRequest func (_e *MilvusServiceServer_Expecter) AllocTimestamp(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_AllocTimestamp_Call { return &MilvusServiceServer_AllocTimestamp_Call{Call: _e.mock.On("AllocTimestamp", _a0, _a1)} } @@ -114,8 +114,8 @@ type MilvusServiceServer_AlterAlias_Call struct { } // AlterAlias is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.AlterAliasRequest +// - _a0 context.Context +// - _a1 *milvuspb.AlterAliasRequest func (_e *MilvusServiceServer_Expecter) AlterAlias(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_AlterAlias_Call { return &MilvusServiceServer_AlterAlias_Call{Call: _e.mock.On("AlterAlias", _a0, _a1)} } @@ -169,8 +169,8 @@ type MilvusServiceServer_AlterCollection_Call struct { } // AlterCollection is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.AlterCollectionRequest +// - _a0 context.Context +// - _a1 *milvuspb.AlterCollectionRequest func (_e *MilvusServiceServer_Expecter) AlterCollection(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_AlterCollection_Call { return &MilvusServiceServer_AlterCollection_Call{Call: _e.mock.On("AlterCollection", _a0, _a1)} } @@ -192,6 +192,61 @@ func (_c *MilvusServiceServer_AlterCollection_Call) RunAndReturn(run func(contex return _c } +// AlterIndex provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) AlterIndex(_a0 context.Context, _a1 *milvuspb.AlterIndexRequest) (*commonpb.Status, error) { + ret := _m.Called(_a0, _a1) + + var r0 *commonpb.Status + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AlterIndexRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AlterIndexRequest) *commonpb.Status); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*commonpb.Status) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.AlterIndexRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_AlterIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AlterIndex' +type MilvusServiceServer_AlterIndex_Call struct { + *mock.Call +} + +// AlterIndex is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *milvuspb.AlterIndexRequest +func (_e *MilvusServiceServer_Expecter) AlterIndex(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_AlterIndex_Call { + return &MilvusServiceServer_AlterIndex_Call{Call: _e.mock.On("AlterIndex", _a0, _a1)} +} + +func (_c *MilvusServiceServer_AlterIndex_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.AlterIndexRequest)) *MilvusServiceServer_AlterIndex_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.AlterIndexRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_AlterIndex_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_AlterIndex_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_AlterIndex_Call) RunAndReturn(run func(context.Context, *milvuspb.AlterIndexRequest) (*commonpb.Status, error)) *MilvusServiceServer_AlterIndex_Call { + _c.Call.Return(run) + return _c +} + // CalcDistance provides a mock function with given fields: _a0, _a1 func (_m *MilvusServiceServer) CalcDistance(_a0 context.Context, _a1 *milvuspb.CalcDistanceRequest) (*milvuspb.CalcDistanceResults, error) { ret := _m.Called(_a0, _a1) @@ -224,8 +279,8 @@ type MilvusServiceServer_CalcDistance_Call struct { } // CalcDistance is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.CalcDistanceRequest +// - _a0 context.Context +// - _a1 *milvuspb.CalcDistanceRequest func (_e *MilvusServiceServer_Expecter) CalcDistance(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_CalcDistance_Call { return &MilvusServiceServer_CalcDistance_Call{Call: _e.mock.On("CalcDistance", _a0, _a1)} } @@ -279,8 +334,8 @@ type MilvusServiceServer_CheckHealth_Call struct { } // CheckHealth is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.CheckHealthRequest +// - _a0 context.Context +// - _a1 *milvuspb.CheckHealthRequest func (_e *MilvusServiceServer_Expecter) CheckHealth(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_CheckHealth_Call { return &MilvusServiceServer_CheckHealth_Call{Call: _e.mock.On("CheckHealth", _a0, _a1)} } @@ -334,8 +389,8 @@ type MilvusServiceServer_Connect_Call struct { } // Connect is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.ConnectRequest +// - _a0 context.Context +// - _a1 *milvuspb.ConnectRequest func (_e *MilvusServiceServer_Expecter) Connect(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_Connect_Call { return &MilvusServiceServer_Connect_Call{Call: _e.mock.On("Connect", _a0, _a1)} } @@ -389,8 +444,8 @@ type MilvusServiceServer_CreateAlias_Call struct { } // CreateAlias is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.CreateAliasRequest +// - _a0 context.Context +// - _a1 *milvuspb.CreateAliasRequest func (_e *MilvusServiceServer_Expecter) CreateAlias(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_CreateAlias_Call { return &MilvusServiceServer_CreateAlias_Call{Call: _e.mock.On("CreateAlias", _a0, _a1)} } @@ -444,8 +499,8 @@ type MilvusServiceServer_CreateCollection_Call struct { } // CreateCollection is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.CreateCollectionRequest +// - _a0 context.Context +// - _a1 *milvuspb.CreateCollectionRequest func (_e *MilvusServiceServer_Expecter) CreateCollection(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_CreateCollection_Call { return &MilvusServiceServer_CreateCollection_Call{Call: _e.mock.On("CreateCollection", _a0, _a1)} } @@ -499,8 +554,8 @@ type MilvusServiceServer_CreateCredential_Call struct { } // CreateCredential is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.CreateCredentialRequest +// - _a0 context.Context +// - _a1 *milvuspb.CreateCredentialRequest func (_e *MilvusServiceServer_Expecter) CreateCredential(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_CreateCredential_Call { return &MilvusServiceServer_CreateCredential_Call{Call: _e.mock.On("CreateCredential", _a0, _a1)} } @@ -554,8 +609,8 @@ type MilvusServiceServer_CreateDatabase_Call struct { } // CreateDatabase is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.CreateDatabaseRequest +// - _a0 context.Context +// - _a1 *milvuspb.CreateDatabaseRequest func (_e *MilvusServiceServer_Expecter) CreateDatabase(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_CreateDatabase_Call { return &MilvusServiceServer_CreateDatabase_Call{Call: _e.mock.On("CreateDatabase", _a0, _a1)} } @@ -609,8 +664,8 @@ type MilvusServiceServer_CreateIndex_Call struct { } // CreateIndex is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.CreateIndexRequest +// - _a0 context.Context +// - _a1 *milvuspb.CreateIndexRequest func (_e *MilvusServiceServer_Expecter) CreateIndex(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_CreateIndex_Call { return &MilvusServiceServer_CreateIndex_Call{Call: _e.mock.On("CreateIndex", _a0, _a1)} } @@ -664,8 +719,8 @@ type MilvusServiceServer_CreatePartition_Call struct { } // CreatePartition is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.CreatePartitionRequest +// - _a0 context.Context +// - _a1 *milvuspb.CreatePartitionRequest func (_e *MilvusServiceServer_Expecter) CreatePartition(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_CreatePartition_Call { return &MilvusServiceServer_CreatePartition_Call{Call: _e.mock.On("CreatePartition", _a0, _a1)} } @@ -719,8 +774,8 @@ type MilvusServiceServer_CreateResourceGroup_Call struct { } // CreateResourceGroup is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.CreateResourceGroupRequest +// - _a0 context.Context +// - _a1 *milvuspb.CreateResourceGroupRequest func (_e *MilvusServiceServer_Expecter) CreateResourceGroup(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_CreateResourceGroup_Call { return &MilvusServiceServer_CreateResourceGroup_Call{Call: _e.mock.On("CreateResourceGroup", _a0, _a1)} } @@ -774,8 +829,8 @@ type MilvusServiceServer_CreateRole_Call struct { } // CreateRole is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.CreateRoleRequest +// - _a0 context.Context +// - _a1 *milvuspb.CreateRoleRequest func (_e *MilvusServiceServer_Expecter) CreateRole(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_CreateRole_Call { return &MilvusServiceServer_CreateRole_Call{Call: _e.mock.On("CreateRole", _a0, _a1)} } @@ -829,8 +884,8 @@ type MilvusServiceServer_Delete_Call struct { } // Delete is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.DeleteRequest +// - _a0 context.Context +// - _a1 *milvuspb.DeleteRequest func (_e *MilvusServiceServer_Expecter) Delete(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_Delete_Call { return &MilvusServiceServer_Delete_Call{Call: _e.mock.On("Delete", _a0, _a1)} } @@ -884,8 +939,8 @@ type MilvusServiceServer_DeleteCredential_Call struct { } // DeleteCredential is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.DeleteCredentialRequest +// - _a0 context.Context +// - _a1 *milvuspb.DeleteCredentialRequest func (_e *MilvusServiceServer_Expecter) DeleteCredential(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_DeleteCredential_Call { return &MilvusServiceServer_DeleteCredential_Call{Call: _e.mock.On("DeleteCredential", _a0, _a1)} } @@ -939,8 +994,8 @@ type MilvusServiceServer_DescribeAlias_Call struct { } // DescribeAlias is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.DescribeAliasRequest +// - _a0 context.Context +// - _a1 *milvuspb.DescribeAliasRequest func (_e *MilvusServiceServer_Expecter) DescribeAlias(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_DescribeAlias_Call { return &MilvusServiceServer_DescribeAlias_Call{Call: _e.mock.On("DescribeAlias", _a0, _a1)} } @@ -994,8 +1049,8 @@ type MilvusServiceServer_DescribeCollection_Call struct { } // DescribeCollection is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.DescribeCollectionRequest +// - _a0 context.Context +// - _a1 *milvuspb.DescribeCollectionRequest func (_e *MilvusServiceServer_Expecter) DescribeCollection(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_DescribeCollection_Call { return &MilvusServiceServer_DescribeCollection_Call{Call: _e.mock.On("DescribeCollection", _a0, _a1)} } @@ -1049,8 +1104,8 @@ type MilvusServiceServer_DescribeIndex_Call struct { } // DescribeIndex is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.DescribeIndexRequest +// - _a0 context.Context +// - _a1 *milvuspb.DescribeIndexRequest func (_e *MilvusServiceServer_Expecter) DescribeIndex(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_DescribeIndex_Call { return &MilvusServiceServer_DescribeIndex_Call{Call: _e.mock.On("DescribeIndex", _a0, _a1)} } @@ -1104,8 +1159,8 @@ type MilvusServiceServer_DescribeResourceGroup_Call struct { } // DescribeResourceGroup is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.DescribeResourceGroupRequest +// - _a0 context.Context +// - _a1 *milvuspb.DescribeResourceGroupRequest func (_e *MilvusServiceServer_Expecter) DescribeResourceGroup(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_DescribeResourceGroup_Call { return &MilvusServiceServer_DescribeResourceGroup_Call{Call: _e.mock.On("DescribeResourceGroup", _a0, _a1)} } @@ -1159,8 +1214,8 @@ type MilvusServiceServer_DescribeSegmentIndexData_Call struct { } // DescribeSegmentIndexData is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *federpb.DescribeSegmentIndexDataRequest +// - _a0 context.Context +// - _a1 *federpb.DescribeSegmentIndexDataRequest func (_e *MilvusServiceServer_Expecter) DescribeSegmentIndexData(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_DescribeSegmentIndexData_Call { return &MilvusServiceServer_DescribeSegmentIndexData_Call{Call: _e.mock.On("DescribeSegmentIndexData", _a0, _a1)} } @@ -1214,8 +1269,8 @@ type MilvusServiceServer_DropAlias_Call struct { } // DropAlias is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.DropAliasRequest +// - _a0 context.Context +// - _a1 *milvuspb.DropAliasRequest func (_e *MilvusServiceServer_Expecter) DropAlias(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_DropAlias_Call { return &MilvusServiceServer_DropAlias_Call{Call: _e.mock.On("DropAlias", _a0, _a1)} } @@ -1269,8 +1324,8 @@ type MilvusServiceServer_DropCollection_Call struct { } // DropCollection is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.DropCollectionRequest +// - _a0 context.Context +// - _a1 *milvuspb.DropCollectionRequest func (_e *MilvusServiceServer_Expecter) DropCollection(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_DropCollection_Call { return &MilvusServiceServer_DropCollection_Call{Call: _e.mock.On("DropCollection", _a0, _a1)} } @@ -1324,8 +1379,8 @@ type MilvusServiceServer_DropDatabase_Call struct { } // DropDatabase is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.DropDatabaseRequest +// - _a0 context.Context +// - _a1 *milvuspb.DropDatabaseRequest func (_e *MilvusServiceServer_Expecter) DropDatabase(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_DropDatabase_Call { return &MilvusServiceServer_DropDatabase_Call{Call: _e.mock.On("DropDatabase", _a0, _a1)} } @@ -1379,8 +1434,8 @@ type MilvusServiceServer_DropIndex_Call struct { } // DropIndex is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.DropIndexRequest +// - _a0 context.Context +// - _a1 *milvuspb.DropIndexRequest func (_e *MilvusServiceServer_Expecter) DropIndex(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_DropIndex_Call { return &MilvusServiceServer_DropIndex_Call{Call: _e.mock.On("DropIndex", _a0, _a1)} } @@ -1434,8 +1489,8 @@ type MilvusServiceServer_DropPartition_Call struct { } // DropPartition is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.DropPartitionRequest +// - _a0 context.Context +// - _a1 *milvuspb.DropPartitionRequest func (_e *MilvusServiceServer_Expecter) DropPartition(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_DropPartition_Call { return &MilvusServiceServer_DropPartition_Call{Call: _e.mock.On("DropPartition", _a0, _a1)} } @@ -1489,8 +1544,8 @@ type MilvusServiceServer_DropResourceGroup_Call struct { } // DropResourceGroup is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.DropResourceGroupRequest +// - _a0 context.Context +// - _a1 *milvuspb.DropResourceGroupRequest func (_e *MilvusServiceServer_Expecter) DropResourceGroup(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_DropResourceGroup_Call { return &MilvusServiceServer_DropResourceGroup_Call{Call: _e.mock.On("DropResourceGroup", _a0, _a1)} } @@ -1544,8 +1599,8 @@ type MilvusServiceServer_DropRole_Call struct { } // DropRole is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.DropRoleRequest +// - _a0 context.Context +// - _a1 *milvuspb.DropRoleRequest func (_e *MilvusServiceServer_Expecter) DropRole(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_DropRole_Call { return &MilvusServiceServer_DropRole_Call{Call: _e.mock.On("DropRole", _a0, _a1)} } @@ -1599,8 +1654,8 @@ type MilvusServiceServer_Dummy_Call struct { } // Dummy is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.DummyRequest +// - _a0 context.Context +// - _a1 *milvuspb.DummyRequest func (_e *MilvusServiceServer_Expecter) Dummy(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_Dummy_Call { return &MilvusServiceServer_Dummy_Call{Call: _e.mock.On("Dummy", _a0, _a1)} } @@ -1654,8 +1709,8 @@ type MilvusServiceServer_Flush_Call struct { } // Flush is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.FlushRequest +// - _a0 context.Context +// - _a1 *milvuspb.FlushRequest func (_e *MilvusServiceServer_Expecter) Flush(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_Flush_Call { return &MilvusServiceServer_Flush_Call{Call: _e.mock.On("Flush", _a0, _a1)} } @@ -1709,8 +1764,8 @@ type MilvusServiceServer_FlushAll_Call struct { } // FlushAll is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.FlushAllRequest +// - _a0 context.Context +// - _a1 *milvuspb.FlushAllRequest func (_e *MilvusServiceServer_Expecter) FlushAll(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_FlushAll_Call { return &MilvusServiceServer_FlushAll_Call{Call: _e.mock.On("FlushAll", _a0, _a1)} } @@ -1764,8 +1819,8 @@ type MilvusServiceServer_GetCollectionStatistics_Call struct { } // GetCollectionStatistics is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetCollectionStatisticsRequest +// - _a0 context.Context +// - _a1 *milvuspb.GetCollectionStatisticsRequest func (_e *MilvusServiceServer_Expecter) GetCollectionStatistics(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_GetCollectionStatistics_Call { return &MilvusServiceServer_GetCollectionStatistics_Call{Call: _e.mock.On("GetCollectionStatistics", _a0, _a1)} } @@ -1819,8 +1874,8 @@ type MilvusServiceServer_GetCompactionState_Call struct { } // GetCompactionState is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetCompactionStateRequest +// - _a0 context.Context +// - _a1 *milvuspb.GetCompactionStateRequest func (_e *MilvusServiceServer_Expecter) GetCompactionState(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_GetCompactionState_Call { return &MilvusServiceServer_GetCompactionState_Call{Call: _e.mock.On("GetCompactionState", _a0, _a1)} } @@ -1874,8 +1929,8 @@ type MilvusServiceServer_GetCompactionStateWithPlans_Call struct { } // GetCompactionStateWithPlans is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetCompactionPlansRequest +// - _a0 context.Context +// - _a1 *milvuspb.GetCompactionPlansRequest func (_e *MilvusServiceServer_Expecter) GetCompactionStateWithPlans(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_GetCompactionStateWithPlans_Call { return &MilvusServiceServer_GetCompactionStateWithPlans_Call{Call: _e.mock.On("GetCompactionStateWithPlans", _a0, _a1)} } @@ -1929,8 +1984,8 @@ type MilvusServiceServer_GetComponentStates_Call struct { } // GetComponentStates is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetComponentStatesRequest +// - _a0 context.Context +// - _a1 *milvuspb.GetComponentStatesRequest func (_e *MilvusServiceServer_Expecter) GetComponentStates(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_GetComponentStates_Call { return &MilvusServiceServer_GetComponentStates_Call{Call: _e.mock.On("GetComponentStates", _a0, _a1)} } @@ -1984,8 +2039,8 @@ type MilvusServiceServer_GetFlushAllState_Call struct { } // GetFlushAllState is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetFlushAllStateRequest +// - _a0 context.Context +// - _a1 *milvuspb.GetFlushAllStateRequest func (_e *MilvusServiceServer_Expecter) GetFlushAllState(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_GetFlushAllState_Call { return &MilvusServiceServer_GetFlushAllState_Call{Call: _e.mock.On("GetFlushAllState", _a0, _a1)} } @@ -2039,8 +2094,8 @@ type MilvusServiceServer_GetFlushState_Call struct { } // GetFlushState is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetFlushStateRequest +// - _a0 context.Context +// - _a1 *milvuspb.GetFlushStateRequest func (_e *MilvusServiceServer_Expecter) GetFlushState(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_GetFlushState_Call { return &MilvusServiceServer_GetFlushState_Call{Call: _e.mock.On("GetFlushState", _a0, _a1)} } @@ -2094,8 +2149,8 @@ type MilvusServiceServer_GetImportState_Call struct { } // GetImportState is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetImportStateRequest +// - _a0 context.Context +// - _a1 *milvuspb.GetImportStateRequest func (_e *MilvusServiceServer_Expecter) GetImportState(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_GetImportState_Call { return &MilvusServiceServer_GetImportState_Call{Call: _e.mock.On("GetImportState", _a0, _a1)} } @@ -2149,8 +2204,8 @@ type MilvusServiceServer_GetIndexBuildProgress_Call struct { } // GetIndexBuildProgress is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetIndexBuildProgressRequest +// - _a0 context.Context +// - _a1 *milvuspb.GetIndexBuildProgressRequest func (_e *MilvusServiceServer_Expecter) GetIndexBuildProgress(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_GetIndexBuildProgress_Call { return &MilvusServiceServer_GetIndexBuildProgress_Call{Call: _e.mock.On("GetIndexBuildProgress", _a0, _a1)} } @@ -2204,8 +2259,8 @@ type MilvusServiceServer_GetIndexState_Call struct { } // GetIndexState is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetIndexStateRequest +// - _a0 context.Context +// - _a1 *milvuspb.GetIndexStateRequest func (_e *MilvusServiceServer_Expecter) GetIndexState(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_GetIndexState_Call { return &MilvusServiceServer_GetIndexState_Call{Call: _e.mock.On("GetIndexState", _a0, _a1)} } @@ -2259,8 +2314,8 @@ type MilvusServiceServer_GetIndexStatistics_Call struct { } // GetIndexStatistics is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetIndexStatisticsRequest +// - _a0 context.Context +// - _a1 *milvuspb.GetIndexStatisticsRequest func (_e *MilvusServiceServer_Expecter) GetIndexStatistics(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_GetIndexStatistics_Call { return &MilvusServiceServer_GetIndexStatistics_Call{Call: _e.mock.On("GetIndexStatistics", _a0, _a1)} } @@ -2314,8 +2369,8 @@ type MilvusServiceServer_GetLoadState_Call struct { } // GetLoadState is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetLoadStateRequest +// - _a0 context.Context +// - _a1 *milvuspb.GetLoadStateRequest func (_e *MilvusServiceServer_Expecter) GetLoadState(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_GetLoadState_Call { return &MilvusServiceServer_GetLoadState_Call{Call: _e.mock.On("GetLoadState", _a0, _a1)} } @@ -2369,8 +2424,8 @@ type MilvusServiceServer_GetLoadingProgress_Call struct { } // GetLoadingProgress is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetLoadingProgressRequest +// - _a0 context.Context +// - _a1 *milvuspb.GetLoadingProgressRequest func (_e *MilvusServiceServer_Expecter) GetLoadingProgress(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_GetLoadingProgress_Call { return &MilvusServiceServer_GetLoadingProgress_Call{Call: _e.mock.On("GetLoadingProgress", _a0, _a1)} } @@ -2424,8 +2479,8 @@ type MilvusServiceServer_GetMetrics_Call struct { } // GetMetrics is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetMetricsRequest +// - _a0 context.Context +// - _a1 *milvuspb.GetMetricsRequest func (_e *MilvusServiceServer_Expecter) GetMetrics(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_GetMetrics_Call { return &MilvusServiceServer_GetMetrics_Call{Call: _e.mock.On("GetMetrics", _a0, _a1)} } @@ -2479,8 +2534,8 @@ type MilvusServiceServer_GetPartitionStatistics_Call struct { } // GetPartitionStatistics is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetPartitionStatisticsRequest +// - _a0 context.Context +// - _a1 *milvuspb.GetPartitionStatisticsRequest func (_e *MilvusServiceServer_Expecter) GetPartitionStatistics(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_GetPartitionStatistics_Call { return &MilvusServiceServer_GetPartitionStatistics_Call{Call: _e.mock.On("GetPartitionStatistics", _a0, _a1)} } @@ -2534,8 +2589,8 @@ type MilvusServiceServer_GetPersistentSegmentInfo_Call struct { } // GetPersistentSegmentInfo is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetPersistentSegmentInfoRequest +// - _a0 context.Context +// - _a1 *milvuspb.GetPersistentSegmentInfoRequest func (_e *MilvusServiceServer_Expecter) GetPersistentSegmentInfo(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_GetPersistentSegmentInfo_Call { return &MilvusServiceServer_GetPersistentSegmentInfo_Call{Call: _e.mock.On("GetPersistentSegmentInfo", _a0, _a1)} } @@ -2589,8 +2644,8 @@ type MilvusServiceServer_GetQuerySegmentInfo_Call struct { } // GetQuerySegmentInfo is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetQuerySegmentInfoRequest +// - _a0 context.Context +// - _a1 *milvuspb.GetQuerySegmentInfoRequest func (_e *MilvusServiceServer_Expecter) GetQuerySegmentInfo(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_GetQuerySegmentInfo_Call { return &MilvusServiceServer_GetQuerySegmentInfo_Call{Call: _e.mock.On("GetQuerySegmentInfo", _a0, _a1)} } @@ -2644,8 +2699,8 @@ type MilvusServiceServer_GetReplicas_Call struct { } // GetReplicas is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetReplicasRequest +// - _a0 context.Context +// - _a1 *milvuspb.GetReplicasRequest func (_e *MilvusServiceServer_Expecter) GetReplicas(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_GetReplicas_Call { return &MilvusServiceServer_GetReplicas_Call{Call: _e.mock.On("GetReplicas", _a0, _a1)} } @@ -2699,8 +2754,8 @@ type MilvusServiceServer_GetVersion_Call struct { } // GetVersion is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetVersionRequest +// - _a0 context.Context +// - _a1 *milvuspb.GetVersionRequest func (_e *MilvusServiceServer_Expecter) GetVersion(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_GetVersion_Call { return &MilvusServiceServer_GetVersion_Call{Call: _e.mock.On("GetVersion", _a0, _a1)} } @@ -2754,8 +2809,8 @@ type MilvusServiceServer_HasCollection_Call struct { } // HasCollection is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.HasCollectionRequest +// - _a0 context.Context +// - _a1 *milvuspb.HasCollectionRequest func (_e *MilvusServiceServer_Expecter) HasCollection(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_HasCollection_Call { return &MilvusServiceServer_HasCollection_Call{Call: _e.mock.On("HasCollection", _a0, _a1)} } @@ -2809,8 +2864,8 @@ type MilvusServiceServer_HasPartition_Call struct { } // HasPartition is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.HasPartitionRequest +// - _a0 context.Context +// - _a1 *milvuspb.HasPartitionRequest func (_e *MilvusServiceServer_Expecter) HasPartition(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_HasPartition_Call { return &MilvusServiceServer_HasPartition_Call{Call: _e.mock.On("HasPartition", _a0, _a1)} } @@ -2864,8 +2919,8 @@ type MilvusServiceServer_Import_Call struct { } // Import is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.ImportRequest +// - _a0 context.Context +// - _a1 *milvuspb.ImportRequest func (_e *MilvusServiceServer_Expecter) Import(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_Import_Call { return &MilvusServiceServer_Import_Call{Call: _e.mock.On("Import", _a0, _a1)} } @@ -2919,8 +2974,8 @@ type MilvusServiceServer_Insert_Call struct { } // Insert is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.InsertRequest +// - _a0 context.Context +// - _a1 *milvuspb.InsertRequest func (_e *MilvusServiceServer_Expecter) Insert(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_Insert_Call { return &MilvusServiceServer_Insert_Call{Call: _e.mock.On("Insert", _a0, _a1)} } @@ -2974,8 +3029,8 @@ type MilvusServiceServer_ListAliases_Call struct { } // ListAliases is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.ListAliasesRequest +// - _a0 context.Context +// - _a1 *milvuspb.ListAliasesRequest func (_e *MilvusServiceServer_Expecter) ListAliases(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_ListAliases_Call { return &MilvusServiceServer_ListAliases_Call{Call: _e.mock.On("ListAliases", _a0, _a1)} } @@ -3029,8 +3084,8 @@ type MilvusServiceServer_ListCredUsers_Call struct { } // ListCredUsers is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.ListCredUsersRequest +// - _a0 context.Context +// - _a1 *milvuspb.ListCredUsersRequest func (_e *MilvusServiceServer_Expecter) ListCredUsers(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_ListCredUsers_Call { return &MilvusServiceServer_ListCredUsers_Call{Call: _e.mock.On("ListCredUsers", _a0, _a1)} } @@ -3084,8 +3139,8 @@ type MilvusServiceServer_ListDatabases_Call struct { } // ListDatabases is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.ListDatabasesRequest +// - _a0 context.Context +// - _a1 *milvuspb.ListDatabasesRequest func (_e *MilvusServiceServer_Expecter) ListDatabases(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_ListDatabases_Call { return &MilvusServiceServer_ListDatabases_Call{Call: _e.mock.On("ListDatabases", _a0, _a1)} } @@ -3139,8 +3194,8 @@ type MilvusServiceServer_ListImportTasks_Call struct { } // ListImportTasks is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.ListImportTasksRequest +// - _a0 context.Context +// - _a1 *milvuspb.ListImportTasksRequest func (_e *MilvusServiceServer_Expecter) ListImportTasks(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_ListImportTasks_Call { return &MilvusServiceServer_ListImportTasks_Call{Call: _e.mock.On("ListImportTasks", _a0, _a1)} } @@ -3194,8 +3249,8 @@ type MilvusServiceServer_ListIndexedSegment_Call struct { } // ListIndexedSegment is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *federpb.ListIndexedSegmentRequest +// - _a0 context.Context +// - _a1 *federpb.ListIndexedSegmentRequest func (_e *MilvusServiceServer_Expecter) ListIndexedSegment(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_ListIndexedSegment_Call { return &MilvusServiceServer_ListIndexedSegment_Call{Call: _e.mock.On("ListIndexedSegment", _a0, _a1)} } @@ -3249,8 +3304,8 @@ type MilvusServiceServer_ListResourceGroups_Call struct { } // ListResourceGroups is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.ListResourceGroupsRequest +// - _a0 context.Context +// - _a1 *milvuspb.ListResourceGroupsRequest func (_e *MilvusServiceServer_Expecter) ListResourceGroups(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_ListResourceGroups_Call { return &MilvusServiceServer_ListResourceGroups_Call{Call: _e.mock.On("ListResourceGroups", _a0, _a1)} } @@ -3304,8 +3359,8 @@ type MilvusServiceServer_LoadBalance_Call struct { } // LoadBalance is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.LoadBalanceRequest +// - _a0 context.Context +// - _a1 *milvuspb.LoadBalanceRequest func (_e *MilvusServiceServer_Expecter) LoadBalance(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_LoadBalance_Call { return &MilvusServiceServer_LoadBalance_Call{Call: _e.mock.On("LoadBalance", _a0, _a1)} } @@ -3359,8 +3414,8 @@ type MilvusServiceServer_LoadCollection_Call struct { } // LoadCollection is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.LoadCollectionRequest +// - _a0 context.Context +// - _a1 *milvuspb.LoadCollectionRequest func (_e *MilvusServiceServer_Expecter) LoadCollection(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_LoadCollection_Call { return &MilvusServiceServer_LoadCollection_Call{Call: _e.mock.On("LoadCollection", _a0, _a1)} } @@ -3414,8 +3469,8 @@ type MilvusServiceServer_LoadPartitions_Call struct { } // LoadPartitions is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.LoadPartitionsRequest +// - _a0 context.Context +// - _a1 *milvuspb.LoadPartitionsRequest func (_e *MilvusServiceServer_Expecter) LoadPartitions(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_LoadPartitions_Call { return &MilvusServiceServer_LoadPartitions_Call{Call: _e.mock.On("LoadPartitions", _a0, _a1)} } @@ -3469,8 +3524,8 @@ type MilvusServiceServer_ManualCompaction_Call struct { } // ManualCompaction is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.ManualCompactionRequest +// - _a0 context.Context +// - _a1 *milvuspb.ManualCompactionRequest func (_e *MilvusServiceServer_Expecter) ManualCompaction(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_ManualCompaction_Call { return &MilvusServiceServer_ManualCompaction_Call{Call: _e.mock.On("ManualCompaction", _a0, _a1)} } @@ -3524,8 +3579,8 @@ type MilvusServiceServer_OperatePrivilege_Call struct { } // OperatePrivilege is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.OperatePrivilegeRequest +// - _a0 context.Context +// - _a1 *milvuspb.OperatePrivilegeRequest func (_e *MilvusServiceServer_Expecter) OperatePrivilege(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_OperatePrivilege_Call { return &MilvusServiceServer_OperatePrivilege_Call{Call: _e.mock.On("OperatePrivilege", _a0, _a1)} } @@ -3579,8 +3634,8 @@ type MilvusServiceServer_OperateUserRole_Call struct { } // OperateUserRole is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.OperateUserRoleRequest +// - _a0 context.Context +// - _a1 *milvuspb.OperateUserRoleRequest func (_e *MilvusServiceServer_Expecter) OperateUserRole(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_OperateUserRole_Call { return &MilvusServiceServer_OperateUserRole_Call{Call: _e.mock.On("OperateUserRole", _a0, _a1)} } @@ -3634,8 +3689,8 @@ type MilvusServiceServer_Query_Call struct { } // Query is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.QueryRequest +// - _a0 context.Context +// - _a1 *milvuspb.QueryRequest func (_e *MilvusServiceServer_Expecter) Query(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_Query_Call { return &MilvusServiceServer_Query_Call{Call: _e.mock.On("Query", _a0, _a1)} } @@ -3689,8 +3744,8 @@ type MilvusServiceServer_RegisterLink_Call struct { } // RegisterLink is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.RegisterLinkRequest +// - _a0 context.Context +// - _a1 *milvuspb.RegisterLinkRequest func (_e *MilvusServiceServer_Expecter) RegisterLink(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_RegisterLink_Call { return &MilvusServiceServer_RegisterLink_Call{Call: _e.mock.On("RegisterLink", _a0, _a1)} } @@ -3744,8 +3799,8 @@ type MilvusServiceServer_ReleaseCollection_Call struct { } // ReleaseCollection is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.ReleaseCollectionRequest +// - _a0 context.Context +// - _a1 *milvuspb.ReleaseCollectionRequest func (_e *MilvusServiceServer_Expecter) ReleaseCollection(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_ReleaseCollection_Call { return &MilvusServiceServer_ReleaseCollection_Call{Call: _e.mock.On("ReleaseCollection", _a0, _a1)} } @@ -3799,8 +3854,8 @@ type MilvusServiceServer_ReleasePartitions_Call struct { } // ReleasePartitions is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.ReleasePartitionsRequest +// - _a0 context.Context +// - _a1 *milvuspb.ReleasePartitionsRequest func (_e *MilvusServiceServer_Expecter) ReleasePartitions(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_ReleasePartitions_Call { return &MilvusServiceServer_ReleasePartitions_Call{Call: _e.mock.On("ReleasePartitions", _a0, _a1)} } @@ -3854,8 +3909,8 @@ type MilvusServiceServer_RenameCollection_Call struct { } // RenameCollection is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.RenameCollectionRequest +// - _a0 context.Context +// - _a1 *milvuspb.RenameCollectionRequest func (_e *MilvusServiceServer_Expecter) RenameCollection(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_RenameCollection_Call { return &MilvusServiceServer_RenameCollection_Call{Call: _e.mock.On("RenameCollection", _a0, _a1)} } @@ -3964,8 +4019,8 @@ type MilvusServiceServer_Search_Call struct { } // Search is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.SearchRequest +// - _a0 context.Context +// - _a1 *milvuspb.SearchRequest func (_e *MilvusServiceServer_Expecter) Search(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_Search_Call { return &MilvusServiceServer_Search_Call{Call: _e.mock.On("Search", _a0, _a1)} } @@ -3987,6 +4042,61 @@ func (_c *MilvusServiceServer_Search_Call) RunAndReturn(run func(context.Context return _c } +// SearchV2 provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) SearchV2(_a0 context.Context, _a1 *milvuspb.SearchRequestV2) (*milvuspb.SearchResults, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.SearchResults + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.SearchRequestV2) (*milvuspb.SearchResults, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.SearchRequestV2) *milvuspb.SearchResults); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.SearchResults) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.SearchRequestV2) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_SearchV2_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SearchV2' +type MilvusServiceServer_SearchV2_Call struct { + *mock.Call +} + +// SearchV2 is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *milvuspb.SearchRequestV2 +func (_e *MilvusServiceServer_Expecter) SearchV2(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_SearchV2_Call { + return &MilvusServiceServer_SearchV2_Call{Call: _e.mock.On("SearchV2", _a0, _a1)} +} + +func (_c *MilvusServiceServer_SearchV2_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.SearchRequestV2)) *MilvusServiceServer_SearchV2_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.SearchRequestV2)) + }) + return _c +} + +func (_c *MilvusServiceServer_SearchV2_Call) Return(_a0 *milvuspb.SearchResults, _a1 error) *MilvusServiceServer_SearchV2_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_SearchV2_Call) RunAndReturn(run func(context.Context, *milvuspb.SearchRequestV2) (*milvuspb.SearchResults, error)) *MilvusServiceServer_SearchV2_Call { + _c.Call.Return(run) + return _c +} + // SelectGrant provides a mock function with given fields: _a0, _a1 func (_m *MilvusServiceServer) SelectGrant(_a0 context.Context, _a1 *milvuspb.SelectGrantRequest) (*milvuspb.SelectGrantResponse, error) { ret := _m.Called(_a0, _a1) @@ -4019,8 +4129,8 @@ type MilvusServiceServer_SelectGrant_Call struct { } // SelectGrant is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.SelectGrantRequest +// - _a0 context.Context +// - _a1 *milvuspb.SelectGrantRequest func (_e *MilvusServiceServer_Expecter) SelectGrant(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_SelectGrant_Call { return &MilvusServiceServer_SelectGrant_Call{Call: _e.mock.On("SelectGrant", _a0, _a1)} } @@ -4074,8 +4184,8 @@ type MilvusServiceServer_SelectRole_Call struct { } // SelectRole is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.SelectRoleRequest +// - _a0 context.Context +// - _a1 *milvuspb.SelectRoleRequest func (_e *MilvusServiceServer_Expecter) SelectRole(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_SelectRole_Call { return &MilvusServiceServer_SelectRole_Call{Call: _e.mock.On("SelectRole", _a0, _a1)} } @@ -4129,8 +4239,8 @@ type MilvusServiceServer_SelectUser_Call struct { } // SelectUser is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.SelectUserRequest +// - _a0 context.Context +// - _a1 *milvuspb.SelectUserRequest func (_e *MilvusServiceServer_Expecter) SelectUser(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_SelectUser_Call { return &MilvusServiceServer_SelectUser_Call{Call: _e.mock.On("SelectUser", _a0, _a1)} } @@ -4184,8 +4294,8 @@ type MilvusServiceServer_ShowCollections_Call struct { } // ShowCollections is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.ShowCollectionsRequest +// - _a0 context.Context +// - _a1 *milvuspb.ShowCollectionsRequest func (_e *MilvusServiceServer_Expecter) ShowCollections(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_ShowCollections_Call { return &MilvusServiceServer_ShowCollections_Call{Call: _e.mock.On("ShowCollections", _a0, _a1)} } @@ -4239,8 +4349,8 @@ type MilvusServiceServer_ShowPartitions_Call struct { } // ShowPartitions is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.ShowPartitionsRequest +// - _a0 context.Context +// - _a1 *milvuspb.ShowPartitionsRequest func (_e *MilvusServiceServer_Expecter) ShowPartitions(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_ShowPartitions_Call { return &MilvusServiceServer_ShowPartitions_Call{Call: _e.mock.On("ShowPartitions", _a0, _a1)} } @@ -4294,8 +4404,8 @@ type MilvusServiceServer_TransferNode_Call struct { } // TransferNode is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.TransferNodeRequest +// - _a0 context.Context +// - _a1 *milvuspb.TransferNodeRequest func (_e *MilvusServiceServer_Expecter) TransferNode(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_TransferNode_Call { return &MilvusServiceServer_TransferNode_Call{Call: _e.mock.On("TransferNode", _a0, _a1)} } @@ -4349,8 +4459,8 @@ type MilvusServiceServer_TransferReplica_Call struct { } // TransferReplica is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.TransferReplicaRequest +// - _a0 context.Context +// - _a1 *milvuspb.TransferReplicaRequest func (_e *MilvusServiceServer_Expecter) TransferReplica(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_TransferReplica_Call { return &MilvusServiceServer_TransferReplica_Call{Call: _e.mock.On("TransferReplica", _a0, _a1)} } @@ -4404,8 +4514,8 @@ type MilvusServiceServer_UpdateCredential_Call struct { } // UpdateCredential is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.UpdateCredentialRequest +// - _a0 context.Context +// - _a1 *milvuspb.UpdateCredentialRequest func (_e *MilvusServiceServer_Expecter) UpdateCredential(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_UpdateCredential_Call { return &MilvusServiceServer_UpdateCredential_Call{Call: _e.mock.On("UpdateCredential", _a0, _a1)} } @@ -4459,8 +4569,8 @@ type MilvusServiceServer_Upsert_Call struct { } // Upsert is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.UpsertRequest +// - _a0 context.Context +// - _a1 *milvuspb.UpsertRequest func (_e *MilvusServiceServer_Expecter) Upsert(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_Upsert_Call { return &MilvusServiceServer_Upsert_Call{Call: _e.mock.On("Upsert", _a0, _a1)} } From 6ee2d849fdffe5a449e04d5b8cd346b4240e9dc4 Mon Sep 17 00:00:00 2001 From: Congqi Xia Date: Wed, 3 Jan 2024 19:13:59 +0800 Subject: [PATCH 3/3] Fix Combine logic error Signed-off-by: Congqi Xia --- merr/errors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/merr/errors.go b/merr/errors.go index 0db96333..e7c86bf1 100644 --- a/merr/errors.go +++ b/merr/errors.go @@ -234,7 +234,7 @@ func Combine(errs ...error) error { filtered = append(filtered, e) } } - if len(errs) == 0 { + if len(filtered) == 0 { return nil } return multiErrors{