From 2a6f634b31a2d6b938cebbf415091231876137bc Mon Sep 17 00:00:00 2001 From: congqixia Date: Fri, 10 May 2024 18:01:30 +0800 Subject: [PATCH] feat: Add `milvusclient` package and migrate GoSDK (#32907) Related to #31293 Signed-off-by: Congqi Xia --- .github/workflows/main.yaml | 2 + client/Makefile | 33 + client/OWNERS | 6 + client/client.go | 157 + client/client_config.go | 182 + client/client_suite_test.go | 251 ++ client/client_test.go | 43 + client/collection.go | 134 + client/collection_options.go | 232 ++ client/collection_test.go | 253 ++ client/column/array.go | 125 + client/column/array_gen.go | 705 ++++ client/column/columns.go | 502 +++ client/column/columns_test.go | 160 + client/column/conversion.go | 53 + client/column/dynamic.go | 113 + client/column/dynamic_test.go | 162 + client/column/json.go | 146 + client/column/json_test.go | 101 + client/column/scalar_gen.go | 708 ++++ client/column/scalar_gen_test.go | 855 +++++ client/column/sparse.go | 125 + client/column/sparse_test.go | 81 + client/column/varchar.go | 119 + client/column/varchar_test.go | 134 + client/column/vector_gen.go | 358 ++ client/column/vector_gen_test.go | 264 ++ client/common.go | 44 + client/common/version.go | 22 + client/common/version_test.go | 29 + client/database.go | 60 + client/database_options.go | 74 + client/database_test.go | 92 + client/doc.go | 18 + client/entity/collection.go | 56 + client/entity/collection_attr.go | 96 + client/entity/collection_attr_test.go | 136 + client/entity/common.go | 32 + client/entity/field_type.go | 171 + client/entity/schema.go | 341 ++ client/entity/schema_test.go | 138 + client/entity/sparse.go | 124 + client/entity/sparse_test.go | 68 + client/entity/vectors.go | 106 + client/entity/vectors_test.go | 51 + client/go.mod | 125 + client/go.sum | 1121 ++++++ client/index.go | 159 + client/index/common.go | 61 + client/index/disk_ann.go | 38 + client/index/flat.go | 38 + client/index/hnsw.go | 53 + client/index/index.go | 79 + client/index/index_test.go | 17 + client/index/ivf.go | 108 + client/index/scann.go | 50 + client/index_options.go | 137 + client/index_test.go | 221 ++ client/maintenance.go | 171 + client/maintenance_options.go | 125 + client/maintenance_test.go | 229 ++ client/mock_milvus_server_test.go | 4717 +++++++++++++++++++++++++ client/partition.go | 77 + client/partition_options.go | 119 + client/partition_test.go | 166 + client/read.go | 220 ++ client/read_options.go | 250 ++ client/read_test.go | 154 + client/write.go | 74 + client/write_option_test.go | 39 + client/write_options.go | 290 ++ client/write_test.go | 330 ++ scripts/run_go_codecov.sh | 10 + 73 files changed, 16840 insertions(+) create mode 100644 client/Makefile create mode 100644 client/OWNERS create mode 100644 client/client.go create mode 100644 client/client_config.go create mode 100644 client/client_suite_test.go create mode 100644 client/client_test.go create mode 100644 client/collection.go create mode 100644 client/collection_options.go create mode 100644 client/collection_test.go create mode 100644 client/column/array.go create mode 100644 client/column/array_gen.go create mode 100644 client/column/columns.go create mode 100644 client/column/columns_test.go create mode 100644 client/column/conversion.go create mode 100644 client/column/dynamic.go create mode 100644 client/column/dynamic_test.go create mode 100644 client/column/json.go create mode 100644 client/column/json_test.go create mode 100644 client/column/scalar_gen.go create mode 100644 client/column/scalar_gen_test.go create mode 100644 client/column/sparse.go create mode 100644 client/column/sparse_test.go create mode 100644 client/column/varchar.go create mode 100644 client/column/varchar_test.go create mode 100644 client/column/vector_gen.go create mode 100644 client/column/vector_gen_test.go create mode 100644 client/common.go create mode 100644 client/common/version.go create mode 100644 client/common/version_test.go create mode 100644 client/database.go create mode 100644 client/database_options.go create mode 100644 client/database_test.go create mode 100644 client/doc.go create mode 100644 client/entity/collection.go create mode 100644 client/entity/collection_attr.go create mode 100644 client/entity/collection_attr_test.go create mode 100644 client/entity/common.go create mode 100644 client/entity/field_type.go create mode 100644 client/entity/schema.go create mode 100644 client/entity/schema_test.go create mode 100644 client/entity/sparse.go create mode 100644 client/entity/sparse_test.go create mode 100644 client/entity/vectors.go create mode 100644 client/entity/vectors_test.go create mode 100644 client/go.mod create mode 100644 client/go.sum create mode 100644 client/index.go create mode 100644 client/index/common.go create mode 100644 client/index/disk_ann.go create mode 100644 client/index/flat.go create mode 100644 client/index/hnsw.go create mode 100644 client/index/index.go create mode 100644 client/index/index_test.go create mode 100644 client/index/ivf.go create mode 100644 client/index/scann.go create mode 100644 client/index_options.go create mode 100644 client/index_test.go create mode 100644 client/maintenance.go create mode 100644 client/maintenance_options.go create mode 100644 client/maintenance_test.go create mode 100644 client/mock_milvus_server_test.go create mode 100644 client/partition.go create mode 100644 client/partition_options.go create mode 100644 client/partition_test.go create mode 100644 client/read.go create mode 100644 client/read_options.go create mode 100644 client/read_test.go create mode 100644 client/write.go create mode 100644 client/write_option_test.go create mode 100644 client/write_options.go create mode 100644 client/write_test.go diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 7cdbbe6e955f8..954e3054ee7d0 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -7,6 +7,7 @@ on: paths: - 'scripts/**' - 'internal/**' + - 'client/**' - 'pkg/**' - 'cmd/**' - 'build/**' @@ -24,6 +25,7 @@ on: - 'scripts/**' - 'internal/**' - 'pkg/**' + - 'client/**' - 'cmd/**' - 'build/**' - 'tests/integration/**' # run integration test diff --git a/client/Makefile b/client/Makefile new file mode 100644 index 0000000000000..a8ca3a1de382d --- /dev/null +++ b/client/Makefile @@ -0,0 +1,33 @@ +# 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. + +GO ?= go +PWD := $(shell pwd) +GOPATH := $(shell $(GO) env GOPATH) +SHELL := /bin/bash +OBJPREFIX := "github.com/milvus-io/milvus/cmd/milvus/v2" + +# TODO pass golangci-lint path +lint: + @echo "Running lint checks..." + +unittest: + @echo "Running unittests..." + @(env bash $(PWD)/scripts/run_unittest.sh) + +generate-mockery: + @echo "Generating mockery Milvus service server" + @../bin/mockery --srcpkg=github.com/milvus-io/milvus-proto/go-api/v2/milvuspb --name=MilvusServiceServer --filename=mock_milvus_server_test.go --output=. --outpkg=client --with-expecter diff --git a/client/OWNERS b/client/OWNERS new file mode 100644 index 0000000000000..1e038a20ebbe7 --- /dev/null +++ b/client/OWNERS @@ -0,0 +1,6 @@ +reviewers: + - congqixia + +approvers: + - maintainers + diff --git a/client/client.go b/client/client.go new file mode 100644 index 0000000000000..b515781106c30 --- /dev/null +++ b/client/client.go @@ -0,0 +1,157 @@ +// 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 client + +import ( + "context" + "fmt" + "os" + "strconv" + "time" + + "github.com/gogo/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + + "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus/client/v2/common" + "github.com/milvus-io/milvus/client/v2/entity" + "github.com/milvus-io/milvus/pkg/util/merr" +) + +type Client struct { + conn *grpc.ClientConn + service milvuspb.MilvusServiceClient + config *ClientConfig + + collCache *CollectionCache +} + +func New(ctx context.Context, config *ClientConfig) (*Client, error) { + if err := config.parse(); err != nil { + return nil, err + } + + c := &Client{ + config: config, + } + + // Parse remote address. + addr := c.config.getParsedAddress() + + // Parse grpc options + options := c.config.getDialOption() + + // Connect the grpc server. + if err := c.connect(ctx, addr, options...); err != nil { + return nil, err + } + + c.collCache = NewCollectionCache(func(ctx context.Context, collName string) (*entity.Collection, error) { + return c.DescribeCollection(ctx, NewDescribeCollectionOption(collName)) + }) + + return c, nil +} + +func (c *Client) Close(ctx context.Context) error { + if c.conn == nil { + return nil + } + err := c.conn.Close() + if err != nil { + return err + } + c.conn = nil + c.service = nil + return nil +} + +func (c *Client) connect(ctx context.Context, addr string, options ...grpc.DialOption) error { + if addr == "" { + return fmt.Errorf("address is empty") + } + conn, err := grpc.DialContext(ctx, addr, options...) + if err != nil { + return err + } + + c.conn = conn + c.service = milvuspb.NewMilvusServiceClient(c.conn) + + if !c.config.DisableConn { + err = c.connectInternal(ctx) + if err != nil { + return err + } + } + + return nil +} + +func (c *Client) connectInternal(ctx context.Context) error { + hostName, err := os.Hostname() + if err != nil { + return err + } + + req := &milvuspb.ConnectRequest{ + ClientInfo: &commonpb.ClientInfo{ + SdkType: "Golang", + SdkVersion: common.SDKVersion, + LocalTime: time.Now().String(), + User: c.config.Username, + Host: hostName, + }, + } + + resp, err := c.service.Connect(ctx, req) + if err != nil { + status, ok := status.FromError(err) + if ok { + if status.Code() == codes.Unimplemented { + // disable unsupported feature + c.config.addFlags( + disableDatabase | + disableJSON | + disableParitionKey | + disableDynamicSchema) + } + return nil + } + return err + } + + if !merr.Ok(resp.GetStatus()) { + return merr.Error(resp.GetStatus()) + } + + c.config.setServerInfo(resp.GetServerInfo().GetBuildTags()) + c.config.setIdentifier(strconv.FormatInt(resp.GetIdentifier(), 10)) + + return nil +} + +func (c *Client) callService(fn func(milvusService milvuspb.MilvusServiceClient) error) error { + service := c.service + if service == nil { + return merr.WrapErrServiceNotReady("SDK", 0, "not connected") + } + + return fn(c.service) +} diff --git a/client/client_config.go b/client/client_config.go new file mode 100644 index 0000000000000..998adbf761eba --- /dev/null +++ b/client/client_config.go @@ -0,0 +1,182 @@ +package client + +import ( + "crypto/tls" + "fmt" + "math" + "net/url" + "regexp" + "strings" + "time" + + "github.com/cockroachdb/errors" + grpc_retry "github.com/grpc-ecosystem/go-grpc-middleware/retry" + "google.golang.org/grpc" + "google.golang.org/grpc/backoff" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/keepalive" +) + +const ( + disableDatabase uint64 = 1 << iota + disableJSON + disableDynamicSchema + disableParitionKey +) + +var regexValidScheme = regexp.MustCompile(`^https?:\/\/`) + +// DefaultGrpcOpts is GRPC options for milvus client. +var DefaultGrpcOpts = []grpc.DialOption{ + grpc.WithBlock(), + grpc.WithKeepaliveParams(keepalive.ClientParameters{ + Time: 5 * time.Second, + Timeout: 10 * time.Second, + PermitWithoutStream: true, + }), + grpc.WithConnectParams(grpc.ConnectParams{ + Backoff: backoff.Config{ + BaseDelay: 100 * time.Millisecond, + Multiplier: 1.6, + Jitter: 0.2, + MaxDelay: 3 * time.Second, + }, + MinConnectTimeout: 3 * time.Second, + }), +} + +// ClientConfig for milvus client. +type ClientConfig struct { + Address string // Remote address, "localhost:19530". + Username string // Username for auth. + Password string // Password for auth. + DBName string // DBName for this client. + + EnableTLSAuth bool // Enable TLS Auth for transport security. + APIKey string // API key + + DialOptions []grpc.DialOption // Dial options for GRPC. + + // RetryRateLimit *RetryRateLimitOption // option for retry on rate limit inteceptor + + DisableConn bool + + identifier string // Identifier for this connection + ServerVersion string // ServerVersion + parsedAddress *url.URL + flags uint64 // internal flags +} + +func (cfg *ClientConfig) parse() error { + // Prepend default fake tcp:// scheme for remote address. + address := cfg.Address + if !regexValidScheme.MatchString(address) { + address = fmt.Sprintf("tcp://%s", address) + } + + remoteURL, err := url.Parse(address) + if err != nil { + return errors.Wrap(err, "milvus address parse fail") + } + // Remote Host should never be empty. + if remoteURL.Host == "" { + return errors.New("empty remote host of milvus address") + } + // Use DBName in remote url path. + if cfg.DBName == "" { + cfg.DBName = strings.TrimLeft(remoteURL.Path, "/") + } + // Always enable tls auth for https remote url. + if remoteURL.Scheme == "https" { + cfg.EnableTLSAuth = true + } + if remoteURL.Port() == "" && cfg.EnableTLSAuth { + remoteURL.Host += ":443" + } + cfg.parsedAddress = remoteURL + return nil +} + +// Get parsed remote milvus address, should be called after parse was called. +func (c *ClientConfig) getParsedAddress() string { + return c.parsedAddress.Host +} + +// useDatabase change the inner db name. +func (c *ClientConfig) useDatabase(dbName string) { + c.DBName = dbName +} + +// useDatabase change the inner db name. +func (c *ClientConfig) setIdentifier(identifier string) { + c.identifier = identifier +} + +func (c *ClientConfig) setServerInfo(serverInfo string) { + c.ServerVersion = serverInfo +} + +// Get parsed grpc dial options, should be called after parse was called. +func (c *ClientConfig) getDialOption() []grpc.DialOption { + options := c.DialOptions + if c.DialOptions == nil { + // Add default connection options. + options = make([]grpc.DialOption, len(DefaultGrpcOpts)) + copy(options, DefaultGrpcOpts) + } + + // Construct dial option. + if c.EnableTLSAuth { + options = append(options, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{}))) + } else { + options = append(options, grpc.WithTransportCredentials(insecure.NewCredentials())) + } + + options = append(options, + grpc.WithChainUnaryInterceptor(grpc_retry.UnaryClientInterceptor( + grpc_retry.WithMax(6), + grpc_retry.WithBackoff(func(attempt uint) time.Duration { + return 60 * time.Millisecond * time.Duration(math.Pow(3, float64(attempt))) + }), + grpc_retry.WithCodes(codes.Unavailable, codes.ResourceExhausted)), + // c.getRetryOnRateLimitInterceptor(), + )) + + // options = append(options, grpc.WithChainUnaryInterceptor( + // createMetaDataUnaryInterceptor(c), + // )) + return options +} + +// func (c *ClientConfig) getRetryOnRateLimitInterceptor() grpc.UnaryClientInterceptor { +// if c.RetryRateLimit == nil { +// c.RetryRateLimit = c.defaultRetryRateLimitOption() +// } + +// return RetryOnRateLimitInterceptor(c.RetryRateLimit.MaxRetry, c.RetryRateLimit.MaxBackoff, func(ctx context.Context, attempt uint) time.Duration { +// return 10 * time.Millisecond * time.Duration(math.Pow(3, float64(attempt))) +// }) +// } + +// func (c *ClientConfig) defaultRetryRateLimitOption() *RetryRateLimitOption { +// return &RetryRateLimitOption{ +// MaxRetry: 75, +// MaxBackoff: 3 * time.Second, +// } +// } + +// addFlags set internal flags +func (c *ClientConfig) addFlags(flags uint64) { + c.flags |= flags +} + +// hasFlags check flags is set +func (c *ClientConfig) hasFlags(flags uint64) bool { + return (c.flags & flags) > 0 +} + +func (c *ClientConfig) resetFlags(flags uint64) { + c.flags &= ^flags +} diff --git a/client/client_suite_test.go b/client/client_suite_test.go new file mode 100644 index 0000000000000..3c1324c14fe1e --- /dev/null +++ b/client/client_suite_test.go @@ -0,0 +1,251 @@ +package client + +import ( + "context" + "math/rand" + "net" + "strings" + + mock "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/suite" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/test/bufconn" + + "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/client/v2/entity" +) + +const ( + bufSize = 1024 * 1024 +) + +type MockSuiteBase struct { + suite.Suite + + lis *bufconn.Listener + svr *grpc.Server + mock *MilvusServiceServer + + client *Client +} + +func (s *MockSuiteBase) SetupSuite() { + s.lis = bufconn.Listen(bufSize) + s.svr = grpc.NewServer() + + s.mock = &MilvusServiceServer{} + + milvuspb.RegisterMilvusServiceServer(s.svr, s.mock) + + go func() { + s.T().Log("start mock server") + if err := s.svr.Serve(s.lis); err != nil { + s.Fail("failed to start mock server", err.Error()) + } + }() + s.setupConnect() +} + +func (s *MockSuiteBase) TearDownSuite() { + s.svr.Stop() + s.lis.Close() +} + +func (s *MockSuiteBase) mockDialer(context.Context, string) (net.Conn, error) { + return s.lis.Dial() +} + +func (s *MockSuiteBase) SetupTest() { + c, err := New(context.Background(), &ClientConfig{ + Address: "bufnet", + DialOptions: []grpc.DialOption{ + grpc.WithBlock(), + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithContextDialer(s.mockDialer), + }, + }) + s.Require().NoError(err) + s.setupConnect() + + s.client = c +} + +func (s *MockSuiteBase) TearDownTest() { + s.client.Close(context.Background()) + s.client = nil +} + +func (s *MockSuiteBase) resetMock() { + // MetaCache.reset() + if s.mock != nil { + s.mock.Calls = nil + s.mock.ExpectedCalls = nil + s.setupConnect() + } +} + +func (s *MockSuiteBase) setupConnect() { + s.mock.EXPECT().Connect(mock.Anything, mock.AnythingOfType("*milvuspb.ConnectRequest")). + Return(&milvuspb.ConnectResponse{ + Status: &commonpb.Status{}, + Identifier: 1, + }, nil).Maybe() +} + +func (s *MockSuiteBase) setupCache(collName string, schema *entity.Schema) { + s.client.collCache.collections.Insert(collName, &entity.Collection{ + Name: collName, + Schema: schema, + }) +} + +func (s *MockSuiteBase) setupHasCollection(collNames ...string) { + s.mock.EXPECT().HasCollection(mock.Anything, mock.AnythingOfType("*milvuspb.HasCollectionRequest")). + Call.Return(func(ctx context.Context, req *milvuspb.HasCollectionRequest) *milvuspb.BoolResponse { + resp := &milvuspb.BoolResponse{Status: &commonpb.Status{}} + for _, collName := range collNames { + if req.GetCollectionName() == collName { + resp.Value = true + break + } + } + return resp + }, nil) +} + +func (s *MockSuiteBase) setupHasCollectionError(errorCode commonpb.ErrorCode, err error) { + s.mock.EXPECT().HasCollection(mock.Anything, mock.AnythingOfType("*milvuspb.HasCollectionRequest")). + Return(&milvuspb.BoolResponse{ + Status: &commonpb.Status{ErrorCode: errorCode}, + }, err) +} + +func (s *MockSuiteBase) setupHasPartition(collName string, partNames ...string) { + s.mock.EXPECT().HasPartition(mock.Anything, mock.AnythingOfType("*milvuspb.HasPartitionRequest")). + Call.Return(func(ctx context.Context, req *milvuspb.HasPartitionRequest) *milvuspb.BoolResponse { + resp := &milvuspb.BoolResponse{Status: &commonpb.Status{}} + if req.GetCollectionName() == collName { + for _, partName := range partNames { + if req.GetPartitionName() == partName { + resp.Value = true + break + } + } + } + return resp + }, nil) +} + +func (s *MockSuiteBase) setupHasPartitionError(errorCode commonpb.ErrorCode, err error) { + s.mock.EXPECT().HasPartition(mock.Anything, mock.AnythingOfType("*milvuspb.HasPartitionRequest")). + Return(&milvuspb.BoolResponse{ + Status: &commonpb.Status{ErrorCode: errorCode}, + }, err) +} + +func (s *MockSuiteBase) setupDescribeCollection(_ string, schema *entity.Schema) { + s.mock.EXPECT().DescribeCollection(mock.Anything, mock.AnythingOfType("*milvuspb.DescribeCollectionRequest")). + Call.Return(func(ctx context.Context, req *milvuspb.DescribeCollectionRequest) *milvuspb.DescribeCollectionResponse { + return &milvuspb.DescribeCollectionResponse{ + Status: &commonpb.Status{ErrorCode: commonpb.ErrorCode_Success}, + Schema: schema.ProtoMessage(), + } + }, nil) +} + +func (s *MockSuiteBase) setupDescribeCollectionError(errorCode commonpb.ErrorCode, err error) { + s.mock.EXPECT().DescribeCollection(mock.Anything, mock.AnythingOfType("*milvuspb.DescribeCollectionRequest")). + Return(&milvuspb.DescribeCollectionResponse{ + Status: &commonpb.Status{ErrorCode: errorCode}, + }, err) +} + +func (s *MockSuiteBase) getInt64FieldData(name string, data []int64) *schemapb.FieldData { + return &schemapb.FieldData{ + Type: schemapb.DataType_Int64, + FieldName: name, + Field: &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_LongData{ + LongData: &schemapb.LongArray{ + Data: data, + }, + }, + }, + }, + } +} + +func (s *MockSuiteBase) getVarcharFieldData(name string, data []string) *schemapb.FieldData { + return &schemapb.FieldData{ + Type: schemapb.DataType_VarChar, + FieldName: name, + Field: &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_StringData{ + StringData: &schemapb.StringArray{ + Data: data, + }, + }, + }, + }, + } +} + +func (s *MockSuiteBase) getJSONBytesFieldData(name string, data [][]byte, isDynamic bool) *schemapb.FieldData { + return &schemapb.FieldData{ + Type: schemapb.DataType_JSON, + FieldName: name, + Field: &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_JsonData{ + JsonData: &schemapb.JSONArray{ + Data: data, + }, + }, + }, + }, + IsDynamic: isDynamic, + } +} + +func (s *MockSuiteBase) getFloatVectorFieldData(name string, dim int64, data []float32) *schemapb.FieldData { + return &schemapb.FieldData{ + Type: schemapb.DataType_FloatVector, + FieldName: name, + Field: &schemapb.FieldData_Vectors{ + Vectors: &schemapb.VectorField{ + Dim: dim, + Data: &schemapb.VectorField_FloatVector{ + FloatVector: &schemapb.FloatArray{ + Data: data, + }, + }, + }, + }, + } +} + +func (s *MockSuiteBase) getSuccessStatus() *commonpb.Status { + return s.getStatus(commonpb.ErrorCode_Success, "") +} + +func (s *MockSuiteBase) getStatus(code commonpb.ErrorCode, reason string) *commonpb.Status { + return &commonpb.Status{ + ErrorCode: code, + Reason: reason, + } +} + +var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + +func (s *MockSuiteBase) randString(l int) string { + builder := strings.Builder{} + for i := 0; i < l; i++ { + builder.WriteRune(letters[rand.Intn(len(letters))]) + } + return builder.String() +} diff --git a/client/client_test.go b/client/client_test.go new file mode 100644 index 0000000000000..f23a9d9941d83 --- /dev/null +++ b/client/client_test.go @@ -0,0 +1,43 @@ +package client + +import ( + "context" + "testing" + + "github.com/stretchr/testify/suite" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" +) + +type ClientSuite struct { + MockSuiteBase +} + +func (s *ClientSuite) TestNewClient() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + s.Run("Use bufconn dailer, testing case", func() { + c, err := New(ctx, + &ClientConfig{ + Address: "bufnet", + DialOptions: []grpc.DialOption{ + grpc.WithBlock(), + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithContextDialer(s.mockDialer), + }, + }) + s.NoError(err) + s.NotNil(c) + }) + + s.Run("emtpy_addr", func() { + _, err := New(ctx, &ClientConfig{}) + s.Error(err) + s.T().Log(err) + }) +} + +func TestClient(t *testing.T) { + suite.Run(t, new(ClientSuite)) +} diff --git a/client/collection.go b/client/collection.go new file mode 100644 index 0000000000000..7d05f5525e759 --- /dev/null +++ b/client/collection.go @@ -0,0 +1,134 @@ +// 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 client + +import ( + "context" + + "github.com/cockroachdb/errors" + "google.golang.org/grpc" + + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus/client/v2/entity" + "github.com/milvus-io/milvus/pkg/util/merr" +) + +// CreateCollection is the API for create a collection in Milvus. +func (c *Client) CreateCollection(ctx context.Context, option CreateCollectionOption, callOptions ...grpc.CallOption) error { + req := option.Request() + + err := c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.CreateCollection(ctx, req, callOptions...) + return merr.CheckRPCCall(resp, err) + }) + if err != nil { + return err + } + + indexes := option.Indexes() + for _, indexOption := range indexes { + task, err := c.CreateIndex(ctx, indexOption, callOptions...) + if err != nil { + return err + } + err = task.Await(ctx) + if err != nil { + return nil + } + } + + if option.IsFast() { + task, err := c.LoadCollection(ctx, NewLoadCollectionOption(req.GetCollectionName())) + if err != nil { + return err + } + return task.Await(ctx) + } + + return nil +} + +type ListCollectionOption interface { + Request() *milvuspb.ShowCollectionsRequest +} + +func (c *Client) ListCollections(ctx context.Context, option ListCollectionOption, callOptions ...grpc.CallOption) (collectionNames []string, err error) { + req := option.Request() + err = c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.ShowCollections(ctx, req, callOptions...) + err = merr.CheckRPCCall(resp, err) + if err != nil { + return err + } + + collectionNames = resp.GetCollectionNames() + return nil + }) + + return collectionNames, err +} + +func (c *Client) DescribeCollection(ctx context.Context, option *describeCollectionOption, callOptions ...grpc.CallOption) (collection *entity.Collection, err error) { + req := option.Request() + err = c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.DescribeCollection(ctx, req, callOptions...) + err = merr.CheckRPCCall(resp, err) + if err != nil { + return err + } + + collection = &entity.Collection{ + ID: resp.GetCollectionID(), + Schema: entity.NewSchema().ReadProto(resp.GetSchema()), + PhysicalChannels: resp.GetPhysicalChannelNames(), + VirtualChannels: resp.GetVirtualChannelNames(), + ConsistencyLevel: entity.ConsistencyLevel(resp.ConsistencyLevel), + ShardNum: resp.GetShardsNum(), + } + collection.Name = collection.Schema.CollectionName + return nil + }) + + return collection, err +} + +func (c *Client) HasCollection(ctx context.Context, option HasCollectionOption, callOptions ...grpc.CallOption) (has bool, err error) { + req := option.Request() + err = c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.DescribeCollection(ctx, req, callOptions...) + err = merr.CheckRPCCall(resp, err) + if err != nil { + // ErrCollectionNotFound for collection not exist + if errors.Is(err, merr.ErrCollectionNotFound) { + return nil + } + return err + } + has = true + return nil + }) + return has, err +} + +func (c *Client) DropCollection(ctx context.Context, option DropCollectionOption, callOptions ...grpc.CallOption) error { + req := option.Request() + err := c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.DropCollection(ctx, req, callOptions...) + return merr.CheckRPCCall(resp, err) + }) + return err +} diff --git a/client/collection_options.go b/client/collection_options.go new file mode 100644 index 0000000000000..988dc8132cd82 --- /dev/null +++ b/client/collection_options.go @@ -0,0 +1,232 @@ +// 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 client + +import ( + "github.com/golang/protobuf/proto" + "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus/client/v2/entity" + "github.com/milvus-io/milvus/client/v2/index" +) + +// CreateCollectionOption is the interface builds CreateCollectionRequest. +type CreateCollectionOption interface { + // Request is the method returns the composed request. + Request() *milvuspb.CreateCollectionRequest + // Indexes is the method returns IndexOption to create + Indexes() []CreateIndexOption + IsFast() bool +} + +// createCollectionOption contains all the parameters to create collection. +type createCollectionOption struct { + name string + shardNum int32 + + // fast create collection params + varcharPK bool + varcharPKMaxLength int + pkFieldName string + vectorFieldName string + dim int64 + autoID bool + enabledDynamicSchema bool + + // advanced create collection params + schema *entity.Schema + consistencyLevel entity.ConsistencyLevel + properties map[string]string + + // partition key + numPartitions int64 + + // is fast create collection + isFast bool + // fast creation with index + metricType entity.MetricType +} + +func (opt *createCollectionOption) WithAutoID(autoID bool) *createCollectionOption { + opt.autoID = autoID + return opt +} + +func (opt *createCollectionOption) WithShardNum(shardNum int32) *createCollectionOption { + opt.shardNum = shardNum + return opt +} + +func (opt *createCollectionOption) WithDynamicSchema(dynamicSchema bool) *createCollectionOption { + opt.enabledDynamicSchema = dynamicSchema + return opt +} + +func (opt *createCollectionOption) WithVarcharPK(varcharPK bool, maxLen int) *createCollectionOption { + opt.varcharPK = varcharPK + opt.varcharPKMaxLength = maxLen + return opt +} + +func (opt *createCollectionOption) Request() *milvuspb.CreateCollectionRequest { + // fast create collection + if opt.isFast || opt.schema == nil { + var pkField *entity.Field + if opt.varcharPK { + pkField = entity.NewField().WithDataType(entity.FieldTypeVarChar).WithMaxLength(int64(opt.varcharPKMaxLength)) + } else { + pkField = entity.NewField().WithDataType(entity.FieldTypeInt64) + } + pkField = pkField.WithName(opt.pkFieldName).WithIsPrimaryKey(true).WithIsAutoID(opt.autoID) + opt.schema = entity.NewSchema(). + WithName(opt.name). + WithAutoID(opt.autoID). + WithDynamicFieldEnabled(opt.enabledDynamicSchema). + WithField(pkField). + WithField(entity.NewField().WithName(opt.vectorFieldName).WithDataType(entity.FieldTypeFloatVector).WithDim(opt.dim)) + } + + schemaProto := opt.schema.ProtoMessage() + schemaBytes, _ := proto.Marshal(schemaProto) + + return &milvuspb.CreateCollectionRequest{ + DbName: "", // reserved fields, not used for now + CollectionName: opt.name, + Schema: schemaBytes, + ShardsNum: opt.shardNum, + ConsistencyLevel: commonpb.ConsistencyLevel(opt.consistencyLevel), + NumPartitions: opt.numPartitions, + Properties: entity.MapKvPairs(opt.properties), + } +} + +func (opt *createCollectionOption) Indexes() []CreateIndexOption { + // fast create + if opt.isFast { + return []CreateIndexOption{ + NewCreateIndexOption(opt.name, opt.vectorFieldName, index.NewGenericIndex("", map[string]string{})), + } + } + return nil +} + +func (opt *createCollectionOption) IsFast() bool { + return opt.isFast +} + +// SimpleCreateCollectionOptions returns a CreateCollectionOption with default fast collection options. +func SimpleCreateCollectionOptions(name string, dim int64) *createCollectionOption { + return &createCollectionOption{ + name: name, + shardNum: 1, + + pkFieldName: "id", + vectorFieldName: "vector", + autoID: true, + dim: dim, + enabledDynamicSchema: true, + + isFast: true, + metricType: entity.COSINE, + } +} + +// NewCreateCollectionOption returns a CreateCollectionOption with customized collection schema +func NewCreateCollectionOption(name string, collectionSchema *entity.Schema) *createCollectionOption { + return &createCollectionOption{ + name: name, + shardNum: 1, + schema: collectionSchema, + + metricType: entity.COSINE, + } +} + +type listCollectionOption struct{} + +func (opt *listCollectionOption) Request() *milvuspb.ShowCollectionsRequest { + return &milvuspb.ShowCollectionsRequest{} +} + +func NewListCollectionOption() *listCollectionOption { + return &listCollectionOption{} +} + +// DescribeCollectionOption is the interface builds DescribeCollection request. +type DescribeCollectionOption interface { + // Request is the method returns the composed request. + Request() *milvuspb.DescribeCollectionRequest +} + +type describeCollectionOption struct { + name string +} + +func (opt *describeCollectionOption) Request() *milvuspb.DescribeCollectionRequest { + return &milvuspb.DescribeCollectionRequest{ + CollectionName: opt.name, + } +} + +// NewDescribeCollectionOption composes a describeCollectionOption with provided collection name. +func NewDescribeCollectionOption(name string) *describeCollectionOption { + return &describeCollectionOption{ + name: name, + } +} + +// HasCollectionOption is the interface to build DescribeCollectionRequest. +type HasCollectionOption interface { + Request() *milvuspb.DescribeCollectionRequest +} + +type hasCollectionOpt struct { + name string +} + +func (opt *hasCollectionOpt) Request() *milvuspb.DescribeCollectionRequest { + return &milvuspb.DescribeCollectionRequest{ + CollectionName: opt.name, + } +} + +func NewHasCollectionOption(name string) HasCollectionOption { + return &hasCollectionOpt{ + name: name, + } +} + +// The DropCollectionOption interface builds DropCollectionRequest. +type DropCollectionOption interface { + Request() *milvuspb.DropCollectionRequest +} + +type dropCollectionOption struct { + name string +} + +func (opt *dropCollectionOption) Request() *milvuspb.DropCollectionRequest { + return &milvuspb.DropCollectionRequest{ + CollectionName: opt.name, + } +} + +func NewDropCollectionOption(name string) *dropCollectionOption { + return &dropCollectionOption{ + name: name, + } +} diff --git a/client/collection_test.go b/client/collection_test.go new file mode 100644 index 0000000000000..2a55a786b8501 --- /dev/null +++ b/client/collection_test.go @@ -0,0 +1,253 @@ +// 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 client + +import ( + "context" + "fmt" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/samber/lo" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/suite" + + "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/client/v2/entity" + "github.com/milvus-io/milvus/pkg/util/merr" +) + +type CollectionSuite struct { + MockSuiteBase +} + +func (s *CollectionSuite) TestListCollection() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + s.Run("success", func() { + s.mock.EXPECT().ShowCollections(mock.Anything, mock.Anything).Return(&milvuspb.ShowCollectionsResponse{ + CollectionNames: []string{"test1", "test2", "test3"}, + }, nil).Once() + + names, err := s.client.ListCollections(ctx, NewListCollectionOption()) + s.NoError(err) + s.ElementsMatch([]string{"test1", "test2", "test3"}, names) + }) + + s.Run("failure", func() { + s.mock.EXPECT().ShowCollections(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + _, err := s.client.ListCollections(ctx, NewListCollectionOption()) + s.Error(err) + }) +} + +func (s *CollectionSuite) TestCreateCollection() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + s.Run("success", func() { + s.mock.EXPECT().CreateCollection(mock.Anything, mock.Anything).Return(merr.Success(), nil).Once() + s.mock.EXPECT().CreateIndex(mock.Anything, mock.Anything).Return(merr.Success(), nil).Once() + s.mock.EXPECT().LoadCollection(mock.Anything, mock.Anything).Return(merr.Success(), nil).Once() + s.mock.EXPECT().DescribeIndex(mock.Anything, mock.Anything).Return(&milvuspb.DescribeIndexResponse{ + Status: merr.Success(), + IndexDescriptions: []*milvuspb.IndexDescription{ + {FieldName: "vector", State: commonpb.IndexState_Finished}, + }, + }, nil).Once() + s.mock.EXPECT().GetLoadingProgress(mock.Anything, mock.Anything).Return(&milvuspb.GetLoadingProgressResponse{ + Status: merr.Success(), + Progress: 100, + }, nil).Once() + + err := s.client.CreateCollection(ctx, SimpleCreateCollectionOptions("test_collection", 128)) + s.NoError(err) + }) + + s.Run("failure", func() { + s.mock.EXPECT().CreateCollection(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + err := s.client.CreateCollection(ctx, SimpleCreateCollectionOptions("test_collection", 128)) + s.Error(err) + }) +} + +func (s *CollectionSuite) TestCreateCollectionOptions() { + collectionName := fmt.Sprintf("test_collection_%s", s.randString(6)) + opt := SimpleCreateCollectionOptions(collectionName, 128) + req := opt.Request() + s.Equal(collectionName, req.GetCollectionName()) + s.EqualValues(1, req.GetShardsNum()) + + collSchema := &schemapb.CollectionSchema{} + err := proto.Unmarshal(req.GetSchema(), collSchema) + s.Require().NoError(err) + s.True(collSchema.GetEnableDynamicField()) + + collectionName = fmt.Sprintf("test_collection_%s", s.randString(6)) + opt = SimpleCreateCollectionOptions(collectionName, 128).WithVarcharPK(true, 64).WithAutoID(false).WithDynamicSchema(false) + req = opt.Request() + s.Equal(collectionName, req.GetCollectionName()) + s.EqualValues(1, req.GetShardsNum()) + + collSchema = &schemapb.CollectionSchema{} + err = proto.Unmarshal(req.GetSchema(), collSchema) + s.Require().NoError(err) + s.False(collSchema.GetEnableDynamicField()) + + collectionName = fmt.Sprintf("test_collection_%s", s.randString(6)) + schema := entity.NewSchema(). + WithField(entity.NewField().WithName("int64").WithDataType(entity.FieldTypeInt64).WithIsPrimaryKey(true)). + WithField(entity.NewField().WithName("vector").WithDim(128).WithDataType(entity.FieldTypeFloatVector)) + + opt = NewCreateCollectionOption(collectionName, schema).WithShardNum(2) + + req = opt.Request() + s.Equal(collectionName, req.GetCollectionName()) + s.EqualValues(2, req.GetShardsNum()) + + collSchema = &schemapb.CollectionSchema{} + err = proto.Unmarshal(req.GetSchema(), collSchema) + s.Require().NoError(err) +} + +func (s *CollectionSuite) TestDescribeCollection() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + s.Run("success", func() { + s.mock.EXPECT().DescribeCollection(mock.Anything, mock.Anything).Return(&milvuspb.DescribeCollectionResponse{ + Status: merr.Success(), + Schema: &schemapb.CollectionSchema{ + Name: "test_collection", + Fields: []*schemapb.FieldSchema{ + {FieldID: 100, DataType: schemapb.DataType_Int64, AutoID: true, Name: "ID"}, + { + FieldID: 101, DataType: schemapb.DataType_FloatVector, Name: "vector", + TypeParams: []*commonpb.KeyValuePair{ + {Key: "dim", Value: "128"}, + }, + }, + }, + }, + CollectionID: 1000, + CollectionName: "test_collection", + }, nil).Once() + + coll, err := s.client.DescribeCollection(ctx, NewDescribeCollectionOption("test_collection")) + s.NoError(err) + + s.EqualValues(1000, coll.ID) + s.Equal("test_collection", coll.Name) + s.Len(coll.Schema.Fields, 2) + idField, ok := lo.Find(coll.Schema.Fields, func(field *entity.Field) bool { + return field.ID == 100 + }) + s.Require().True(ok) + s.Equal("ID", idField.Name) + s.Equal(entity.FieldTypeInt64, idField.DataType) + s.True(idField.AutoID) + + vectorField, ok := lo.Find(coll.Schema.Fields, func(field *entity.Field) bool { + return field.ID == 101 + }) + s.Require().True(ok) + s.Equal("vector", vectorField.Name) + s.Equal(entity.FieldTypeFloatVector, vectorField.DataType) + }) + + s.Run("failure", func() { + s.mock.EXPECT().DescribeCollection(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + _, err := s.client.DescribeCollection(ctx, NewDescribeCollectionOption("test_collection")) + s.Error(err) + }) +} + +func (s *CollectionSuite) TestHasCollection() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + s.Run("success", func() { + s.mock.EXPECT().DescribeCollection(mock.Anything, mock.Anything).Return(&milvuspb.DescribeCollectionResponse{ + Status: merr.Success(), + Schema: &schemapb.CollectionSchema{ + Name: "test_collection", + Fields: []*schemapb.FieldSchema{ + {FieldID: 100, DataType: schemapb.DataType_Int64, AutoID: true, Name: "ID"}, + { + FieldID: 101, DataType: schemapb.DataType_FloatVector, Name: "vector", + TypeParams: []*commonpb.KeyValuePair{ + {Key: "dim", Value: "128"}, + }, + }, + }, + }, + CollectionID: 1000, + CollectionName: "test_collection", + }, nil).Once() + + has, err := s.client.HasCollection(ctx, NewHasCollectionOption("test_collection")) + s.NoError(err) + + s.True(has) + }) + + s.Run("collection_not_exist", func() { + s.mock.EXPECT().DescribeCollection(mock.Anything, mock.Anything).Return(&milvuspb.DescribeCollectionResponse{ + Status: merr.Status(merr.WrapErrCollectionNotFound("test_collection")), + }, nil).Once() + + has, err := s.client.HasCollection(ctx, NewHasCollectionOption("test_collection")) + s.NoError(err) + + s.False(has) + }) + + s.Run("failure", func() { + s.mock.EXPECT().DescribeCollection(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + _, err := s.client.HasCollection(ctx, NewHasCollectionOption("test_collection")) + s.Error(err) + }) +} + +func (s *CollectionSuite) TestDropCollection() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + s.Run("success", func() { + s.mock.EXPECT().DropCollection(mock.Anything, mock.Anything).Return(merr.Success(), nil).Once() + + err := s.client.DropCollection(ctx, NewDropCollectionOption("test_collection")) + s.NoError(err) + }) + + s.Run("failure", func() { + s.mock.EXPECT().DropCollection(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + err := s.client.DropCollection(ctx, NewDropCollectionOption("test_collection")) + s.Error(err) + }) +} + +func TestCollection(t *testing.T) { + suite.Run(t, new(CollectionSuite)) +} diff --git a/client/column/array.go b/client/column/array.go new file mode 100644 index 0000000000000..1bd4561016abf --- /dev/null +++ b/client/column/array.go @@ -0,0 +1,125 @@ +// 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 column + +import ( + "fmt" + + "github.com/cockroachdb/errors" + + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/client/v2/entity" +) + +// ColumnVarCharArray generated columns type for VarChar +type ColumnVarCharArray struct { + ColumnBase + name string + values [][][]byte +} + +// Name returns column name +func (c *ColumnVarCharArray) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnVarCharArray) Type() entity.FieldType { + return entity.FieldTypeArray +} + +// Len returns column values length +func (c *ColumnVarCharArray) Len() int { + return len(c.values) +} + +// Get returns value at index as interface{}. +func (c *ColumnVarCharArray) Get(idx int) (interface{}, error) { + var r []string // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnVarCharArray) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Array, + FieldName: c.name, + } + + data := make([]*schemapb.ScalarField, 0, c.Len()) + for _, arr := range c.values { + converted := make([]string, 0, c.Len()) + for i := 0; i < len(arr); i++ { + converted = append(converted, string(arr[i])) + } + data = append(data, &schemapb.ScalarField{ + Data: &schemapb.ScalarField_StringData{ + StringData: &schemapb.StringArray{ + Data: converted, + }, + }, + }) + } + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_ArrayData{ + ArrayData: &schemapb.ArrayArray{ + Data: data, + ElementType: schemapb.DataType_VarChar, + }, + }, + }, + } + return fd +} + +// ValueByIdx returns value of the provided index +// error occurs when index out of range +func (c *ColumnVarCharArray) ValueByIdx(idx int) ([][]byte, error) { + var r [][]byte // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnVarCharArray) AppendValue(i interface{}) error { + v, ok := i.([][]byte) + if !ok { + return fmt.Errorf("invalid type, expected []string, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnVarCharArray) Data() [][][]byte { + return c.values +} + +// NewColumnVarChar auto generated constructor +func NewColumnVarCharArray(name string, values [][][]byte) *ColumnVarCharArray { + return &ColumnVarCharArray{ + name: name, + values: values, + } +} diff --git a/client/column/array_gen.go b/client/column/array_gen.go new file mode 100644 index 0000000000000..9081d73fc7bb0 --- /dev/null +++ b/client/column/array_gen.go @@ -0,0 +1,705 @@ +// Code generated by go generate; DO NOT EDIT +// This file is generated by go generate + +package column + +import ( + "fmt" + + "github.com/cockroachdb/errors" + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/client/v2/entity" +) + +// ColumnBoolArray generated columns type for Bool +type ColumnBoolArray struct { + ColumnBase + name string + values [][]bool +} + +// Name returns column name +func (c *ColumnBoolArray) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnBoolArray) Type() entity.FieldType { + return entity.FieldTypeArray +} + +// Len returns column values length +func (c *ColumnBoolArray) Len() int { + return len(c.values) +} + +// Get returns value at index as interface{}. +func (c *ColumnBoolArray) Get(idx int) (interface{}, error) { + var r []bool // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnBoolArray) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Array, + FieldName: c.name, + } + + data := make([]*schemapb.ScalarField, 0, c.Len()) + for _, arr := range c.values { + converted := make([]bool, 0, c.Len()) + for i := 0; i < len(arr); i++ { + converted = append(converted, bool(arr[i])) + } + data = append(data, &schemapb.ScalarField{ + Data: &schemapb.ScalarField_BoolData{ + BoolData: &schemapb.BoolArray{ + Data: converted, + }, + }, + }) + } + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_ArrayData{ + ArrayData: &schemapb.ArrayArray{ + Data: data, + ElementType: schemapb.DataType_Bool, + }, + }, + }, + } + return fd +} + +// ValueByIdx returns value of the provided index +// error occurs when index out of range +func (c *ColumnBoolArray) ValueByIdx(idx int) ([]bool, error) { + var r []bool // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnBoolArray) AppendValue(i interface{}) error { + v, ok := i.([]bool) + if !ok { + return fmt.Errorf("invalid type, expected []bool, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnBoolArray) Data() [][]bool { + return c.values +} + +// NewColumnBool auto generated constructor +func NewColumnBoolArray(name string, values [][]bool) *ColumnBoolArray { + return &ColumnBoolArray{ + name: name, + values: values, + } +} + +// ColumnInt8Array generated columns type for Int8 +type ColumnInt8Array struct { + ColumnBase + name string + values [][]int8 +} + +// Name returns column name +func (c *ColumnInt8Array) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnInt8Array) Type() entity.FieldType { + return entity.FieldTypeArray +} + +// Len returns column values length +func (c *ColumnInt8Array) Len() int { + return len(c.values) +} + +// Get returns value at index as interface{}. +func (c *ColumnInt8Array) Get(idx int) (interface{}, error) { + var r []int8 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnInt8Array) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Array, + FieldName: c.name, + } + + data := make([]*schemapb.ScalarField, 0, c.Len()) + for _, arr := range c.values { + converted := make([]int32, 0, c.Len()) + for i := 0; i < len(arr); i++ { + converted = append(converted, int32(arr[i])) + } + data = append(data, &schemapb.ScalarField{ + Data: &schemapb.ScalarField_IntData{ + IntData: &schemapb.IntArray{ + Data: converted, + }, + }, + }) + } + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_ArrayData{ + ArrayData: &schemapb.ArrayArray{ + Data: data, + ElementType: schemapb.DataType_Int8, + }, + }, + }, + } + return fd +} + +// ValueByIdx returns value of the provided index +// error occurs when index out of range +func (c *ColumnInt8Array) ValueByIdx(idx int) ([]int8, error) { + var r []int8 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnInt8Array) AppendValue(i interface{}) error { + v, ok := i.([]int8) + if !ok { + return fmt.Errorf("invalid type, expected []int8, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnInt8Array) Data() [][]int8 { + return c.values +} + +// NewColumnInt8 auto generated constructor +func NewColumnInt8Array(name string, values [][]int8) *ColumnInt8Array { + return &ColumnInt8Array{ + name: name, + values: values, + } +} + +// ColumnInt16Array generated columns type for Int16 +type ColumnInt16Array struct { + ColumnBase + name string + values [][]int16 +} + +// Name returns column name +func (c *ColumnInt16Array) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnInt16Array) Type() entity.FieldType { + return entity.FieldTypeArray +} + +// Len returns column values length +func (c *ColumnInt16Array) Len() int { + return len(c.values) +} + +// Get returns value at index as interface{}. +func (c *ColumnInt16Array) Get(idx int) (interface{}, error) { + var r []int16 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnInt16Array) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Array, + FieldName: c.name, + } + + data := make([]*schemapb.ScalarField, 0, c.Len()) + for _, arr := range c.values { + converted := make([]int32, 0, c.Len()) + for i := 0; i < len(arr); i++ { + converted = append(converted, int32(arr[i])) + } + data = append(data, &schemapb.ScalarField{ + Data: &schemapb.ScalarField_IntData{ + IntData: &schemapb.IntArray{ + Data: converted, + }, + }, + }) + } + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_ArrayData{ + ArrayData: &schemapb.ArrayArray{ + Data: data, + ElementType: schemapb.DataType_Int16, + }, + }, + }, + } + return fd +} + +// ValueByIdx returns value of the provided index +// error occurs when index out of range +func (c *ColumnInt16Array) ValueByIdx(idx int) ([]int16, error) { + var r []int16 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnInt16Array) AppendValue(i interface{}) error { + v, ok := i.([]int16) + if !ok { + return fmt.Errorf("invalid type, expected []int16, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnInt16Array) Data() [][]int16 { + return c.values +} + +// NewColumnInt16 auto generated constructor +func NewColumnInt16Array(name string, values [][]int16) *ColumnInt16Array { + return &ColumnInt16Array{ + name: name, + values: values, + } +} + +// ColumnInt32Array generated columns type for Int32 +type ColumnInt32Array struct { + ColumnBase + name string + values [][]int32 +} + +// Name returns column name +func (c *ColumnInt32Array) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnInt32Array) Type() entity.FieldType { + return entity.FieldTypeArray +} + +// Len returns column values length +func (c *ColumnInt32Array) Len() int { + return len(c.values) +} + +// Get returns value at index as interface{}. +func (c *ColumnInt32Array) Get(idx int) (interface{}, error) { + var r []int32 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnInt32Array) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Array, + FieldName: c.name, + } + + data := make([]*schemapb.ScalarField, 0, c.Len()) + for _, arr := range c.values { + converted := make([]int32, 0, c.Len()) + for i := 0; i < len(arr); i++ { + converted = append(converted, int32(arr[i])) + } + data = append(data, &schemapb.ScalarField{ + Data: &schemapb.ScalarField_IntData{ + IntData: &schemapb.IntArray{ + Data: converted, + }, + }, + }) + } + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_ArrayData{ + ArrayData: &schemapb.ArrayArray{ + Data: data, + ElementType: schemapb.DataType_Int32, + }, + }, + }, + } + return fd +} + +// ValueByIdx returns value of the provided index +// error occurs when index out of range +func (c *ColumnInt32Array) ValueByIdx(idx int) ([]int32, error) { + var r []int32 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnInt32Array) AppendValue(i interface{}) error { + v, ok := i.([]int32) + if !ok { + return fmt.Errorf("invalid type, expected []int32, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnInt32Array) Data() [][]int32 { + return c.values +} + +// NewColumnInt32 auto generated constructor +func NewColumnInt32Array(name string, values [][]int32) *ColumnInt32Array { + return &ColumnInt32Array{ + name: name, + values: values, + } +} + +// ColumnInt64Array generated columns type for Int64 +type ColumnInt64Array struct { + ColumnBase + name string + values [][]int64 +} + +// Name returns column name +func (c *ColumnInt64Array) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnInt64Array) Type() entity.FieldType { + return entity.FieldTypeArray +} + +// Len returns column values length +func (c *ColumnInt64Array) Len() int { + return len(c.values) +} + +// Get returns value at index as interface{}. +func (c *ColumnInt64Array) Get(idx int) (interface{}, error) { + var r []int64 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnInt64Array) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Array, + FieldName: c.name, + } + + data := make([]*schemapb.ScalarField, 0, c.Len()) + for _, arr := range c.values { + converted := make([]int64, 0, c.Len()) + for i := 0; i < len(arr); i++ { + converted = append(converted, int64(arr[i])) + } + data = append(data, &schemapb.ScalarField{ + Data: &schemapb.ScalarField_LongData{ + LongData: &schemapb.LongArray{ + Data: converted, + }, + }, + }) + } + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_ArrayData{ + ArrayData: &schemapb.ArrayArray{ + Data: data, + ElementType: schemapb.DataType_Int64, + }, + }, + }, + } + return fd +} + +// ValueByIdx returns value of the provided index +// error occurs when index out of range +func (c *ColumnInt64Array) ValueByIdx(idx int) ([]int64, error) { + var r []int64 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnInt64Array) AppendValue(i interface{}) error { + v, ok := i.([]int64) + if !ok { + return fmt.Errorf("invalid type, expected []int64, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnInt64Array) Data() [][]int64 { + return c.values +} + +// NewColumnInt64 auto generated constructor +func NewColumnInt64Array(name string, values [][]int64) *ColumnInt64Array { + return &ColumnInt64Array{ + name: name, + values: values, + } +} + +// ColumnFloatArray generated columns type for Float +type ColumnFloatArray struct { + ColumnBase + name string + values [][]float32 +} + +// Name returns column name +func (c *ColumnFloatArray) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnFloatArray) Type() entity.FieldType { + return entity.FieldTypeArray +} + +// Len returns column values length +func (c *ColumnFloatArray) Len() int { + return len(c.values) +} + +// Get returns value at index as interface{}. +func (c *ColumnFloatArray) Get(idx int) (interface{}, error) { + var r []float32 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnFloatArray) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Array, + FieldName: c.name, + } + + data := make([]*schemapb.ScalarField, 0, c.Len()) + for _, arr := range c.values { + converted := make([]float32, 0, c.Len()) + for i := 0; i < len(arr); i++ { + converted = append(converted, float32(arr[i])) + } + data = append(data, &schemapb.ScalarField{ + Data: &schemapb.ScalarField_FloatData{ + FloatData: &schemapb.FloatArray{ + Data: converted, + }, + }, + }) + } + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_ArrayData{ + ArrayData: &schemapb.ArrayArray{ + Data: data, + ElementType: schemapb.DataType_Float, + }, + }, + }, + } + return fd +} + +// ValueByIdx returns value of the provided index +// error occurs when index out of range +func (c *ColumnFloatArray) ValueByIdx(idx int) ([]float32, error) { + var r []float32 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnFloatArray) AppendValue(i interface{}) error { + v, ok := i.([]float32) + if !ok { + return fmt.Errorf("invalid type, expected []float32, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnFloatArray) Data() [][]float32 { + return c.values +} + +// NewColumnFloat auto generated constructor +func NewColumnFloatArray(name string, values [][]float32) *ColumnFloatArray { + return &ColumnFloatArray{ + name: name, + values: values, + } +} + +// ColumnDoubleArray generated columns type for Double +type ColumnDoubleArray struct { + ColumnBase + name string + values [][]float64 +} + +// Name returns column name +func (c *ColumnDoubleArray) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnDoubleArray) Type() entity.FieldType { + return entity.FieldTypeArray +} + +// Len returns column values length +func (c *ColumnDoubleArray) Len() int { + return len(c.values) +} + +// Get returns value at index as interface{}. +func (c *ColumnDoubleArray) Get(idx int) (interface{}, error) { + var r []float64 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnDoubleArray) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Array, + FieldName: c.name, + } + + data := make([]*schemapb.ScalarField, 0, c.Len()) + for _, arr := range c.values { + converted := make([]float64, 0, c.Len()) + for i := 0; i < len(arr); i++ { + converted = append(converted, float64(arr[i])) + } + data = append(data, &schemapb.ScalarField{ + Data: &schemapb.ScalarField_DoubleData{ + DoubleData: &schemapb.DoubleArray{ + Data: converted, + }, + }, + }) + } + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_ArrayData{ + ArrayData: &schemapb.ArrayArray{ + Data: data, + ElementType: schemapb.DataType_Double, + }, + }, + }, + } + return fd +} + +// ValueByIdx returns value of the provided index +// error occurs when index out of range +func (c *ColumnDoubleArray) ValueByIdx(idx int) ([]float64, error) { + var r []float64 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnDoubleArray) AppendValue(i interface{}) error { + v, ok := i.([]float64) + if !ok { + return fmt.Errorf("invalid type, expected []float64, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnDoubleArray) Data() [][]float64 { + return c.values +} + +// NewColumnDouble auto generated constructor +func NewColumnDoubleArray(name string, values [][]float64) *ColumnDoubleArray { + return &ColumnDoubleArray{ + name: name, + values: values, + } +} diff --git a/client/column/columns.go b/client/column/columns.go new file mode 100644 index 0000000000000..79166634bc634 --- /dev/null +++ b/client/column/columns.go @@ -0,0 +1,502 @@ +// 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 column + +import ( + "fmt" + + "github.com/cockroachdb/errors" + + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/client/v2/entity" +) + +//go:generate go run gen/gen.go + +// Column interface field type for column-based data frame +type Column interface { + Name() string + Type() entity.FieldType + Len() int + FieldData() *schemapb.FieldData + AppendValue(interface{}) error + Get(int) (interface{}, error) + GetAsInt64(int) (int64, error) + GetAsString(int) (string, error) + GetAsDouble(int) (float64, error) + GetAsBool(int) (bool, error) +} + +// ColumnBase adds conversion methods support for fixed-type columns. +type ColumnBase struct{} + +func (b ColumnBase) GetAsInt64(_ int) (int64, error) { + return 0, errors.New("conversion between fixed-type column not support") +} + +func (b ColumnBase) GetAsString(_ int) (string, error) { + return "", errors.New("conversion between fixed-type column not support") +} + +func (b ColumnBase) GetAsDouble(_ int) (float64, error) { + return 0, errors.New("conversion between fixed-type column not support") +} + +func (b ColumnBase) GetAsBool(_ int) (bool, error) { + return false, errors.New("conversion between fixed-type column not support") +} + +var errFieldDataTypeNotMatch = errors.New("FieldData type not matched") + +// IDColumns converts schemapb.IDs to corresponding column +// currently Int64 / string may be in IDs +func IDColumns(idField *schemapb.IDs, begin, end int) (Column, error) { + var idColumn Column + if idField == nil { + return nil, errors.New("nil Ids from response") + } + switch field := idField.GetIdField().(type) { + case *schemapb.IDs_IntId: + if end >= 0 { + idColumn = NewColumnInt64("", field.IntId.GetData()[begin:end]) + } else { + idColumn = NewColumnInt64("", field.IntId.GetData()[begin:]) + } + case *schemapb.IDs_StrId: + if end >= 0 { + idColumn = NewColumnVarChar("", field.StrId.GetData()[begin:end]) + } else { + idColumn = NewColumnVarChar("", field.StrId.GetData()[begin:]) + } + default: + return nil, fmt.Errorf("unsupported id type %v", field) + } + return idColumn, nil +} + +// FieldDataColumn converts schemapb.FieldData to Column, used int search result conversion logic +// begin, end specifies the start and end positions +func FieldDataColumn(fd *schemapb.FieldData, begin, end int) (Column, error) { + switch fd.GetType() { + case schemapb.DataType_Bool: + data, ok := fd.GetScalars().GetData().(*schemapb.ScalarField_BoolData) + if !ok { + return nil, errFieldDataTypeNotMatch + } + if end < 0 { + return NewColumnBool(fd.GetFieldName(), data.BoolData.GetData()[begin:]), nil + } + return NewColumnBool(fd.GetFieldName(), data.BoolData.GetData()[begin:end]), nil + + case schemapb.DataType_Int8: + data, ok := getIntData(fd) + if !ok { + return nil, errFieldDataTypeNotMatch + } + values := make([]int8, 0, len(data.IntData.GetData())) + for _, v := range data.IntData.GetData() { + values = append(values, int8(v)) + } + + if end < 0 { + return NewColumnInt8(fd.GetFieldName(), values[begin:]), nil + } + + return NewColumnInt8(fd.GetFieldName(), values[begin:end]), nil + + case schemapb.DataType_Int16: + data, ok := getIntData(fd) + if !ok { + return nil, errFieldDataTypeNotMatch + } + values := make([]int16, 0, len(data.IntData.GetData())) + for _, v := range data.IntData.GetData() { + values = append(values, int16(v)) + } + if end < 0 { + return NewColumnInt16(fd.GetFieldName(), values[begin:]), nil + } + + return NewColumnInt16(fd.GetFieldName(), values[begin:end]), nil + + case schemapb.DataType_Int32: + data, ok := getIntData(fd) + if !ok { + return nil, errFieldDataTypeNotMatch + } + if end < 0 { + return NewColumnInt32(fd.GetFieldName(), data.IntData.GetData()[begin:]), nil + } + return NewColumnInt32(fd.GetFieldName(), data.IntData.GetData()[begin:end]), nil + + case schemapb.DataType_Int64: + data, ok := fd.GetScalars().GetData().(*schemapb.ScalarField_LongData) + if !ok { + return nil, errFieldDataTypeNotMatch + } + if end < 0 { + return NewColumnInt64(fd.GetFieldName(), data.LongData.GetData()[begin:]), nil + } + return NewColumnInt64(fd.GetFieldName(), data.LongData.GetData()[begin:end]), nil + + case schemapb.DataType_Float: + data, ok := fd.GetScalars().GetData().(*schemapb.ScalarField_FloatData) + if !ok { + return nil, errFieldDataTypeNotMatch + } + if end < 0 { + return NewColumnFloat(fd.GetFieldName(), data.FloatData.GetData()[begin:]), nil + } + return NewColumnFloat(fd.GetFieldName(), data.FloatData.GetData()[begin:end]), nil + + case schemapb.DataType_Double: + data, ok := fd.GetScalars().GetData().(*schemapb.ScalarField_DoubleData) + if !ok { + return nil, errFieldDataTypeNotMatch + } + if end < 0 { + return NewColumnDouble(fd.GetFieldName(), data.DoubleData.GetData()[begin:]), nil + } + return NewColumnDouble(fd.GetFieldName(), data.DoubleData.GetData()[begin:end]), nil + + case schemapb.DataType_String: + data, ok := fd.GetScalars().GetData().(*schemapb.ScalarField_StringData) + if !ok { + return nil, errFieldDataTypeNotMatch + } + if end < 0 { + return NewColumnString(fd.GetFieldName(), data.StringData.GetData()[begin:]), nil + } + return NewColumnString(fd.GetFieldName(), data.StringData.GetData()[begin:end]), nil + + case schemapb.DataType_VarChar: + data, ok := fd.GetScalars().GetData().(*schemapb.ScalarField_StringData) + if !ok { + return nil, errFieldDataTypeNotMatch + } + if end < 0 { + return NewColumnVarChar(fd.GetFieldName(), data.StringData.GetData()[begin:]), nil + } + return NewColumnVarChar(fd.GetFieldName(), data.StringData.GetData()[begin:end]), nil + + case schemapb.DataType_Array: + data := fd.GetScalars().GetArrayData() + if data == nil { + return nil, errFieldDataTypeNotMatch + } + var arrayData []*schemapb.ScalarField + if end < 0 { + arrayData = data.GetData()[begin:] + } else { + arrayData = data.GetData()[begin:end] + } + + return parseArrayData(fd.GetFieldName(), data.GetElementType(), arrayData) + + case schemapb.DataType_JSON: + data, ok := fd.GetScalars().GetData().(*schemapb.ScalarField_JsonData) + isDynamic := fd.GetIsDynamic() + if !ok { + return nil, errFieldDataTypeNotMatch + } + if end < 0 { + return NewColumnJSONBytes(fd.GetFieldName(), data.JsonData.GetData()[begin:]).WithIsDynamic(isDynamic), nil + } + return NewColumnJSONBytes(fd.GetFieldName(), data.JsonData.GetData()[begin:end]).WithIsDynamic(isDynamic), nil + + case schemapb.DataType_FloatVector: + vectors := fd.GetVectors() + x, ok := vectors.GetData().(*schemapb.VectorField_FloatVector) + if !ok { + return nil, errFieldDataTypeNotMatch + } + data := x.FloatVector.GetData() + dim := int(vectors.GetDim()) + if end < 0 { + end = int(len(data) / dim) + } + vector := make([][]float32, 0, end-begin) // shall not have remanunt + for i := begin; i < end; i++ { + v := make([]float32, dim) + copy(v, data[i*dim:(i+1)*dim]) + vector = append(vector, v) + } + return NewColumnFloatVector(fd.GetFieldName(), dim, vector), nil + + case schemapb.DataType_BinaryVector: + vectors := fd.GetVectors() + x, ok := vectors.GetData().(*schemapb.VectorField_BinaryVector) + if !ok { + return nil, errFieldDataTypeNotMatch + } + data := x.BinaryVector + if data == nil { + return nil, errFieldDataTypeNotMatch + } + dim := int(vectors.GetDim()) + blen := dim / 8 + if end < 0 { + end = int(len(data) / blen) + } + vector := make([][]byte, 0, end-begin) + for i := begin; i < end; i++ { + v := make([]byte, blen) + copy(v, data[i*blen:(i+1)*blen]) + vector = append(vector, v) + } + return NewColumnBinaryVector(fd.GetFieldName(), dim, vector), nil + + case schemapb.DataType_Float16Vector: + vectors := fd.GetVectors() + x, ok := vectors.GetData().(*schemapb.VectorField_Float16Vector) + if !ok { + return nil, errFieldDataTypeNotMatch + } + data := x.Float16Vector + dim := int(vectors.GetDim()) + if end < 0 { + end = int(len(data) / dim) + } + vector := make([][]byte, 0, end-begin) + for i := begin; i < end; i++ { + v := make([]byte, dim) + copy(v, data[i*dim:(i+1)*dim]) + vector = append(vector, v) + } + return NewColumnFloat16Vector(fd.GetFieldName(), dim, vector), nil + + case schemapb.DataType_BFloat16Vector: + vectors := fd.GetVectors() + x, ok := vectors.GetData().(*schemapb.VectorField_Bfloat16Vector) + if !ok { + return nil, errFieldDataTypeNotMatch + } + data := x.Bfloat16Vector + dim := int(vectors.GetDim()) + if end < 0 { + end = int(len(data) / dim) + } + vector := make([][]byte, 0, end-begin) // shall not have remanunt + for i := begin; i < end; i++ { + v := make([]byte, dim) + copy(v, data[i*dim:(i+1)*dim]) + vector = append(vector, v) + } + return NewColumnBFloat16Vector(fd.GetFieldName(), dim, vector), nil + default: + return nil, fmt.Errorf("unsupported data type %s", fd.GetType()) + } +} + +func parseArrayData(fieldName string, elementType schemapb.DataType, fieldDataList []*schemapb.ScalarField) (Column, error) { + switch elementType { + case schemapb.DataType_Bool: + var data [][]bool + for _, fd := range fieldDataList { + data = append(data, fd.GetBoolData().GetData()) + } + return NewColumnBoolArray(fieldName, data), nil + + case schemapb.DataType_Int8: + var data [][]int8 + for _, fd := range fieldDataList { + raw := fd.GetIntData().GetData() + row := make([]int8, 0, len(raw)) + for _, item := range raw { + row = append(row, int8(item)) + } + data = append(data, row) + } + return NewColumnInt8Array(fieldName, data), nil + + case schemapb.DataType_Int16: + var data [][]int16 + for _, fd := range fieldDataList { + raw := fd.GetIntData().GetData() + row := make([]int16, 0, len(raw)) + for _, item := range raw { + row = append(row, int16(item)) + } + data = append(data, row) + } + return NewColumnInt16Array(fieldName, data), nil + + case schemapb.DataType_Int32: + var data [][]int32 + for _, fd := range fieldDataList { + data = append(data, fd.GetIntData().GetData()) + } + return NewColumnInt32Array(fieldName, data), nil + + case schemapb.DataType_Int64: + var data [][]int64 + for _, fd := range fieldDataList { + data = append(data, fd.GetLongData().GetData()) + } + return NewColumnInt64Array(fieldName, data), nil + + case schemapb.DataType_Float: + var data [][]float32 + for _, fd := range fieldDataList { + data = append(data, fd.GetFloatData().GetData()) + } + return NewColumnFloatArray(fieldName, data), nil + + case schemapb.DataType_Double: + var data [][]float64 + for _, fd := range fieldDataList { + data = append(data, fd.GetDoubleData().GetData()) + } + return NewColumnDoubleArray(fieldName, data), nil + + case schemapb.DataType_VarChar, schemapb.DataType_String: + var data [][][]byte + for _, fd := range fieldDataList { + strs := fd.GetStringData().GetData() + bytesData := make([][]byte, 0, len(strs)) + for _, str := range strs { + bytesData = append(bytesData, []byte(str)) + } + data = append(data, bytesData) + } + + return NewColumnVarCharArray(fieldName, data), nil + + default: + return nil, fmt.Errorf("unsupported element type %s", elementType) + } +} + +// getIntData get int32 slice from result field data +// also handles LongData bug (see also https://github.com/milvus-io/milvus/issues/23850) +func getIntData(fd *schemapb.FieldData) (*schemapb.ScalarField_IntData, bool) { + switch data := fd.GetScalars().GetData().(type) { + case *schemapb.ScalarField_IntData: + return data, true + case *schemapb.ScalarField_LongData: + // only alway empty LongData for backward compatibility + if len(data.LongData.GetData()) == 0 { + return &schemapb.ScalarField_IntData{ + IntData: &schemapb.IntArray{}, + }, true + } + return nil, false + default: + return nil, false + } +} + +// FieldDataColumn converts schemapb.FieldData to vector Column +func FieldDataVector(fd *schemapb.FieldData) (Column, error) { + switch fd.GetType() { + case schemapb.DataType_FloatVector: + vectors := fd.GetVectors() + x, ok := vectors.GetData().(*schemapb.VectorField_FloatVector) + if !ok { + return nil, errFieldDataTypeNotMatch + } + data := x.FloatVector.GetData() + dim := int(vectors.GetDim()) + vector := make([][]float32, 0, len(data)/dim) // shall not have remanunt + for i := 0; i < len(data)/dim; i++ { + v := make([]float32, dim) + copy(v, data[i*dim:(i+1)*dim]) + vector = append(vector, v) + } + return NewColumnFloatVector(fd.GetFieldName(), dim, vector), nil + case schemapb.DataType_BinaryVector: + vectors := fd.GetVectors() + x, ok := vectors.GetData().(*schemapb.VectorField_BinaryVector) + if !ok { + return nil, errFieldDataTypeNotMatch + } + data := x.BinaryVector + if data == nil { + return nil, errFieldDataTypeNotMatch + } + dim := int(vectors.GetDim()) + blen := dim / 8 + vector := make([][]byte, 0, len(data)/blen) + for i := 0; i < len(data)/blen; i++ { + v := make([]byte, blen) + copy(v, data[i*blen:(i+1)*blen]) + vector = append(vector, v) + } + return NewColumnBinaryVector(fd.GetFieldName(), dim, vector), nil + case schemapb.DataType_Float16Vector: + vectors := fd.GetVectors() + x, ok := vectors.GetData().(*schemapb.VectorField_Float16Vector) + if !ok { + return nil, errFieldDataTypeNotMatch + } + data := x.Float16Vector + dim := int(vectors.GetDim()) + vector := make([][]byte, 0, len(data)/dim) // shall not have remanunt + for i := 0; i < len(data)/dim; i++ { + v := make([]byte, dim) + copy(v, data[i*dim:(i+1)*dim]) + vector = append(vector, v) + } + return NewColumnFloat16Vector(fd.GetFieldName(), dim, vector), nil + case schemapb.DataType_BFloat16Vector: + vectors := fd.GetVectors() + x, ok := vectors.GetData().(*schemapb.VectorField_Bfloat16Vector) + if !ok { + return nil, errFieldDataTypeNotMatch + } + data := x.Bfloat16Vector + dim := int(vectors.GetDim()) + vector := make([][]byte, 0, len(data)/dim) // shall not have remanunt + for i := 0; i < len(data)/dim; i++ { + v := make([]byte, dim) + copy(v, data[i*dim:(i+1)*dim]) + vector = append(vector, v) + } + return NewColumnBFloat16Vector(fd.GetFieldName(), dim, vector), nil + default: + return nil, errors.New("unsupported data type") + } +} + +// defaultValueColumn will return the empty scalars column which will be fill with default value +func DefaultValueColumn(name string, dataType entity.FieldType) (Column, error) { + switch dataType { + case entity.FieldTypeBool: + return NewColumnBool(name, nil), nil + case entity.FieldTypeInt8: + return NewColumnInt8(name, nil), nil + case entity.FieldTypeInt16: + return NewColumnInt16(name, nil), nil + case entity.FieldTypeInt32: + return NewColumnInt32(name, nil), nil + case entity.FieldTypeInt64: + return NewColumnInt64(name, nil), nil + case entity.FieldTypeFloat: + return NewColumnFloat(name, nil), nil + case entity.FieldTypeDouble: + return NewColumnDouble(name, nil), nil + case entity.FieldTypeString: + return NewColumnString(name, nil), nil + case entity.FieldTypeVarChar: + return NewColumnVarChar(name, nil), nil + case entity.FieldTypeJSON: + return NewColumnJSONBytes(name, nil), nil + + default: + return nil, fmt.Errorf("default value unsupported data type %s", dataType) + } +} diff --git a/client/column/columns_test.go b/client/column/columns_test.go new file mode 100644 index 0000000000000..fad92f47d6b66 --- /dev/null +++ b/client/column/columns_test.go @@ -0,0 +1,160 @@ +// 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 column + +import ( + "math/rand" + "strconv" + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" +) + +func TestIDColumns(t *testing.T) { + dataLen := rand.Intn(100) + 1 + base := rand.Intn(5000) // id start point + + t.Run("nil id", func(t *testing.T) { + _, err := IDColumns(nil, 0, -1) + assert.NotNil(t, err) + idField := &schemapb.IDs{} + _, err = IDColumns(idField, 0, -1) + assert.NotNil(t, err) + }) + + t.Run("int ids", func(t *testing.T) { + ids := make([]int64, 0, dataLen) + for i := 0; i < dataLen; i++ { + ids = append(ids, int64(i+base)) + } + idField := &schemapb.IDs{ + IdField: &schemapb.IDs_IntId{ + IntId: &schemapb.LongArray{ + Data: ids, + }, + }, + } + column, err := IDColumns(idField, 0, dataLen) + assert.Nil(t, err) + assert.NotNil(t, column) + assert.Equal(t, dataLen, column.Len()) + + column, err = IDColumns(idField, 0, -1) // test -1 method + assert.Nil(t, err) + assert.NotNil(t, column) + assert.Equal(t, dataLen, column.Len()) + }) + t.Run("string ids", func(t *testing.T) { + ids := make([]string, 0, dataLen) + for i := 0; i < dataLen; i++ { + ids = append(ids, strconv.FormatInt(int64(i+base), 10)) + } + idField := &schemapb.IDs{ + IdField: &schemapb.IDs_StrId{ + StrId: &schemapb.StringArray{ + Data: ids, + }, + }, + } + column, err := IDColumns(idField, 0, dataLen) + assert.Nil(t, err) + assert.NotNil(t, column) + assert.Equal(t, dataLen, column.Len()) + + column, err = IDColumns(idField, 0, -1) // test -1 method + assert.Nil(t, err) + assert.NotNil(t, column) + assert.Equal(t, dataLen, column.Len()) + }) +} + +func TestGetIntData(t *testing.T) { + type testCase struct { + tag string + fd *schemapb.FieldData + expectOK bool + } + + cases := []testCase{ + { + tag: "normal_IntData", + fd: &schemapb.FieldData{ + Field: &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_IntData{ + IntData: &schemapb.IntArray{Data: []int32{1, 2, 3}}, + }, + }, + }, + }, + expectOK: true, + }, + { + tag: "empty_LongData", + fd: &schemapb.FieldData{ + Field: &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_LongData{ + LongData: &schemapb.LongArray{Data: nil}, + }, + }, + }, + }, + expectOK: true, + }, + { + tag: "nonempty_LongData", + fd: &schemapb.FieldData{ + Field: &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_LongData{ + LongData: &schemapb.LongArray{Data: []int64{1, 2, 3}}, + }, + }, + }, + }, + expectOK: false, + }, + { + tag: "other_data", + fd: &schemapb.FieldData{ + Field: &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_BoolData{}, + }, + }, + }, + expectOK: false, + }, + { + tag: "vector_data", + fd: &schemapb.FieldData{ + Field: &schemapb.FieldData_Vectors{}, + }, + expectOK: false, + }, + } + + for _, tc := range cases { + t.Run(tc.tag, func(t *testing.T) { + _, ok := getIntData(tc.fd) + assert.Equal(t, tc.expectOK, ok) + }) + } +} diff --git a/client/column/conversion.go b/client/column/conversion.go new file mode 100644 index 0000000000000..43c61a016de5f --- /dev/null +++ b/client/column/conversion.go @@ -0,0 +1,53 @@ +// 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 column + +func (c *ColumnInt8) GetAsInt64(idx int) (int64, error) { + v, err := c.ValueByIdx(idx) + return int64(v), err +} + +func (c *ColumnInt16) GetAsInt64(idx int) (int64, error) { + v, err := c.ValueByIdx(idx) + return int64(v), err +} + +func (c *ColumnInt32) GetAsInt64(idx int) (int64, error) { + v, err := c.ValueByIdx(idx) + return int64(v), err +} + +func (c *ColumnInt64) GetAsInt64(idx int) (int64, error) { + return c.ValueByIdx(idx) +} + +func (c *ColumnString) GetAsString(idx int) (string, error) { + return c.ValueByIdx(idx) +} + +func (c *ColumnFloat) GetAsDouble(idx int) (float64, error) { + v, err := c.ValueByIdx(idx) + return float64(v), err +} + +func (c *ColumnDouble) GetAsDouble(idx int) (float64, error) { + return c.ValueByIdx(idx) +} + +func (c *ColumnBool) GetAsBool(idx int) (bool, error) { + return c.ValueByIdx(idx) +} diff --git a/client/column/dynamic.go b/client/column/dynamic.go new file mode 100644 index 0000000000000..663bf175e3169 --- /dev/null +++ b/client/column/dynamic.go @@ -0,0 +1,113 @@ +// 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 column + +import ( + "github.com/cockroachdb/errors" + "github.com/tidwall/gjson" +) + +// ColumnDynamic is a logically wrapper for dynamic json field with provided output field. +type ColumnDynamic struct { + *ColumnJSONBytes + outputField string +} + +func NewColumnDynamic(column *ColumnJSONBytes, outputField string) *ColumnDynamic { + return &ColumnDynamic{ + ColumnJSONBytes: column, + outputField: outputField, + } +} + +func (c *ColumnDynamic) Name() string { + return c.outputField +} + +// Get returns element at idx as interface{}. +// Overrides internal json column behavior, returns raw json data. +func (c *ColumnDynamic) Get(idx int) (interface{}, error) { + bs, err := c.ColumnJSONBytes.ValueByIdx(idx) + if err != nil { + return 0, err + } + r := gjson.GetBytes(bs, c.outputField) + if !r.Exists() { + return 0, errors.New("column not has value") + } + return r.Raw, nil +} + +func (c *ColumnDynamic) GetAsInt64(idx int) (int64, error) { + bs, err := c.ColumnJSONBytes.ValueByIdx(idx) + if err != nil { + return 0, err + } + r := gjson.GetBytes(bs, c.outputField) + if !r.Exists() { + return 0, errors.New("column not has value") + } + if r.Type != gjson.Number { + return 0, errors.New("column not int") + } + return r.Int(), nil +} + +func (c *ColumnDynamic) GetAsString(idx int) (string, error) { + bs, err := c.ColumnJSONBytes.ValueByIdx(idx) + if err != nil { + return "", err + } + r := gjson.GetBytes(bs, c.outputField) + if !r.Exists() { + return "", errors.New("column not has value") + } + if r.Type != gjson.String { + return "", errors.New("column not string") + } + return r.String(), nil +} + +func (c *ColumnDynamic) GetAsBool(idx int) (bool, error) { + bs, err := c.ColumnJSONBytes.ValueByIdx(idx) + if err != nil { + return false, err + } + r := gjson.GetBytes(bs, c.outputField) + if !r.Exists() { + return false, errors.New("column not has value") + } + if !r.IsBool() { + return false, errors.New("column not string") + } + return r.Bool(), nil +} + +func (c *ColumnDynamic) GetAsDouble(idx int) (float64, error) { + bs, err := c.ColumnJSONBytes.ValueByIdx(idx) + if err != nil { + return 0, err + } + r := gjson.GetBytes(bs, c.outputField) + if !r.Exists() { + return 0, errors.New("column not has value") + } + if r.Type != gjson.Number { + return 0, errors.New("column not string") + } + return r.Float(), nil +} diff --git a/client/column/dynamic_test.go b/client/column/dynamic_test.go new file mode 100644 index 0000000000000..b65e5868997b0 --- /dev/null +++ b/client/column/dynamic_test.go @@ -0,0 +1,162 @@ +// 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 column + +import ( + "testing" + + "github.com/stretchr/testify/suite" +) + +type ColumnDynamicSuite struct { + suite.Suite +} + +func (s *ColumnDynamicSuite) TestGetInt() { + cases := []struct { + input string + expectErr bool + expectValue int64 + }{ + {`{"field": 1000000000000000001}`, false, 1000000000000000001}, + {`{"field": 4418489049307132905}`, false, 4418489049307132905}, + {`{"other_field": 4418489049307132905}`, true, 0}, + {`{"field": "string"}`, true, 0}, + } + + for _, c := range cases { + s.Run(c.input, func() { + column := NewColumnDynamic(&ColumnJSONBytes{ + values: [][]byte{[]byte(c.input)}, + }, "field") + v, err := column.GetAsInt64(0) + if c.expectErr { + s.Error(err) + return + } + s.NoError(err) + s.Equal(c.expectValue, v) + }) + } +} + +func (s *ColumnDynamicSuite) TestGetString() { + cases := []struct { + input string + expectErr bool + expectValue string + }{ + {`{"field": "abc"}`, false, "abc"}, + {`{"field": "test"}`, false, "test"}, + {`{"other_field": "string"}`, true, ""}, + {`{"field": 123}`, true, ""}, + } + + for _, c := range cases { + s.Run(c.input, func() { + column := NewColumnDynamic(&ColumnJSONBytes{ + values: [][]byte{[]byte(c.input)}, + }, "field") + v, err := column.GetAsString(0) + if c.expectErr { + s.Error(err) + return + } + s.NoError(err) + s.Equal(c.expectValue, v) + }) + } +} + +func (s *ColumnDynamicSuite) TestGetBool() { + cases := []struct { + input string + expectErr bool + expectValue bool + }{ + {`{"field": true}`, false, true}, + {`{"field": false}`, false, false}, + {`{"other_field": true}`, true, false}, + {`{"field": "test"}`, true, false}, + } + + for _, c := range cases { + s.Run(c.input, func() { + column := NewColumnDynamic(&ColumnJSONBytes{ + values: [][]byte{[]byte(c.input)}, + }, "field") + v, err := column.GetAsBool(0) + if c.expectErr { + s.Error(err) + return + } + s.NoError(err) + s.Equal(c.expectValue, v) + }) + } +} + +func (s *ColumnDynamicSuite) TestGetDouble() { + cases := []struct { + input string + expectErr bool + expectValue float64 + }{ + {`{"field": 1}`, false, 1.0}, + {`{"field": 6231.123}`, false, 6231.123}, + {`{"other_field": 1.0}`, true, 0}, + {`{"field": "string"}`, true, 0}, + } + + for _, c := range cases { + s.Run(c.input, func() { + column := NewColumnDynamic(&ColumnJSONBytes{ + values: [][]byte{[]byte(c.input)}, + }, "field") + v, err := column.GetAsDouble(0) + if c.expectErr { + s.Error(err) + return + } + s.NoError(err) + s.Less(v-c.expectValue, 1e-10) + }) + } +} + +func (s *ColumnDynamicSuite) TestIndexOutOfRange() { + var err error + column := NewColumnDynamic(&ColumnJSONBytes{}, "field") + + s.Equal("field", column.Name()) + + _, err = column.GetAsInt64(0) + s.Error(err) + + _, err = column.GetAsString(0) + s.Error(err) + + _, err = column.GetAsBool(0) + s.Error(err) + + _, err = column.GetAsDouble(0) + s.Error(err) +} + +func TestColumnDynamic(t *testing.T) { + suite.Run(t, new(ColumnDynamicSuite)) +} diff --git a/client/column/json.go b/client/column/json.go new file mode 100644 index 0000000000000..7628419472886 --- /dev/null +++ b/client/column/json.go @@ -0,0 +1,146 @@ +// 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 column + +import ( + "encoding/json" + "fmt" + "reflect" + + "github.com/cockroachdb/errors" + + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/client/v2/entity" +) + +var _ (Column) = (*ColumnJSONBytes)(nil) + +// ColumnJSONBytes column type for JSON. +// all items are marshaled json bytes. +type ColumnJSONBytes struct { + ColumnBase + name string + values [][]byte + isDynamic bool +} + +// Name returns column name. +func (c *ColumnJSONBytes) Name() string { + return c.name +} + +// Type returns column entity.FieldType. +func (c *ColumnJSONBytes) Type() entity.FieldType { + return entity.FieldTypeJSON +} + +// Len returns column values length. +func (c *ColumnJSONBytes) Len() int { + return len(c.values) +} + +// Get returns value at index as interface{}. +func (c *ColumnJSONBytes) Get(idx int) (interface{}, error) { + if idx < 0 || idx > c.Len() { + return nil, errors.New("index out of range") + } + return c.values[idx], nil +} + +func (c *ColumnJSONBytes) GetAsString(idx int) (string, error) { + bs, err := c.ValueByIdx(idx) + if err != nil { + return "", err + } + return string(bs), nil +} + +// FieldData return column data mapped to schemapb.FieldData. +func (c *ColumnJSONBytes) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_JSON, + FieldName: c.name, + IsDynamic: c.isDynamic, + } + + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_JsonData{ + JsonData: &schemapb.JSONArray{ + Data: c.values, + }, + }, + }, + } + + return fd +} + +// ValueByIdx returns value of the provided index. +func (c *ColumnJSONBytes) ValueByIdx(idx int) ([]byte, error) { + if idx < 0 || idx >= c.Len() { + return nil, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column. +func (c *ColumnJSONBytes) AppendValue(i interface{}) error { + var v []byte + switch raw := i.(type) { + case []byte: + v = raw + default: + k := reflect.TypeOf(i).Kind() + if k == reflect.Ptr { + k = reflect.TypeOf(i).Elem().Kind() + } + switch k { + case reflect.Struct: + fallthrough + case reflect.Map: + bs, err := json.Marshal(raw) + if err != nil { + return err + } + v = bs + default: + return fmt.Errorf("expect json compatible type([]byte, struct[}, map], got %T)", i) + } + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data. +func (c *ColumnJSONBytes) Data() [][]byte { + return c.values +} + +func (c *ColumnJSONBytes) WithIsDynamic(isDynamic bool) *ColumnJSONBytes { + c.isDynamic = isDynamic + return c +} + +// NewColumnJSONBytes composes a Column with json bytes. +func NewColumnJSONBytes(name string, values [][]byte) *ColumnJSONBytes { + return &ColumnJSONBytes{ + name: name, + values: values, + } +} diff --git a/client/column/json_test.go b/client/column/json_test.go new file mode 100644 index 0000000000000..b627639d0d424 --- /dev/null +++ b/client/column/json_test.go @@ -0,0 +1,101 @@ +// 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 column + +import ( + "fmt" + "math/rand" + "testing" + "time" + + "github.com/stretchr/testify/suite" + + "github.com/milvus-io/milvus/client/v2/entity" +) + +type ColumnJSONBytesSuite struct { + suite.Suite +} + +func (s *ColumnJSONBytesSuite) SetupSuite() { + rand.Seed(time.Now().UnixNano()) +} + +func (s *ColumnJSONBytesSuite) TestAttrMethods() { + columnName := fmt.Sprintf("column_jsonbs_%d", rand.Int()) + columnLen := 8 + rand.Intn(10) + + v := make([][]byte, columnLen) + column := NewColumnJSONBytes(columnName, v).WithIsDynamic(true) + + s.Run("test_meta", func() { + ft := entity.FieldTypeJSON + s.Equal("JSON", ft.Name()) + s.Equal("JSON", ft.String()) + pbName, pbType := ft.PbFieldType() + s.Equal("JSON", pbName) + s.Equal("JSON", pbType) + }) + + s.Run("test_column_attribute", func() { + s.Equal(columnName, column.Name()) + s.Equal(entity.FieldTypeJSON, column.Type()) + s.Equal(columnLen, column.Len()) + s.EqualValues(v, column.Data()) + }) + + s.Run("test_column_field_data", func() { + fd := column.FieldData() + s.NotNil(fd) + s.Equal(fd.GetFieldName(), columnName) + }) + + s.Run("test_column_valuer_by_idx", func() { + _, err := column.ValueByIdx(-1) + s.Error(err) + _, err = column.ValueByIdx(columnLen) + s.Error(err) + for i := 0; i < columnLen; i++ { + v, err := column.ValueByIdx(i) + s.NoError(err) + s.Equal(column.values[i], v) + } + }) + + s.Run("test_append_value", func() { + item := make([]byte, 10) + err := column.AppendValue(item) + s.NoError(err) + s.Equal(columnLen+1, column.Len()) + val, err := column.ValueByIdx(columnLen) + s.NoError(err) + s.Equal(item, val) + + err = column.AppendValue(&struct{ Tag string }{Tag: "abc"}) + s.NoError(err) + + err = column.AppendValue(map[string]interface{}{"Value": 123}) + s.NoError(err) + + err = column.AppendValue(1) + s.Error(err) + }) +} + +func TestColumnJSONBytes(t *testing.T) { + suite.Run(t, new(ColumnJSONBytesSuite)) +} diff --git a/client/column/scalar_gen.go b/client/column/scalar_gen.go new file mode 100644 index 0000000000000..023dadaa7b478 --- /dev/null +++ b/client/column/scalar_gen.go @@ -0,0 +1,708 @@ +// Code generated by go generate; DO NOT EDIT +// This file is generated by go generate + +package column + +import ( + "errors" + "fmt" + + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/client/v2/entity" +) + +// ColumnBool generated columns type for Bool +type ColumnBool struct { + ColumnBase + name string + values []bool +} + +// Name returns column name +func (c *ColumnBool) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnBool) Type() entity.FieldType { + return entity.FieldTypeBool +} + +// Len returns column values length +func (c *ColumnBool) Len() int { + return len(c.values) +} + +// Get returns value at index as interface{}. +func (c *ColumnBool) Get(idx int) (interface{}, error) { + var r bool // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnBool) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Bool, + FieldName: c.name, + } + data := make([]bool, 0, c.Len()) + for i := 0; i < c.Len(); i++ { + data = append(data, bool(c.values[i])) + } + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_BoolData{ + BoolData: &schemapb.BoolArray{ + Data: data, + }, + }, + }, + } + return fd +} + +// ValueByIdx returns value of the provided index +// error occurs when index out of range +func (c *ColumnBool) ValueByIdx(idx int) (bool, error) { + var r bool // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnBool) AppendValue(i interface{}) error { + v, ok := i.(bool) + if !ok { + return fmt.Errorf("invalid type, expected bool, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnBool) Data() []bool { + return c.values +} + +// NewColumnBool auto generated constructor +func NewColumnBool(name string, values []bool) *ColumnBool { + return &ColumnBool{ + name: name, + values: values, + } +} + +// ColumnInt8 generated columns type for Int8 +type ColumnInt8 struct { + ColumnBase + name string + values []int8 +} + +// Name returns column name +func (c *ColumnInt8) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnInt8) Type() entity.FieldType { + return entity.FieldTypeInt8 +} + +// Len returns column values length +func (c *ColumnInt8) Len() int { + return len(c.values) +} + +// Get returns value at index as interface{}. +func (c *ColumnInt8) Get(idx int) (interface{}, error) { + var r int8 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnInt8) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Int8, + FieldName: c.name, + } + data := make([]int32, 0, c.Len()) + for i := 0; i < c.Len(); i++ { + data = append(data, int32(c.values[i])) + } + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_IntData{ + IntData: &schemapb.IntArray{ + Data: data, + }, + }, + }, + } + return fd +} + +// ValueByIdx returns value of the provided index +// error occurs when index out of range +func (c *ColumnInt8) ValueByIdx(idx int) (int8, error) { + var r int8 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnInt8) AppendValue(i interface{}) error { + v, ok := i.(int8) + if !ok { + return fmt.Errorf("invalid type, expected int8, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnInt8) Data() []int8 { + return c.values +} + +// NewColumnInt8 auto generated constructor +func NewColumnInt8(name string, values []int8) *ColumnInt8 { + return &ColumnInt8{ + name: name, + values: values, + } +} + +// ColumnInt16 generated columns type for Int16 +type ColumnInt16 struct { + ColumnBase + name string + values []int16 +} + +// Name returns column name +func (c *ColumnInt16) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnInt16) Type() entity.FieldType { + return entity.FieldTypeInt16 +} + +// Len returns column values length +func (c *ColumnInt16) Len() int { + return len(c.values) +} + +// Get returns value at index as interface{}. +func (c *ColumnInt16) Get(idx int) (interface{}, error) { + var r int16 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnInt16) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Int16, + FieldName: c.name, + } + data := make([]int32, 0, c.Len()) + for i := 0; i < c.Len(); i++ { + data = append(data, int32(c.values[i])) + } + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_IntData{ + IntData: &schemapb.IntArray{ + Data: data, + }, + }, + }, + } + return fd +} + +// ValueByIdx returns value of the provided index +// error occurs when index out of range +func (c *ColumnInt16) ValueByIdx(idx int) (int16, error) { + var r int16 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnInt16) AppendValue(i interface{}) error { + v, ok := i.(int16) + if !ok { + return fmt.Errorf("invalid type, expected int16, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnInt16) Data() []int16 { + return c.values +} + +// NewColumnInt16 auto generated constructor +func NewColumnInt16(name string, values []int16) *ColumnInt16 { + return &ColumnInt16{ + name: name, + values: values, + } +} + +// ColumnInt32 generated columns type for Int32 +type ColumnInt32 struct { + ColumnBase + name string + values []int32 +} + +// Name returns column name +func (c *ColumnInt32) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnInt32) Type() entity.FieldType { + return entity.FieldTypeInt32 +} + +// Len returns column values length +func (c *ColumnInt32) Len() int { + return len(c.values) +} + +// Get returns value at index as interface{}. +func (c *ColumnInt32) Get(idx int) (interface{}, error) { + var r int32 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnInt32) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Int32, + FieldName: c.name, + } + data := make([]int32, 0, c.Len()) + for i := 0; i < c.Len(); i++ { + data = append(data, int32(c.values[i])) + } + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_IntData{ + IntData: &schemapb.IntArray{ + Data: data, + }, + }, + }, + } + return fd +} + +// ValueByIdx returns value of the provided index +// error occurs when index out of range +func (c *ColumnInt32) ValueByIdx(idx int) (int32, error) { + var r int32 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnInt32) AppendValue(i interface{}) error { + v, ok := i.(int32) + if !ok { + return fmt.Errorf("invalid type, expected int32, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnInt32) Data() []int32 { + return c.values +} + +// NewColumnInt32 auto generated constructor +func NewColumnInt32(name string, values []int32) *ColumnInt32 { + return &ColumnInt32{ + name: name, + values: values, + } +} + +// ColumnInt64 generated columns type for Int64 +type ColumnInt64 struct { + ColumnBase + name string + values []int64 +} + +// Name returns column name +func (c *ColumnInt64) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnInt64) Type() entity.FieldType { + return entity.FieldTypeInt64 +} + +// Len returns column values length +func (c *ColumnInt64) Len() int { + return len(c.values) +} + +// Get returns value at index as interface{}. +func (c *ColumnInt64) Get(idx int) (interface{}, error) { + var r int64 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnInt64) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Int64, + FieldName: c.name, + } + data := make([]int64, 0, c.Len()) + for i := 0; i < c.Len(); i++ { + data = append(data, int64(c.values[i])) + } + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_LongData{ + LongData: &schemapb.LongArray{ + Data: data, + }, + }, + }, + } + return fd +} + +// ValueByIdx returns value of the provided index +// error occurs when index out of range +func (c *ColumnInt64) ValueByIdx(idx int) (int64, error) { + var r int64 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnInt64) AppendValue(i interface{}) error { + v, ok := i.(int64) + if !ok { + return fmt.Errorf("invalid type, expected int64, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnInt64) Data() []int64 { + return c.values +} + +// NewColumnInt64 auto generated constructor +func NewColumnInt64(name string, values []int64) *ColumnInt64 { + return &ColumnInt64{ + name: name, + values: values, + } +} + +// ColumnFloat generated columns type for Float +type ColumnFloat struct { + ColumnBase + name string + values []float32 +} + +// Name returns column name +func (c *ColumnFloat) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnFloat) Type() entity.FieldType { + return entity.FieldTypeFloat +} + +// Len returns column values length +func (c *ColumnFloat) Len() int { + return len(c.values) +} + +// Get returns value at index as interface{}. +func (c *ColumnFloat) Get(idx int) (interface{}, error) { + var r float32 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnFloat) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Float, + FieldName: c.name, + } + data := make([]float32, 0, c.Len()) + for i := 0; i < c.Len(); i++ { + data = append(data, float32(c.values[i])) + } + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_FloatData{ + FloatData: &schemapb.FloatArray{ + Data: data, + }, + }, + }, + } + return fd +} + +// ValueByIdx returns value of the provided index +// error occurs when index out of range +func (c *ColumnFloat) ValueByIdx(idx int) (float32, error) { + var r float32 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnFloat) AppendValue(i interface{}) error { + v, ok := i.(float32) + if !ok { + return fmt.Errorf("invalid type, expected float32, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnFloat) Data() []float32 { + return c.values +} + +// NewColumnFloat auto generated constructor +func NewColumnFloat(name string, values []float32) *ColumnFloat { + return &ColumnFloat{ + name: name, + values: values, + } +} + +// ColumnDouble generated columns type for Double +type ColumnDouble struct { + ColumnBase + name string + values []float64 +} + +// Name returns column name +func (c *ColumnDouble) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnDouble) Type() entity.FieldType { + return entity.FieldTypeDouble +} + +// Len returns column values length +func (c *ColumnDouble) Len() int { + return len(c.values) +} + +// Get returns value at index as interface{}. +func (c *ColumnDouble) Get(idx int) (interface{}, error) { + var r float64 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnDouble) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Double, + FieldName: c.name, + } + data := make([]float64, 0, c.Len()) + for i := 0; i < c.Len(); i++ { + data = append(data, float64(c.values[i])) + } + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_DoubleData{ + DoubleData: &schemapb.DoubleArray{ + Data: data, + }, + }, + }, + } + return fd +} + +// ValueByIdx returns value of the provided index +// error occurs when index out of range +func (c *ColumnDouble) ValueByIdx(idx int) (float64, error) { + var r float64 // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnDouble) AppendValue(i interface{}) error { + v, ok := i.(float64) + if !ok { + return fmt.Errorf("invalid type, expected float64, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnDouble) Data() []float64 { + return c.values +} + +// NewColumnDouble auto generated constructor +func NewColumnDouble(name string, values []float64) *ColumnDouble { + return &ColumnDouble{ + name: name, + values: values, + } +} + +// ColumnString generated columns type for String +type ColumnString struct { + ColumnBase + name string + values []string +} + +// Name returns column name +func (c *ColumnString) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnString) Type() entity.FieldType { + return entity.FieldTypeString +} + +// Len returns column values length +func (c *ColumnString) Len() int { + return len(c.values) +} + +// Get returns value at index as interface{}. +func (c *ColumnString) Get(idx int) (interface{}, error) { + var r string // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnString) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_String, + FieldName: c.name, + } + data := make([]string, 0, c.Len()) + for i := 0; i < c.Len(); i++ { + data = append(data, string(c.values[i])) + } + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_StringData{ + StringData: &schemapb.StringArray{ + Data: data, + }, + }, + }, + } + return fd +} + +// ValueByIdx returns value of the provided index +// error occurs when index out of range +func (c *ColumnString) ValueByIdx(idx int) (string, error) { + var r string // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnString) AppendValue(i interface{}) error { + v, ok := i.(string) + if !ok { + return fmt.Errorf("invalid type, expected string, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnString) Data() []string { + return c.values +} + +// NewColumnString auto generated constructor +func NewColumnString(name string, values []string) *ColumnString { + return &ColumnString{ + name: name, + values: values, + } +} diff --git a/client/column/scalar_gen_test.go b/client/column/scalar_gen_test.go new file mode 100644 index 0000000000000..5e325a640ba3a --- /dev/null +++ b/client/column/scalar_gen_test.go @@ -0,0 +1,855 @@ +// Code generated by go generate; DO NOT EDIT +// This file is generated by go generated + +package column + +import ( + "fmt" + "math/rand" + "testing" + "time" + + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/client/v2/entity" + "github.com/stretchr/testify/assert" +) + +func TestColumnBool(t *testing.T) { + rand.Seed(time.Now().UnixNano()) + columnName := fmt.Sprintf("column_Bool_%d", rand.Int()) + columnLen := 8 + rand.Intn(10) + + v := make([]bool, columnLen) + column := NewColumnBool(columnName, v) + + t.Run("test meta", func(t *testing.T) { + ft := entity.FieldTypeBool + assert.Equal(t, "Bool", ft.Name()) + assert.Equal(t, "bool", ft.String()) + pbName, pbType := ft.PbFieldType() + assert.Equal(t, "Bool", pbName) + assert.Equal(t, "bool", pbType) + }) + + t.Run("test column attribute", func(t *testing.T) { + assert.Equal(t, columnName, column.Name()) + assert.Equal(t, entity.FieldTypeBool, column.Type()) + assert.Equal(t, columnLen, column.Len()) + assert.EqualValues(t, v, column.Data()) + }) + + t.Run("test column field data", func(t *testing.T) { + fd := column.FieldData() + assert.NotNil(t, fd) + assert.Equal(t, fd.GetFieldName(), columnName) + }) + + t.Run("test column value by idx", func(t *testing.T) { + _, err := column.ValueByIdx(-1) + assert.NotNil(t, err) + _, err = column.ValueByIdx(columnLen) + assert.NotNil(t, err) + for i := 0; i < columnLen; i++ { + v, err := column.ValueByIdx(i) + assert.Nil(t, err) + assert.Equal(t, column.values[i], v) + } + }) +} + +func TestFieldDataBoolColumn(t *testing.T) { + len := rand.Intn(10) + 8 + name := fmt.Sprintf("fd_Bool_%d", rand.Int()) + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Bool, + FieldName: name, + } + + t.Run("normal usage", func(t *testing.T) { + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_BoolData{ + BoolData: &schemapb.BoolArray{ + Data: make([]bool, len), + }, + }, + }, + } + column, err := FieldDataColumn(fd, 0, len) + assert.Nil(t, err) + assert.NotNil(t, column) + + assert.Equal(t, name, column.Name()) + assert.Equal(t, len, column.Len()) + assert.Equal(t, entity.FieldTypeBool, column.Type()) + + var ev bool + err = column.AppendValue(ev) + assert.Equal(t, len+1, column.Len()) + assert.Nil(t, err) + + err = column.AppendValue(struct{}{}) + assert.Equal(t, len+1, column.Len()) + assert.NotNil(t, err) + }) + + t.Run("nil data", func(t *testing.T) { + fd.Field = nil + _, err := FieldDataColumn(fd, 0, len) + assert.NotNil(t, err) + }) + + t.Run("get all data", func(t *testing.T) { + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_BoolData{ + BoolData: &schemapb.BoolArray{ + Data: make([]bool, len), + }, + }, + }, + } + column, err := FieldDataColumn(fd, 0, -1) + assert.Nil(t, err) + assert.NotNil(t, column) + + assert.Equal(t, name, column.Name()) + assert.Equal(t, len, column.Len()) + assert.Equal(t, entity.FieldTypeBool, column.Type()) + }) +} + +func TestColumnInt8(t *testing.T) { + rand.Seed(time.Now().UnixNano()) + columnName := fmt.Sprintf("column_Int8_%d", rand.Int()) + columnLen := 8 + rand.Intn(10) + + v := make([]int8, columnLen) + column := NewColumnInt8(columnName, v) + + t.Run("test meta", func(t *testing.T) { + ft := entity.FieldTypeInt8 + assert.Equal(t, "Int8", ft.Name()) + assert.Equal(t, "int8", ft.String()) + pbName, pbType := ft.PbFieldType() + assert.Equal(t, "Int", pbName) + assert.Equal(t, "int32", pbType) + }) + + t.Run("test column attribute", func(t *testing.T) { + assert.Equal(t, columnName, column.Name()) + assert.Equal(t, entity.FieldTypeInt8, column.Type()) + assert.Equal(t, columnLen, column.Len()) + assert.EqualValues(t, v, column.Data()) + }) + + t.Run("test column field data", func(t *testing.T) { + fd := column.FieldData() + assert.NotNil(t, fd) + assert.Equal(t, fd.GetFieldName(), columnName) + }) + + t.Run("test column value by idx", func(t *testing.T) { + _, err := column.ValueByIdx(-1) + assert.NotNil(t, err) + _, err = column.ValueByIdx(columnLen) + assert.NotNil(t, err) + for i := 0; i < columnLen; i++ { + v, err := column.ValueByIdx(i) + assert.Nil(t, err) + assert.Equal(t, column.values[i], v) + } + }) +} + +func TestFieldDataInt8Column(t *testing.T) { + len := rand.Intn(10) + 8 + name := fmt.Sprintf("fd_Int8_%d", rand.Int()) + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Int8, + FieldName: name, + } + + t.Run("normal usage", func(t *testing.T) { + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_IntData{ + IntData: &schemapb.IntArray{ + Data: make([]int32, len), + }, + }, + }, + } + column, err := FieldDataColumn(fd, 0, len) + assert.Nil(t, err) + assert.NotNil(t, column) + + assert.Equal(t, name, column.Name()) + assert.Equal(t, len, column.Len()) + assert.Equal(t, entity.FieldTypeInt8, column.Type()) + + var ev int8 + err = column.AppendValue(ev) + assert.Equal(t, len+1, column.Len()) + assert.Nil(t, err) + + err = column.AppendValue(struct{}{}) + assert.Equal(t, len+1, column.Len()) + assert.NotNil(t, err) + }) + + t.Run("nil data", func(t *testing.T) { + fd.Field = nil + _, err := FieldDataColumn(fd, 0, len) + assert.NotNil(t, err) + }) + + t.Run("get all data", func(t *testing.T) { + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_IntData{ + IntData: &schemapb.IntArray{ + Data: make([]int32, len), + }, + }, + }, + } + column, err := FieldDataColumn(fd, 0, -1) + assert.Nil(t, err) + assert.NotNil(t, column) + + assert.Equal(t, name, column.Name()) + assert.Equal(t, len, column.Len()) + assert.Equal(t, entity.FieldTypeInt8, column.Type()) + }) +} + +func TestColumnInt16(t *testing.T) { + rand.Seed(time.Now().UnixNano()) + columnName := fmt.Sprintf("column_Int16_%d", rand.Int()) + columnLen := 8 + rand.Intn(10) + + v := make([]int16, columnLen) + column := NewColumnInt16(columnName, v) + + t.Run("test meta", func(t *testing.T) { + ft := entity.FieldTypeInt16 + assert.Equal(t, "Int16", ft.Name()) + assert.Equal(t, "int16", ft.String()) + pbName, pbType := ft.PbFieldType() + assert.Equal(t, "Int", pbName) + assert.Equal(t, "int32", pbType) + }) + + t.Run("test column attribute", func(t *testing.T) { + assert.Equal(t, columnName, column.Name()) + assert.Equal(t, entity.FieldTypeInt16, column.Type()) + assert.Equal(t, columnLen, column.Len()) + assert.EqualValues(t, v, column.Data()) + }) + + t.Run("test column field data", func(t *testing.T) { + fd := column.FieldData() + assert.NotNil(t, fd) + assert.Equal(t, fd.GetFieldName(), columnName) + }) + + t.Run("test column value by idx", func(t *testing.T) { + _, err := column.ValueByIdx(-1) + assert.NotNil(t, err) + _, err = column.ValueByIdx(columnLen) + assert.NotNil(t, err) + for i := 0; i < columnLen; i++ { + v, err := column.ValueByIdx(i) + assert.Nil(t, err) + assert.Equal(t, column.values[i], v) + } + }) +} + +func TestFieldDataInt16Column(t *testing.T) { + len := rand.Intn(10) + 8 + name := fmt.Sprintf("fd_Int16_%d", rand.Int()) + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Int16, + FieldName: name, + } + + t.Run("normal usage", func(t *testing.T) { + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_IntData{ + IntData: &schemapb.IntArray{ + Data: make([]int32, len), + }, + }, + }, + } + column, err := FieldDataColumn(fd, 0, len) + assert.Nil(t, err) + assert.NotNil(t, column) + + assert.Equal(t, name, column.Name()) + assert.Equal(t, len, column.Len()) + assert.Equal(t, entity.FieldTypeInt16, column.Type()) + + var ev int16 + err = column.AppendValue(ev) + assert.Equal(t, len+1, column.Len()) + assert.Nil(t, err) + + err = column.AppendValue(struct{}{}) + assert.Equal(t, len+1, column.Len()) + assert.NotNil(t, err) + }) + + t.Run("nil data", func(t *testing.T) { + fd.Field = nil + _, err := FieldDataColumn(fd, 0, len) + assert.NotNil(t, err) + }) + + t.Run("get all data", func(t *testing.T) { + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_IntData{ + IntData: &schemapb.IntArray{ + Data: make([]int32, len), + }, + }, + }, + } + column, err := FieldDataColumn(fd, 0, -1) + assert.Nil(t, err) + assert.NotNil(t, column) + + assert.Equal(t, name, column.Name()) + assert.Equal(t, len, column.Len()) + assert.Equal(t, entity.FieldTypeInt16, column.Type()) + }) +} + +func TestColumnInt32(t *testing.T) { + rand.Seed(time.Now().UnixNano()) + columnName := fmt.Sprintf("column_Int32_%d", rand.Int()) + columnLen := 8 + rand.Intn(10) + + v := make([]int32, columnLen) + column := NewColumnInt32(columnName, v) + + t.Run("test meta", func(t *testing.T) { + ft := entity.FieldTypeInt32 + assert.Equal(t, "Int32", ft.Name()) + assert.Equal(t, "int32", ft.String()) + pbName, pbType := ft.PbFieldType() + assert.Equal(t, "Int", pbName) + assert.Equal(t, "int32", pbType) + }) + + t.Run("test column attribute", func(t *testing.T) { + assert.Equal(t, columnName, column.Name()) + assert.Equal(t, entity.FieldTypeInt32, column.Type()) + assert.Equal(t, columnLen, column.Len()) + assert.EqualValues(t, v, column.Data()) + }) + + t.Run("test column field data", func(t *testing.T) { + fd := column.FieldData() + assert.NotNil(t, fd) + assert.Equal(t, fd.GetFieldName(), columnName) + }) + + t.Run("test column value by idx", func(t *testing.T) { + _, err := column.ValueByIdx(-1) + assert.NotNil(t, err) + _, err = column.ValueByIdx(columnLen) + assert.NotNil(t, err) + for i := 0; i < columnLen; i++ { + v, err := column.ValueByIdx(i) + assert.Nil(t, err) + assert.Equal(t, column.values[i], v) + } + }) +} + +func TestFieldDataInt32Column(t *testing.T) { + len := rand.Intn(10) + 8 + name := fmt.Sprintf("fd_Int32_%d", rand.Int()) + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Int32, + FieldName: name, + } + + t.Run("normal usage", func(t *testing.T) { + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_IntData{ + IntData: &schemapb.IntArray{ + Data: make([]int32, len), + }, + }, + }, + } + column, err := FieldDataColumn(fd, 0, len) + assert.Nil(t, err) + assert.NotNil(t, column) + + assert.Equal(t, name, column.Name()) + assert.Equal(t, len, column.Len()) + assert.Equal(t, entity.FieldTypeInt32, column.Type()) + + var ev int32 + err = column.AppendValue(ev) + assert.Equal(t, len+1, column.Len()) + assert.Nil(t, err) + + err = column.AppendValue(struct{}{}) + assert.Equal(t, len+1, column.Len()) + assert.NotNil(t, err) + }) + + t.Run("nil data", func(t *testing.T) { + fd.Field = nil + _, err := FieldDataColumn(fd, 0, len) + assert.NotNil(t, err) + }) + + t.Run("get all data", func(t *testing.T) { + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_IntData{ + IntData: &schemapb.IntArray{ + Data: make([]int32, len), + }, + }, + }, + } + column, err := FieldDataColumn(fd, 0, -1) + assert.Nil(t, err) + assert.NotNil(t, column) + + assert.Equal(t, name, column.Name()) + assert.Equal(t, len, column.Len()) + assert.Equal(t, entity.FieldTypeInt32, column.Type()) + }) +} + +func TestColumnInt64(t *testing.T) { + rand.Seed(time.Now().UnixNano()) + columnName := fmt.Sprintf("column_Int64_%d", rand.Int()) + columnLen := 8 + rand.Intn(10) + + v := make([]int64, columnLen) + column := NewColumnInt64(columnName, v) + + t.Run("test meta", func(t *testing.T) { + ft := entity.FieldTypeInt64 + assert.Equal(t, "Int64", ft.Name()) + assert.Equal(t, "int64", ft.String()) + pbName, pbType := ft.PbFieldType() + assert.Equal(t, "Long", pbName) + assert.Equal(t, "int64", pbType) + }) + + t.Run("test column attribute", func(t *testing.T) { + assert.Equal(t, columnName, column.Name()) + assert.Equal(t, entity.FieldTypeInt64, column.Type()) + assert.Equal(t, columnLen, column.Len()) + assert.EqualValues(t, v, column.Data()) + }) + + t.Run("test column field data", func(t *testing.T) { + fd := column.FieldData() + assert.NotNil(t, fd) + assert.Equal(t, fd.GetFieldName(), columnName) + }) + + t.Run("test column value by idx", func(t *testing.T) { + _, err := column.ValueByIdx(-1) + assert.NotNil(t, err) + _, err = column.ValueByIdx(columnLen) + assert.NotNil(t, err) + for i := 0; i < columnLen; i++ { + v, err := column.ValueByIdx(i) + assert.Nil(t, err) + assert.Equal(t, column.values[i], v) + } + }) +} + +func TestFieldDataInt64Column(t *testing.T) { + len := rand.Intn(10) + 8 + name := fmt.Sprintf("fd_Int64_%d", rand.Int()) + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Int64, + FieldName: name, + } + + t.Run("normal usage", func(t *testing.T) { + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_LongData{ + LongData: &schemapb.LongArray{ + Data: make([]int64, len), + }, + }, + }, + } + column, err := FieldDataColumn(fd, 0, len) + assert.Nil(t, err) + assert.NotNil(t, column) + + assert.Equal(t, name, column.Name()) + assert.Equal(t, len, column.Len()) + assert.Equal(t, entity.FieldTypeInt64, column.Type()) + + var ev int64 + err = column.AppendValue(ev) + assert.Equal(t, len+1, column.Len()) + assert.Nil(t, err) + + err = column.AppendValue(struct{}{}) + assert.Equal(t, len+1, column.Len()) + assert.NotNil(t, err) + }) + + t.Run("nil data", func(t *testing.T) { + fd.Field = nil + _, err := FieldDataColumn(fd, 0, len) + assert.NotNil(t, err) + }) + + t.Run("get all data", func(t *testing.T) { + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_LongData{ + LongData: &schemapb.LongArray{ + Data: make([]int64, len), + }, + }, + }, + } + column, err := FieldDataColumn(fd, 0, -1) + assert.Nil(t, err) + assert.NotNil(t, column) + + assert.Equal(t, name, column.Name()) + assert.Equal(t, len, column.Len()) + assert.Equal(t, entity.FieldTypeInt64, column.Type()) + }) +} + +func TestColumnFloat(t *testing.T) { + rand.Seed(time.Now().UnixNano()) + columnName := fmt.Sprintf("column_Float_%d", rand.Int()) + columnLen := 8 + rand.Intn(10) + + v := make([]float32, columnLen) + column := NewColumnFloat(columnName, v) + + t.Run("test meta", func(t *testing.T) { + ft := entity.FieldTypeFloat + assert.Equal(t, "Float", ft.Name()) + assert.Equal(t, "float32", ft.String()) + pbName, pbType := ft.PbFieldType() + assert.Equal(t, "Float", pbName) + assert.Equal(t, "float32", pbType) + }) + + t.Run("test column attribute", func(t *testing.T) { + assert.Equal(t, columnName, column.Name()) + assert.Equal(t, entity.FieldTypeFloat, column.Type()) + assert.Equal(t, columnLen, column.Len()) + assert.EqualValues(t, v, column.Data()) + }) + + t.Run("test column field data", func(t *testing.T) { + fd := column.FieldData() + assert.NotNil(t, fd) + assert.Equal(t, fd.GetFieldName(), columnName) + }) + + t.Run("test column value by idx", func(t *testing.T) { + _, err := column.ValueByIdx(-1) + assert.NotNil(t, err) + _, err = column.ValueByIdx(columnLen) + assert.NotNil(t, err) + for i := 0; i < columnLen; i++ { + v, err := column.ValueByIdx(i) + assert.Nil(t, err) + assert.Equal(t, column.values[i], v) + } + }) +} + +func TestFieldDataFloatColumn(t *testing.T) { + len := rand.Intn(10) + 8 + name := fmt.Sprintf("fd_Float_%d", rand.Int()) + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Float, + FieldName: name, + } + + t.Run("normal usage", func(t *testing.T) { + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_FloatData{ + FloatData: &schemapb.FloatArray{ + Data: make([]float32, len), + }, + }, + }, + } + column, err := FieldDataColumn(fd, 0, len) + assert.Nil(t, err) + assert.NotNil(t, column) + + assert.Equal(t, name, column.Name()) + assert.Equal(t, len, column.Len()) + assert.Equal(t, entity.FieldTypeFloat, column.Type()) + + var ev float32 + err = column.AppendValue(ev) + assert.Equal(t, len+1, column.Len()) + assert.Nil(t, err) + + err = column.AppendValue(struct{}{}) + assert.Equal(t, len+1, column.Len()) + assert.NotNil(t, err) + }) + + t.Run("nil data", func(t *testing.T) { + fd.Field = nil + _, err := FieldDataColumn(fd, 0, len) + assert.NotNil(t, err) + }) + + t.Run("get all data", func(t *testing.T) { + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_FloatData{ + FloatData: &schemapb.FloatArray{ + Data: make([]float32, len), + }, + }, + }, + } + column, err := FieldDataColumn(fd, 0, -1) + assert.Nil(t, err) + assert.NotNil(t, column) + + assert.Equal(t, name, column.Name()) + assert.Equal(t, len, column.Len()) + assert.Equal(t, entity.FieldTypeFloat, column.Type()) + }) +} + +func TestColumnDouble(t *testing.T) { + rand.Seed(time.Now().UnixNano()) + columnName := fmt.Sprintf("column_Double_%d", rand.Int()) + columnLen := 8 + rand.Intn(10) + + v := make([]float64, columnLen) + column := NewColumnDouble(columnName, v) + + t.Run("test meta", func(t *testing.T) { + ft := entity.FieldTypeDouble + assert.Equal(t, "Double", ft.Name()) + assert.Equal(t, "float64", ft.String()) + pbName, pbType := ft.PbFieldType() + assert.Equal(t, "Double", pbName) + assert.Equal(t, "float64", pbType) + }) + + t.Run("test column attribute", func(t *testing.T) { + assert.Equal(t, columnName, column.Name()) + assert.Equal(t, entity.FieldTypeDouble, column.Type()) + assert.Equal(t, columnLen, column.Len()) + assert.EqualValues(t, v, column.Data()) + }) + + t.Run("test column field data", func(t *testing.T) { + fd := column.FieldData() + assert.NotNil(t, fd) + assert.Equal(t, fd.GetFieldName(), columnName) + }) + + t.Run("test column value by idx", func(t *testing.T) { + _, err := column.ValueByIdx(-1) + assert.NotNil(t, err) + _, err = column.ValueByIdx(columnLen) + assert.NotNil(t, err) + for i := 0; i < columnLen; i++ { + v, err := column.ValueByIdx(i) + assert.Nil(t, err) + assert.Equal(t, column.values[i], v) + } + }) +} + +func TestFieldDataDoubleColumn(t *testing.T) { + len := rand.Intn(10) + 8 + name := fmt.Sprintf("fd_Double_%d", rand.Int()) + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Double, + FieldName: name, + } + + t.Run("normal usage", func(t *testing.T) { + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_DoubleData{ + DoubleData: &schemapb.DoubleArray{ + Data: make([]float64, len), + }, + }, + }, + } + column, err := FieldDataColumn(fd, 0, len) + assert.Nil(t, err) + assert.NotNil(t, column) + + assert.Equal(t, name, column.Name()) + assert.Equal(t, len, column.Len()) + assert.Equal(t, entity.FieldTypeDouble, column.Type()) + + var ev float64 + err = column.AppendValue(ev) + assert.Equal(t, len+1, column.Len()) + assert.Nil(t, err) + + err = column.AppendValue(struct{}{}) + assert.Equal(t, len+1, column.Len()) + assert.NotNil(t, err) + }) + + t.Run("nil data", func(t *testing.T) { + fd.Field = nil + _, err := FieldDataColumn(fd, 0, len) + assert.NotNil(t, err) + }) + + t.Run("get all data", func(t *testing.T) { + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_DoubleData{ + DoubleData: &schemapb.DoubleArray{ + Data: make([]float64, len), + }, + }, + }, + } + column, err := FieldDataColumn(fd, 0, -1) + assert.Nil(t, err) + assert.NotNil(t, column) + + assert.Equal(t, name, column.Name()) + assert.Equal(t, len, column.Len()) + assert.Equal(t, entity.FieldTypeDouble, column.Type()) + }) +} + +func TestColumnString(t *testing.T) { + rand.Seed(time.Now().UnixNano()) + columnName := fmt.Sprintf("column_String_%d", rand.Int()) + columnLen := 8 + rand.Intn(10) + + v := make([]string, columnLen) + column := NewColumnString(columnName, v) + + t.Run("test meta", func(t *testing.T) { + ft := entity.FieldTypeString + assert.Equal(t, "String", ft.Name()) + assert.Equal(t, "string", ft.String()) + pbName, pbType := ft.PbFieldType() + assert.Equal(t, "String", pbName) + assert.Equal(t, "string", pbType) + }) + + t.Run("test column attribute", func(t *testing.T) { + assert.Equal(t, columnName, column.Name()) + assert.Equal(t, entity.FieldTypeString, column.Type()) + assert.Equal(t, columnLen, column.Len()) + assert.EqualValues(t, v, column.Data()) + }) + + t.Run("test column field data", func(t *testing.T) { + fd := column.FieldData() + assert.NotNil(t, fd) + assert.Equal(t, fd.GetFieldName(), columnName) + }) + + t.Run("test column value by idx", func(t *testing.T) { + _, err := column.ValueByIdx(-1) + assert.NotNil(t, err) + _, err = column.ValueByIdx(columnLen) + assert.NotNil(t, err) + for i := 0; i < columnLen; i++ { + v, err := column.ValueByIdx(i) + assert.Nil(t, err) + assert.Equal(t, column.values[i], v) + } + }) +} + +func TestFieldDataStringColumn(t *testing.T) { + len := rand.Intn(10) + 8 + name := fmt.Sprintf("fd_String_%d", rand.Int()) + fd := &schemapb.FieldData{ + Type: schemapb.DataType_String, + FieldName: name, + } + + t.Run("normal usage", func(t *testing.T) { + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_StringData{ + StringData: &schemapb.StringArray{ + Data: make([]string, len), + }, + }, + }, + } + column, err := FieldDataColumn(fd, 0, len) + assert.Nil(t, err) + assert.NotNil(t, column) + + assert.Equal(t, name, column.Name()) + assert.Equal(t, len, column.Len()) + assert.Equal(t, entity.FieldTypeString, column.Type()) + + var ev string + err = column.AppendValue(ev) + assert.Equal(t, len+1, column.Len()) + assert.Nil(t, err) + + err = column.AppendValue(struct{}{}) + assert.Equal(t, len+1, column.Len()) + assert.NotNil(t, err) + }) + + t.Run("nil data", func(t *testing.T) { + fd.Field = nil + _, err := FieldDataColumn(fd, 0, len) + assert.NotNil(t, err) + }) + + t.Run("get all data", func(t *testing.T) { + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_StringData{ + StringData: &schemapb.StringArray{ + Data: make([]string, len), + }, + }, + }, + } + column, err := FieldDataColumn(fd, 0, -1) + assert.Nil(t, err) + assert.NotNil(t, column) + + assert.Equal(t, name, column.Name()) + assert.Equal(t, len, column.Len()) + assert.Equal(t, entity.FieldTypeString, column.Type()) + }) +} diff --git a/client/column/sparse.go b/client/column/sparse.go new file mode 100644 index 0000000000000..b9d20fd616ded --- /dev/null +++ b/client/column/sparse.go @@ -0,0 +1,125 @@ +// 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 column + +import ( + "encoding/binary" + "fmt" + "math" + + "github.com/cockroachdb/errors" + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/client/v2/entity" +) + +var _ (Column) = (*ColumnSparseFloatVector)(nil) + +type ColumnSparseFloatVector struct { + ColumnBase + + vectors []entity.SparseEmbedding + name string +} + +// Name returns column name. +func (c *ColumnSparseFloatVector) Name() string { + return c.name +} + +// Type returns column FieldType. +func (c *ColumnSparseFloatVector) Type() entity.FieldType { + return entity.FieldTypeSparseVector +} + +// Len returns column values length. +func (c *ColumnSparseFloatVector) Len() int { + return len(c.vectors) +} + +// Get returns value at index as interface{}. +func (c *ColumnSparseFloatVector) Get(idx int) (interface{}, error) { + if idx < 0 || idx >= c.Len() { + return nil, errors.New("index out of range") + } + return c.vectors[idx], nil +} + +// ValueByIdx returns value of the provided index +// error occurs when index out of range +func (c *ColumnSparseFloatVector) ValueByIdx(idx int) (entity.SparseEmbedding, error) { + var r entity.SparseEmbedding // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.vectors[idx], nil +} + +func (c *ColumnSparseFloatVector) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_SparseFloatVector, + FieldName: c.name, + } + + dim := int(0) + data := make([][]byte, 0, len(c.vectors)) + for _, vector := range c.vectors { + row := make([]byte, 8*vector.Len()) + for idx := 0; idx < vector.Len(); idx++ { + pos, value, _ := vector.Get(idx) + binary.LittleEndian.PutUint32(row[idx*8:], pos) + binary.LittleEndian.PutUint32(row[pos*8+4:], math.Float32bits(value)) + } + data = append(data, row) + if vector.Dim() > dim { + dim = vector.Dim() + } + } + + fd.Field = &schemapb.FieldData_Vectors{ + Vectors: &schemapb.VectorField{ + Dim: int64(dim), + Data: &schemapb.VectorField_SparseFloatVector{ + SparseFloatVector: &schemapb.SparseFloatArray{ + Dim: int64(dim), + Contents: data, + }, + }, + }, + } + return fd +} + +func (c *ColumnSparseFloatVector) AppendValue(i interface{}) error { + v, ok := i.(entity.SparseEmbedding) + if !ok { + return fmt.Errorf("invalid type, expect SparseEmbedding interface, got %T", i) + } + c.vectors = append(c.vectors, v) + + return nil +} + +func (c *ColumnSparseFloatVector) Data() []entity.SparseEmbedding { + return c.vectors +} + +func NewColumnSparseVectors(name string, values []entity.SparseEmbedding) *ColumnSparseFloatVector { + return &ColumnSparseFloatVector{ + name: name, + vectors: values, + } +} diff --git a/client/column/sparse_test.go b/client/column/sparse_test.go new file mode 100644 index 0000000000000..387df9efe7d7c --- /dev/null +++ b/client/column/sparse_test.go @@ -0,0 +1,81 @@ +// 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 column + +import ( + "fmt" + "math/rand" + "testing" + + "github.com/milvus-io/milvus/client/v2/entity" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestColumnSparseEmbedding(t *testing.T) { + columnName := fmt.Sprintf("column_sparse_embedding_%d", rand.Int()) + columnLen := 8 + rand.Intn(10) + + v := make([]entity.SparseEmbedding, 0, columnLen) + for i := 0; i < columnLen; i++ { + length := 1 + rand.Intn(5) + positions := make([]uint32, length) + values := make([]float32, length) + for j := 0; j < length; j++ { + positions[j] = uint32(j) + values[j] = rand.Float32() + } + se, err := entity.NewSliceSparseEmbedding(positions, values) + require.NoError(t, err) + v = append(v, se) + } + column := NewColumnSparseVectors(columnName, v) + + t.Run("test column attribute", func(t *testing.T) { + assert.Equal(t, columnName, column.Name()) + assert.Equal(t, entity.FieldTypeSparseVector, column.Type()) + assert.Equal(t, columnLen, column.Len()) + assert.EqualValues(t, v, column.Data()) + }) + + t.Run("test column field data", func(t *testing.T) { + fd := column.FieldData() + assert.NotNil(t, fd) + assert.Equal(t, fd.GetFieldName(), columnName) + }) + + t.Run("test column value by idx", func(t *testing.T) { + _, err := column.ValueByIdx(-1) + assert.Error(t, err) + _, err = column.ValueByIdx(columnLen) + assert.Error(t, err) + + _, err = column.Get(-1) + assert.Error(t, err) + _, err = column.Get(columnLen) + assert.Error(t, err) + + for i := 0; i < columnLen; i++ { + v, err := column.ValueByIdx(i) + assert.NoError(t, err) + assert.Equal(t, column.vectors[i], v) + getV, err := column.Get(i) + assert.NoError(t, err) + assert.Equal(t, v, getV) + } + }) +} diff --git a/client/column/varchar.go b/client/column/varchar.go new file mode 100644 index 0000000000000..9ed1646450189 --- /dev/null +++ b/client/column/varchar.go @@ -0,0 +1,119 @@ +// 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 column + +import ( + "errors" + "fmt" + + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/client/v2/entity" +) + +// ColumnVarChar generated columns type for VarChar +type ColumnVarChar struct { + ColumnBase + name string + values []string +} + +// Name returns column name +func (c *ColumnVarChar) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnVarChar) Type() entity.FieldType { + return entity.FieldTypeVarChar +} + +// Len returns column values length +func (c *ColumnVarChar) Len() int { + return len(c.values) +} + +// Get returns value at index as interface{}. +func (c *ColumnVarChar) Get(idx int) (interface{}, error) { + if idx < 0 || idx > c.Len() { + return "", errors.New("index out of range") + } + return c.values[idx], nil +} + +// GetAsString returns value at idx. +func (c *ColumnVarChar) GetAsString(idx int) (string, error) { + if idx < 0 || idx > c.Len() { + return "", errors.New("index out of range") + } + return c.values[idx], nil +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnVarChar) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_VarChar, + FieldName: c.name, + } + data := make([]string, 0, c.Len()) + for i := 0; i < c.Len(); i++ { + data = append(data, string(c.values[i])) + } + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_StringData{ + StringData: &schemapb.StringArray{ + Data: data, + }, + }, + }, + } + return fd +} + +// ValueByIdx returns value of the provided index +// error occurs when index out of range +func (c *ColumnVarChar) ValueByIdx(idx int) (string, error) { + var r string // use default value + if idx < 0 || idx >= c.Len() { + return r, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnVarChar) AppendValue(i interface{}) error { + v, ok := i.(string) + if !ok { + return fmt.Errorf("invalid type, expected string, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnVarChar) Data() []string { + return c.values +} + +// NewColumnVarChar auto generated constructor +func NewColumnVarChar(name string, values []string) *ColumnVarChar { + return &ColumnVarChar{ + name: name, + values: values, + } +} diff --git a/client/column/varchar_test.go b/client/column/varchar_test.go new file mode 100644 index 0000000000000..8e2535c8154b2 --- /dev/null +++ b/client/column/varchar_test.go @@ -0,0 +1,134 @@ +// 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 column + +import ( + "fmt" + "math/rand" + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/client/v2/entity" +) + +func TestColumnVarChar(t *testing.T) { + rand.Seed(time.Now().UnixNano()) + columnName := fmt.Sprintf("column_VarChar_%d", rand.Int()) + columnLen := 8 + rand.Intn(10) + + v := make([]string, columnLen) + column := NewColumnVarChar(columnName, v) + + t.Run("test meta", func(t *testing.T) { + ft := entity.FieldTypeVarChar + assert.Equal(t, "VarChar", ft.Name()) + assert.Equal(t, "string", ft.String()) + pbName, pbType := ft.PbFieldType() + assert.Equal(t, "VarChar", pbName) + assert.Equal(t, "string", pbType) + }) + + t.Run("test column attribute", func(t *testing.T) { + assert.Equal(t, columnName, column.Name()) + assert.Equal(t, entity.FieldTypeVarChar, column.Type()) + assert.Equal(t, columnLen, column.Len()) + assert.EqualValues(t, v, column.Data()) + }) + + t.Run("test column field data", func(t *testing.T) { + fd := column.FieldData() + assert.NotNil(t, fd) + assert.Equal(t, fd.GetFieldName(), columnName) + }) + + t.Run("test column value by idx", func(t *testing.T) { + _, err := column.ValueByIdx(-1) + assert.NotNil(t, err) + _, err = column.ValueByIdx(columnLen) + assert.NotNil(t, err) + for i := 0; i < columnLen; i++ { + v, err := column.ValueByIdx(i) + assert.Nil(t, err) + assert.Equal(t, column.values[i], v) + } + }) +} + +func TestFieldDataVarCharColumn(t *testing.T) { + colLen := rand.Intn(10) + 8 + name := fmt.Sprintf("fd_VarChar_%d", rand.Int()) + fd := &schemapb.FieldData{ + Type: schemapb.DataType_VarChar, + FieldName: name, + } + + t.Run("normal usage", func(t *testing.T) { + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_StringData{ + StringData: &schemapb.StringArray{ + Data: make([]string, colLen), + }, + }, + }, + } + column, err := FieldDataColumn(fd, 0, colLen) + assert.Nil(t, err) + assert.NotNil(t, column) + + assert.Equal(t, name, column.Name()) + assert.Equal(t, colLen, column.Len()) + assert.Equal(t, entity.FieldTypeVarChar, column.Type()) + + var ev string + err = column.AppendValue(ev) + assert.Equal(t, colLen+1, column.Len()) + assert.Nil(t, err) + + err = column.AppendValue(struct{}{}) + assert.Equal(t, colLen+1, column.Len()) + assert.NotNil(t, err) + }) + + t.Run("nil data", func(t *testing.T) { + fd.Field = nil + _, err := FieldDataColumn(fd, 0, colLen) + assert.NotNil(t, err) + }) + + t.Run("get all data", func(t *testing.T) { + fd.Field = &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_StringData{ + StringData: &schemapb.StringArray{ + Data: make([]string, colLen), + }, + }, + }, + } + column, err := FieldDataColumn(fd, 0, -1) + assert.Nil(t, err) + assert.NotNil(t, column) + + assert.Equal(t, name, column.Name()) + assert.Equal(t, colLen, column.Len()) + assert.Equal(t, entity.FieldTypeVarChar, column.Type()) + }) +} diff --git a/client/column/vector_gen.go b/client/column/vector_gen.go new file mode 100644 index 0000000000000..dca82eba23583 --- /dev/null +++ b/client/column/vector_gen.go @@ -0,0 +1,358 @@ +// Code generated by go generate; DO NOT EDIT +// This file is generated by go generated +package column + +import ( + "fmt" + + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/client/v2/entity" + + "github.com/cockroachdb/errors" +) + +// ColumnBinaryVector generated columns type for BinaryVector +type ColumnBinaryVector struct { + ColumnBase + name string + dim int + values [][]byte +} + +// Name returns column name +func (c *ColumnBinaryVector) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnBinaryVector) Type() entity.FieldType { + return entity.FieldTypeBinaryVector +} + +// Len returns column data length +func (c *ColumnBinaryVector) Len() int { + return len(c.values) +} + +// Dim returns vector dimension +func (c *ColumnBinaryVector) Dim() int { + return c.dim +} + +// Get returns values at index as interface{}. +func (c *ColumnBinaryVector) Get(idx int) (interface{}, error) { + if idx < 0 || idx >= c.Len() { + return nil, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnBinaryVector) AppendValue(i interface{}) error { + v, ok := i.([]byte) + if !ok { + return fmt.Errorf("invalid type, expected []byte, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnBinaryVector) Data() [][]byte { + return c.values +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnBinaryVector) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_BinaryVector, + FieldName: c.name, + } + + data := make([]byte, 0, len(c.values)*c.dim) + + for _, vector := range c.values { + data = append(data, vector...) + } + + fd.Field = &schemapb.FieldData_Vectors{ + Vectors: &schemapb.VectorField{ + Dim: int64(c.dim), + + Data: &schemapb.VectorField_BinaryVector{ + BinaryVector: data, + }, + }, + } + return fd +} + +// NewColumnBinaryVector auto generated constructor +func NewColumnBinaryVector(name string, dim int, values [][]byte) *ColumnBinaryVector { + return &ColumnBinaryVector{ + name: name, + dim: dim, + values: values, + } +} + +// ColumnFloatVector generated columns type for FloatVector +type ColumnFloatVector struct { + ColumnBase + name string + dim int + values [][]float32 +} + +// Name returns column name +func (c *ColumnFloatVector) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnFloatVector) Type() entity.FieldType { + return entity.FieldTypeFloatVector +} + +// Len returns column data length +func (c *ColumnFloatVector) Len() int { + return len(c.values) +} + +// Dim returns vector dimension +func (c *ColumnFloatVector) Dim() int { + return c.dim +} + +// Get returns values at index as interface{}. +func (c *ColumnFloatVector) Get(idx int) (interface{}, error) { + if idx < 0 || idx >= c.Len() { + return nil, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnFloatVector) AppendValue(i interface{}) error { + v, ok := i.([]float32) + if !ok { + return fmt.Errorf("invalid type, expected []float32, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnFloatVector) Data() [][]float32 { + return c.values +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnFloatVector) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_FloatVector, + FieldName: c.name, + } + + data := make([]float32, 0, len(c.values)*c.dim) + + for _, vector := range c.values { + data = append(data, vector...) + } + + fd.Field = &schemapb.FieldData_Vectors{ + Vectors: &schemapb.VectorField{ + Dim: int64(c.dim), + + Data: &schemapb.VectorField_FloatVector{ + FloatVector: &schemapb.FloatArray{ + Data: data, + }, + }, + }, + } + return fd +} + +// NewColumnFloatVector auto generated constructor +func NewColumnFloatVector(name string, dim int, values [][]float32) *ColumnFloatVector { + return &ColumnFloatVector{ + name: name, + dim: dim, + values: values, + } +} + +// ColumnFloat16Vector generated columns type for Float16Vector +type ColumnFloat16Vector struct { + ColumnBase + name string + dim int + values [][]byte +} + +// Name returns column name +func (c *ColumnFloat16Vector) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnFloat16Vector) Type() entity.FieldType { + return entity.FieldTypeFloat16Vector +} + +// Len returns column data length +func (c *ColumnFloat16Vector) Len() int { + return len(c.values) +} + +// Dim returns vector dimension +func (c *ColumnFloat16Vector) Dim() int { + return c.dim +} + +// Get returns values at index as interface{}. +func (c *ColumnFloat16Vector) Get(idx int) (interface{}, error) { + if idx < 0 || idx >= c.Len() { + return nil, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnFloat16Vector) AppendValue(i interface{}) error { + v, ok := i.([]byte) + if !ok { + return fmt.Errorf("invalid type, expected []byte, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnFloat16Vector) Data() [][]byte { + return c.values +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnFloat16Vector) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Float16Vector, + FieldName: c.name, + } + + data := make([]byte, 0, len(c.values)*c.dim) + + for _, vector := range c.values { + data = append(data, vector...) + } + + fd.Field = &schemapb.FieldData_Vectors{ + Vectors: &schemapb.VectorField{ + Dim: int64(c.dim), + + Data: &schemapb.VectorField_Float16Vector{ + Float16Vector: data, + }, + }, + } + return fd +} + +// NewColumnFloat16Vector auto generated constructor +func NewColumnFloat16Vector(name string, dim int, values [][]byte) *ColumnFloat16Vector { + return &ColumnFloat16Vector{ + name: name, + dim: dim, + values: values, + } +} + +// ColumnBFloat16Vector generated columns type for BFloat16Vector +type ColumnBFloat16Vector struct { + ColumnBase + name string + dim int + values [][]byte +} + +// Name returns column name +func (c *ColumnBFloat16Vector) Name() string { + return c.name +} + +// Type returns column entity.FieldType +func (c *ColumnBFloat16Vector) Type() entity.FieldType { + return entity.FieldTypeBFloat16Vector +} + +// Len returns column data length +func (c *ColumnBFloat16Vector) Len() int { + return len(c.values) +} + +// Dim returns vector dimension +func (c *ColumnBFloat16Vector) Dim() int { + return c.dim +} + +// Get returns values at index as interface{}. +func (c *ColumnBFloat16Vector) Get(idx int) (interface{}, error) { + if idx < 0 || idx >= c.Len() { + return nil, errors.New("index out of range") + } + return c.values[idx], nil +} + +// AppendValue append value into column +func (c *ColumnBFloat16Vector) AppendValue(i interface{}) error { + v, ok := i.([]byte) + if !ok { + return fmt.Errorf("invalid type, expected []byte, got %T", i) + } + c.values = append(c.values, v) + + return nil +} + +// Data returns column data +func (c *ColumnBFloat16Vector) Data() [][]byte { + return c.values +} + +// FieldData return column data mapped to schemapb.FieldData +func (c *ColumnBFloat16Vector) FieldData() *schemapb.FieldData { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_BFloat16Vector, + FieldName: c.name, + } + + data := make([]byte, 0, len(c.values)*c.dim) + + for _, vector := range c.values { + data = append(data, vector...) + } + + fd.Field = &schemapb.FieldData_Vectors{ + Vectors: &schemapb.VectorField{ + Dim: int64(c.dim), + + Data: &schemapb.VectorField_Bfloat16Vector{ + Bfloat16Vector: data, + }, + }, + } + return fd +} + +// NewColumnBFloat16Vector auto generated constructor +func NewColumnBFloat16Vector(name string, dim int, values [][]byte) *ColumnBFloat16Vector { + return &ColumnBFloat16Vector{ + name: name, + dim: dim, + values: values, + } +} diff --git a/client/column/vector_gen_test.go b/client/column/vector_gen_test.go new file mode 100644 index 0000000000000..b2fdf9caa733b --- /dev/null +++ b/client/column/vector_gen_test.go @@ -0,0 +1,264 @@ +// Code generated by go generate; DO NOT EDIT +// This file is generated by go generated + +package column + +import ( + "fmt" + "math/rand" + "testing" + "time" + + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/client/v2/entity" + "github.com/stretchr/testify/assert" +) + +func TestColumnBinaryVector(t *testing.T) { + rand.Seed(time.Now().UnixNano()) + columnName := fmt.Sprintf("column_BinaryVector_%d", rand.Int()) + columnLen := 12 + rand.Intn(10) + dim := ([]int{64, 128, 256, 512})[rand.Intn(4)] + + v := make([][]byte, 0, columnLen) + dlen := dim + dlen /= 8 + + for i := 0; i < columnLen; i++ { + entry := make([]byte, dlen) + v = append(v, entry) + } + column := NewColumnBinaryVector(columnName, dim, v) + + t.Run("test meta", func(t *testing.T) { + ft := entity.FieldTypeBinaryVector + assert.Equal(t, "BinaryVector", ft.Name()) + assert.Equal(t, "[]byte", ft.String()) + pbName, pbType := ft.PbFieldType() + assert.Equal(t, "[]byte", pbName) + assert.Equal(t, "", pbType) + }) + + t.Run("test column attribute", func(t *testing.T) { + assert.Equal(t, columnName, column.Name()) + assert.Equal(t, entity.FieldTypeBinaryVector, column.Type()) + assert.Equal(t, columnLen, column.Len()) + assert.Equal(t, dim, column.Dim()) + assert.Equal(t, v, column.Data()) + + var ev []byte + err := column.AppendValue(ev) + assert.Equal(t, columnLen+1, column.Len()) + assert.Nil(t, err) + + err = column.AppendValue(struct{}{}) + assert.Equal(t, columnLen+1, column.Len()) + assert.NotNil(t, err) + }) + + t.Run("test column field data", func(t *testing.T) { + fd := column.FieldData() + assert.NotNil(t, fd) + assert.Equal(t, fd.GetFieldName(), columnName) + + c, err := FieldDataVector(fd) + assert.NotNil(t, c) + assert.NoError(t, err) + }) + + t.Run("test column field data error", func(t *testing.T) { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_BinaryVector, + FieldName: columnName, + } + _, err := FieldDataVector(fd) + assert.Error(t, err) + }) +} + +func TestColumnFloatVector(t *testing.T) { + rand.Seed(time.Now().UnixNano()) + columnName := fmt.Sprintf("column_FloatVector_%d", rand.Int()) + columnLen := 12 + rand.Intn(10) + dim := ([]int{64, 128, 256, 512})[rand.Intn(4)] + + v := make([][]float32, 0, columnLen) + dlen := dim + + for i := 0; i < columnLen; i++ { + entry := make([]float32, dlen) + v = append(v, entry) + } + column := NewColumnFloatVector(columnName, dim, v) + + t.Run("test meta", func(t *testing.T) { + ft := entity.FieldTypeFloatVector + assert.Equal(t, "FloatVector", ft.Name()) + assert.Equal(t, "[]float32", ft.String()) + pbName, pbType := ft.PbFieldType() + assert.Equal(t, "[]float32", pbName) + assert.Equal(t, "", pbType) + }) + + t.Run("test column attribute", func(t *testing.T) { + assert.Equal(t, columnName, column.Name()) + assert.Equal(t, entity.FieldTypeFloatVector, column.Type()) + assert.Equal(t, columnLen, column.Len()) + assert.Equal(t, dim, column.Dim()) + assert.Equal(t, v, column.Data()) + + var ev []float32 + err := column.AppendValue(ev) + assert.Equal(t, columnLen+1, column.Len()) + assert.Nil(t, err) + + err = column.AppendValue(struct{}{}) + assert.Equal(t, columnLen+1, column.Len()) + assert.NotNil(t, err) + }) + + t.Run("test column field data", func(t *testing.T) { + fd := column.FieldData() + assert.NotNil(t, fd) + assert.Equal(t, fd.GetFieldName(), columnName) + + c, err := FieldDataVector(fd) + assert.NotNil(t, c) + assert.NoError(t, err) + }) + + t.Run("test column field data error", func(t *testing.T) { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_FloatVector, + FieldName: columnName, + } + _, err := FieldDataVector(fd) + assert.Error(t, err) + }) +} + +func TestColumnFloat16Vector(t *testing.T) { + rand.Seed(time.Now().UnixNano()) + columnName := fmt.Sprintf("column_Float16Vector_%d", rand.Int()) + columnLen := 12 + rand.Intn(10) + dim := ([]int{64, 128, 256, 512})[rand.Intn(4)] + + v := make([][]byte, 0, columnLen) + dlen := dim + + dlen *= 2 + + for i := 0; i < columnLen; i++ { + entry := make([]byte, dlen) + v = append(v, entry) + } + column := NewColumnFloat16Vector(columnName, dim, v) + + t.Run("test meta", func(t *testing.T) { + ft := entity.FieldTypeFloat16Vector + assert.Equal(t, "Float16Vector", ft.Name()) + assert.Equal(t, "[]byte", ft.String()) + pbName, pbType := ft.PbFieldType() + assert.Equal(t, "[]byte", pbName) + assert.Equal(t, "", pbType) + }) + + t.Run("test column attribute", func(t *testing.T) { + assert.Equal(t, columnName, column.Name()) + assert.Equal(t, entity.FieldTypeFloat16Vector, column.Type()) + assert.Equal(t, columnLen, column.Len()) + assert.Equal(t, dim, column.Dim()) + assert.Equal(t, v, column.Data()) + + var ev []byte + err := column.AppendValue(ev) + assert.Equal(t, columnLen+1, column.Len()) + assert.Nil(t, err) + + err = column.AppendValue(struct{}{}) + assert.Equal(t, columnLen+1, column.Len()) + assert.NotNil(t, err) + }) + + t.Run("test column field data", func(t *testing.T) { + fd := column.FieldData() + assert.NotNil(t, fd) + assert.Equal(t, fd.GetFieldName(), columnName) + + c, err := FieldDataVector(fd) + assert.NotNil(t, c) + assert.NoError(t, err) + }) + + t.Run("test column field data error", func(t *testing.T) { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_Float16Vector, + FieldName: columnName, + } + _, err := FieldDataVector(fd) + assert.Error(t, err) + }) +} + +func TestColumnBFloat16Vector(t *testing.T) { + rand.Seed(time.Now().UnixNano()) + columnName := fmt.Sprintf("column_BFloat16Vector_%d", rand.Int()) + columnLen := 12 + rand.Intn(10) + dim := ([]int{64, 128, 256, 512})[rand.Intn(4)] + + v := make([][]byte, 0, columnLen) + dlen := dim + + dlen *= 2 + + for i := 0; i < columnLen; i++ { + entry := make([]byte, dlen) + v = append(v, entry) + } + column := NewColumnBFloat16Vector(columnName, dim, v) + + t.Run("test meta", func(t *testing.T) { + ft := entity.FieldTypeBFloat16Vector + assert.Equal(t, "BFloat16Vector", ft.Name()) + assert.Equal(t, "[]byte", ft.String()) + pbName, pbType := ft.PbFieldType() + assert.Equal(t, "[]byte", pbName) + assert.Equal(t, "", pbType) + }) + + t.Run("test column attribute", func(t *testing.T) { + assert.Equal(t, columnName, column.Name()) + assert.Equal(t, entity.FieldTypeBFloat16Vector, column.Type()) + assert.Equal(t, columnLen, column.Len()) + assert.Equal(t, dim, column.Dim()) + assert.Equal(t, v, column.Data()) + + var ev []byte + err := column.AppendValue(ev) + assert.Equal(t, columnLen+1, column.Len()) + assert.Nil(t, err) + + err = column.AppendValue(struct{}{}) + assert.Equal(t, columnLen+1, column.Len()) + assert.NotNil(t, err) + }) + + t.Run("test column field data", func(t *testing.T) { + fd := column.FieldData() + assert.NotNil(t, fd) + assert.Equal(t, fd.GetFieldName(), columnName) + + c, err := FieldDataVector(fd) + assert.NotNil(t, c) + assert.NoError(t, err) + }) + + t.Run("test column field data error", func(t *testing.T) { + fd := &schemapb.FieldData{ + Type: schemapb.DataType_BFloat16Vector, + FieldName: columnName, + } + _, err := FieldDataVector(fd) + assert.Error(t, err) + }) +} diff --git a/client/common.go b/client/common.go new file mode 100644 index 0000000000000..91987eea95c46 --- /dev/null +++ b/client/common.go @@ -0,0 +1,44 @@ +package client + +import ( + "context" + + "github.com/milvus-io/milvus/client/v2/entity" + "github.com/milvus-io/milvus/pkg/util/conc" + "github.com/milvus-io/milvus/pkg/util/typeutil" +) + +// CollectionCache stores the cached collection schema information. +type CollectionCache struct { + sf conc.Singleflight[*entity.Collection] + collections *typeutil.ConcurrentMap[string, *entity.Collection] + fetcher func(context.Context, string) (*entity.Collection, error) +} + +func (c *CollectionCache) GetCollection(ctx context.Context, collName string) (*entity.Collection, error) { + coll, ok := c.collections.Get(collName) + if ok { + return coll, nil + } + + coll, err, _ := c.sf.Do(collName, func() (*entity.Collection, error) { + coll, err := c.fetcher(ctx, collName) + if err != nil { + return nil, err + } + c.collections.Insert(collName, coll) + return coll, nil + }) + return coll, err +} + +func NewCollectionCache(fetcher func(context.Context, string) (*entity.Collection, error)) *CollectionCache { + return &CollectionCache{ + collections: typeutil.NewConcurrentMap[string, *entity.Collection](), + fetcher: fetcher, + } +} + +func (c *Client) getCollection(ctx context.Context, collName string) (*entity.Collection, error) { + return c.collCache.GetCollection(ctx, collName) +} diff --git a/client/common/version.go b/client/common/version.go new file mode 100644 index 0000000000000..e348e74d8df72 --- /dev/null +++ b/client/common/version.go @@ -0,0 +1,22 @@ +// 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 common + +const ( + // SDKVersion const value for current version + SDKVersion = `2.4.0-dev` +) diff --git a/client/common/version_test.go b/client/common/version_test.go new file mode 100644 index 0000000000000..a9c380b242873 --- /dev/null +++ b/client/common/version_test.go @@ -0,0 +1,29 @@ +// 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 common + +import ( + "testing" + + "github.com/blang/semver/v4" + "github.com/stretchr/testify/assert" +) + +func TestVersion(t *testing.T) { + _, err := semver.Parse(SDKVersion) + assert.NoError(t, err) +} diff --git a/client/database.go b/client/database.go new file mode 100644 index 0000000000000..cd372ab911b54 --- /dev/null +++ b/client/database.go @@ -0,0 +1,60 @@ +// 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 client + +import ( + "context" + + "google.golang.org/grpc" + + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus/pkg/util/merr" +) + +func (c *Client) ListDatabase(ctx context.Context, option ListDatabaseOption, callOptions ...grpc.CallOption) (databaseNames []string, err error) { + req := option.Request() + + err = c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.ListDatabases(ctx, req, callOptions...) + err = merr.CheckRPCCall(resp, err) + if err != nil { + return err + } + databaseNames = resp.GetDbNames() + return nil + }) + + return databaseNames, err +} + +func (c *Client) CreateDatabase(ctx context.Context, option CreateDatabaseOption, callOptions ...grpc.CallOption) error { + req := option.Request() + + return c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.CreateDatabase(ctx, req, callOptions...) + return merr.CheckRPCCall(resp, err) + }) +} + +func (c *Client) DropDatabase(ctx context.Context, option DropDatabaseOption, callOptions ...grpc.CallOption) error { + req := option.Request() + + return c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.DropDatabase(ctx, req, callOptions...) + return merr.CheckRPCCall(resp, err) + }) +} diff --git a/client/database_options.go b/client/database_options.go new file mode 100644 index 0000000000000..3fb26d91de9d8 --- /dev/null +++ b/client/database_options.go @@ -0,0 +1,74 @@ +// 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 client + +import "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + +// ListDatabaseOption is a builder interface for ListDatabase request. +type ListDatabaseOption interface { + Request() *milvuspb.ListDatabasesRequest +} + +type listDatabaseOption struct{} + +func (opt *listDatabaseOption) Request() *milvuspb.ListDatabasesRequest { + return &milvuspb.ListDatabasesRequest{} +} + +func NewListDatabaseOption() *listDatabaseOption { + return &listDatabaseOption{} +} + +type CreateDatabaseOption interface { + Request() *milvuspb.CreateDatabaseRequest +} + +type createDatabaseOption struct { + dbName string +} + +func (opt *createDatabaseOption) Request() *milvuspb.CreateDatabaseRequest { + return &milvuspb.CreateDatabaseRequest{ + DbName: opt.dbName, + } +} + +func NewCreateDatabaseOption(dbName string) *createDatabaseOption { + return &createDatabaseOption{ + dbName: dbName, + } +} + +type DropDatabaseOption interface { + Request() *milvuspb.DropDatabaseRequest +} + +type dropDatabaseOption struct { + dbName string +} + +func (opt *dropDatabaseOption) Request() *milvuspb.DropDatabaseRequest { + return &milvuspb.DropDatabaseRequest{ + DbName: opt.dbName, + } +} + +func NewDropDatabaseOption(dbName string) *dropDatabaseOption { + return &dropDatabaseOption{ + dbName: dbName, + } +} diff --git a/client/database_test.go b/client/database_test.go new file mode 100644 index 0000000000000..f46a0cafb8b7b --- /dev/null +++ b/client/database_test.go @@ -0,0 +1,92 @@ +package client + +import ( + "context" + "fmt" + "testing" + + "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus/pkg/util/merr" + mock "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/suite" +) + +type DatabaseSuite struct { + MockSuiteBase +} + +func (s *DatabaseSuite) TestListDatabases() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + s.Run("success", func() { + s.mock.EXPECT().ListDatabases(mock.Anything, mock.Anything).Return(&milvuspb.ListDatabasesResponse{ + Status: merr.Success(), + DbNames: []string{"default", "db1"}, + }, nil).Once() + + names, err := s.client.ListDatabase(ctx, NewListDatabaseOption()) + s.NoError(err) + s.ElementsMatch([]string{"default", "db1"}, names) + }) + + s.Run("failure", func() { + s.mock.EXPECT().ListDatabases(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + _, err := s.client.ListDatabase(ctx, NewListDatabaseOption()) + s.Error(err) + }) +} + +func (s *DatabaseSuite) TestCreateDatabase() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + s.Run("success", func() { + dbName := fmt.Sprintf("dt_%s", s.randString(6)) + s.mock.EXPECT().CreateDatabase(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, cdr *milvuspb.CreateDatabaseRequest) (*commonpb.Status, error) { + s.Equal(dbName, cdr.GetDbName()) + return merr.Success(), nil + }).Once() + + err := s.client.CreateDatabase(ctx, NewCreateDatabaseOption(dbName)) + s.NoError(err) + }) + + s.Run("failure", func() { + dbName := fmt.Sprintf("dt_%s", s.randString(6)) + s.mock.EXPECT().CreateDatabase(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + err := s.client.CreateDatabase(ctx, NewCreateDatabaseOption(dbName)) + s.Error(err) + }) +} + +func (s *DatabaseSuite) TestDropDatabase() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + s.Run("success", func() { + dbName := fmt.Sprintf("dt_%s", s.randString(6)) + s.mock.EXPECT().DropDatabase(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, ddr *milvuspb.DropDatabaseRequest) (*commonpb.Status, error) { + s.Equal(dbName, ddr.GetDbName()) + return merr.Success(), nil + }).Once() + + err := s.client.DropDatabase(ctx, NewDropDatabaseOption(dbName)) + s.NoError(err) + }) + + s.Run("failure", func() { + dbName := fmt.Sprintf("dt_%s", s.randString(6)) + s.mock.EXPECT().DropDatabase(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + err := s.client.DropDatabase(ctx, NewDropDatabaseOption(dbName)) + s.Error(err) + }) +} + +func TestDatabase(t *testing.T) { + suite.Run(t, new(DatabaseSuite)) +} diff --git a/client/doc.go b/client/doc.go new file mode 100644 index 0000000000000..1f0d2f80ed624 --- /dev/null +++ b/client/doc.go @@ -0,0 +1,18 @@ +// 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 milvusclient implements the official Go Milvus client for v2. +package client diff --git a/client/entity/collection.go b/client/entity/collection.go new file mode 100644 index 0000000000000..72d86a8ecbc24 --- /dev/null +++ b/client/entity/collection.go @@ -0,0 +1,56 @@ +// 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 entity + +// DefaultShardNumber const value for using Milvus default shard number. +const DefaultShardNumber int32 = 0 + +// DefaultConsistencyLevel const value for using Milvus default consistency level setting. +const DefaultConsistencyLevel ConsistencyLevel = ClBounded + +// Collection represent collection meta in Milvus +type Collection struct { + ID int64 // collection id + Name string // collection name + Schema *Schema // collection schema, with fields schema and primary key definition + PhysicalChannels []string + VirtualChannels []string + Loaded bool + ConsistencyLevel ConsistencyLevel + ShardNum int32 +} + +// Partition represent partition meta in Milvus +type Partition struct { + ID int64 // partition id + Name string // partition name + Loaded bool // partition loaded +} + +// ReplicaGroup represents a replica group +type ReplicaGroup struct { + ReplicaID int64 + NodeIDs []int64 + ShardReplicas []*ShardReplica +} + +// ShardReplica represents a shard in the ReplicaGroup +type ShardReplica struct { + LeaderID int64 + NodesIDs []int64 + DmChannelName string +} diff --git a/client/entity/collection_attr.go b/client/entity/collection_attr.go new file mode 100644 index 0000000000000..768bd1eb4f37f --- /dev/null +++ b/client/entity/collection_attr.go @@ -0,0 +1,96 @@ +// 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 entity + +import ( + "strconv" + + "github.com/cockroachdb/errors" +) + +const ( + // cakTTL const for collection attribute key TTL in seconds. + cakTTL = `collection.ttl.seconds` + // cakAutoCompaction const for collection attribute key autom compaction enabled. + cakAutoCompaction = `collection.autocompaction.enabled` +) + +// CollectionAttribute is the interface for altering collection attributes. +type CollectionAttribute interface { + KeyValue() (string, string) + Valid() error +} + +type collAttrBase struct { + key string + value string +} + +// KeyValue implements CollectionAttribute. +func (ca collAttrBase) KeyValue() (string, string) { + return ca.key, ca.value +} + +type ttlCollAttr struct { + collAttrBase +} + +// Valid implements CollectionAttribute. +// checks ttl seconds is valid positive integer. +func (ca collAttrBase) Valid() error { + val, err := strconv.ParseInt(ca.value, 10, 64) + if err != nil { + return errors.Wrap(err, "ttl is not a valid positive integer") + } + + if val < 0 { + return errors.New("ttl needs to be a positive integer") + } + + return nil +} + +// CollectionTTL returns collection attribute to set collection ttl in seconds. +func CollectionTTL(ttl int64) ttlCollAttr { + ca := ttlCollAttr{} + ca.key = cakTTL + ca.value = strconv.FormatInt(ttl, 10) + return ca +} + +type autoCompactionCollAttr struct { + collAttrBase +} + +// Valid implements CollectionAttribute. +// checks collection auto compaction is valid bool. +func (ca autoCompactionCollAttr) Valid() error { + _, err := strconv.ParseBool(ca.value) + if err != nil { + return errors.Wrap(err, "auto compaction setting is not valid boolean") + } + + return nil +} + +// CollectionAutoCompactionEnabled returns collection attribute to set collection auto compaction enabled. +func CollectionAutoCompactionEnabled(enabled bool) autoCompactionCollAttr { + ca := autoCompactionCollAttr{} + ca.key = cakAutoCompaction + ca.value = strconv.FormatBool(enabled) + return ca +} diff --git a/client/entity/collection_attr_test.go b/client/entity/collection_attr_test.go new file mode 100644 index 0000000000000..32ed17c33c402 --- /dev/null +++ b/client/entity/collection_attr_test.go @@ -0,0 +1,136 @@ +// 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 entity + +import ( + "fmt" + "strconv" + "testing" + + "github.com/stretchr/testify/suite" +) + +type CollectionTTLSuite struct { + suite.Suite +} + +func (s *CollectionTTLSuite) TestValid() { + type testCase struct { + input string + expectErr bool + } + + cases := []testCase{ + {input: "a", expectErr: true}, + {input: "1000", expectErr: false}, + {input: "0", expectErr: false}, + {input: "-10", expectErr: true}, + } + + for _, tc := range cases { + s.Run(tc.input, func() { + ca := ttlCollAttr{} + ca.value = tc.input + err := ca.Valid() + if tc.expectErr { + s.Error(err) + } else { + s.NoError(err) + } + }) + } +} + +func (s *CollectionTTLSuite) TestCollectionTTL() { + type testCase struct { + input int64 + expectErr bool + } + + cases := []testCase{ + {input: 1000, expectErr: false}, + {input: 0, expectErr: false}, + {input: -10, expectErr: true}, + } + + for _, tc := range cases { + s.Run(fmt.Sprintf("%d", tc.input), func() { + ca := CollectionTTL(tc.input) + key, value := ca.KeyValue() + s.Equal(cakTTL, key) + s.Equal(strconv.FormatInt(tc.input, 10), value) + err := ca.Valid() + if tc.expectErr { + s.Error(err) + } else { + s.NoError(err) + } + }) + } +} + +func TestCollectionTTL(t *testing.T) { + suite.Run(t, new(CollectionTTLSuite)) +} + +type CollectionAutoCompactionSuite struct { + suite.Suite +} + +func (s *CollectionAutoCompactionSuite) TestValid() { + type testCase struct { + input string + expectErr bool + } + + cases := []testCase{ + {input: "a", expectErr: true}, + {input: "true", expectErr: false}, + {input: "false", expectErr: false}, + {input: "", expectErr: true}, + } + + for _, tc := range cases { + s.Run(tc.input, func() { + ca := autoCompactionCollAttr{} + ca.value = tc.input + err := ca.Valid() + if tc.expectErr { + s.Error(err) + } else { + s.NoError(err) + } + }) + } +} + +func (s *CollectionAutoCompactionSuite) TestCollectionAutoCompactionEnabled() { + cases := []bool{true, false} + + for _, tc := range cases { + s.Run(fmt.Sprintf("%v", tc), func() { + ca := CollectionAutoCompactionEnabled(tc) + key, value := ca.KeyValue() + s.Equal(cakAutoCompaction, key) + s.Equal(strconv.FormatBool(tc), value) + }) + } +} + +func TestCollectionAutoCompaction(t *testing.T) { + suite.Run(t, new(CollectionAutoCompactionSuite)) +} diff --git a/client/entity/common.go b/client/entity/common.go new file mode 100644 index 0000000000000..2de5ee3918055 --- /dev/null +++ b/client/entity/common.go @@ -0,0 +1,32 @@ +// 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 entity + +// MetricType metric type +type MetricType string + +// Metric Constants +const ( + L2 MetricType = "L2" + IP MetricType = "IP" + COSINE MetricType = "COSINE" + HAMMING MetricType = "HAMMING" + JACCARD MetricType = "JACCARD" + TANIMOTO MetricType = "TANIMOTO" + SUBSTRUCTURE MetricType = "SUBSTRUCTURE" + SUPERSTRUCTURE MetricType = "SUPERSTRUCTURE" +) diff --git a/client/entity/field_type.go b/client/entity/field_type.go new file mode 100644 index 0000000000000..9c96aa20ae015 --- /dev/null +++ b/client/entity/field_type.go @@ -0,0 +1,171 @@ +// 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 entity + +// FieldType field data type alias type +// used in go:generate trick, DO NOT modify names & string +type FieldType int32 + +// Name returns field type name +func (t FieldType) Name() string { + switch t { + case FieldTypeBool: + return "Bool" + case FieldTypeInt8: + return "Int8" + case FieldTypeInt16: + return "Int16" + case FieldTypeInt32: + return "Int32" + case FieldTypeInt64: + return "Int64" + case FieldTypeFloat: + return "Float" + case FieldTypeDouble: + return "Double" + case FieldTypeString: + return "String" + case FieldTypeVarChar: + return "VarChar" + case FieldTypeArray: + return "Array" + case FieldTypeJSON: + return "JSON" + case FieldTypeBinaryVector: + return "BinaryVector" + case FieldTypeFloatVector: + return "FloatVector" + case FieldTypeFloat16Vector: + return "Float16Vector" + case FieldTypeBFloat16Vector: + return "BFloat16Vector" + default: + return "undefined" + } +} + +// String returns field type +func (t FieldType) String() string { + switch t { + case FieldTypeBool: + return "bool" + case FieldTypeInt8: + return "int8" + case FieldTypeInt16: + return "int16" + case FieldTypeInt32: + return "int32" + case FieldTypeInt64: + return "int64" + case FieldTypeFloat: + return "float32" + case FieldTypeDouble: + return "float64" + case FieldTypeString: + return "string" + case FieldTypeVarChar: + return "string" + case FieldTypeArray: + return "Array" + case FieldTypeJSON: + return "JSON" + case FieldTypeBinaryVector: + return "[]byte" + case FieldTypeFloatVector: + return "[]float32" + case FieldTypeFloat16Vector: + return "[]byte" + case FieldTypeBFloat16Vector: + return "[]byte" + default: + return "undefined" + } +} + +// PbFieldType represents FieldType corresponding schema pb type +func (t FieldType) PbFieldType() (string, string) { + switch t { + case FieldTypeBool: + return "Bool", "bool" + case FieldTypeInt8: + fallthrough + case FieldTypeInt16: + fallthrough + case FieldTypeInt32: + return "Int", "int32" + case FieldTypeInt64: + return "Long", "int64" + case FieldTypeFloat: + return "Float", "float32" + case FieldTypeDouble: + return "Double", "float64" + case FieldTypeString: + return "String", "string" + case FieldTypeVarChar: + return "VarChar", "string" + case FieldTypeJSON: + return "JSON", "JSON" + case FieldTypeBinaryVector: + return "[]byte", "" + case FieldTypeFloatVector: + return "[]float32", "" + case FieldTypeFloat16Vector: + return "[]byte", "" + case FieldTypeBFloat16Vector: + return "[]byte", "" + default: + return "undefined", "" + } +} + +// Match schema definition +const ( + // FieldTypeNone zero value place holder + FieldTypeNone FieldType = 0 // zero value place holder + // FieldTypeBool field type boolean + FieldTypeBool FieldType = 1 + // FieldTypeInt8 field type int8 + FieldTypeInt8 FieldType = 2 + // FieldTypeInt16 field type int16 + FieldTypeInt16 FieldType = 3 + // FieldTypeInt32 field type int32 + FieldTypeInt32 FieldType = 4 + // FieldTypeInt64 field type int64 + FieldTypeInt64 FieldType = 5 + // FieldTypeFloat field type float + FieldTypeFloat FieldType = 10 + // FieldTypeDouble field type double + FieldTypeDouble FieldType = 11 + // FieldTypeString field type string + FieldTypeString FieldType = 20 + // FieldTypeVarChar field type varchar + FieldTypeVarChar FieldType = 21 // variable-length strings with a specified maximum length + // FieldTypeArray field type Array + FieldTypeArray FieldType = 22 + // FieldTypeJSON field type JSON + FieldTypeJSON FieldType = 23 + // FieldTypeBinaryVector field type binary vector + FieldTypeBinaryVector FieldType = 100 + // FieldTypeFloatVector field type float vector + FieldTypeFloatVector FieldType = 101 + // FieldTypeBinaryVector field type float16 vector + FieldTypeFloat16Vector FieldType = 102 + // FieldTypeBinaryVector field type bf16 vector + FieldTypeBFloat16Vector FieldType = 103 + // FieldTypeBinaryVector field type sparse vector + FieldTypeSparseVector FieldType = 104 +) diff --git a/client/entity/schema.go b/client/entity/schema.go new file mode 100644 index 0000000000000..4434969578ae4 --- /dev/null +++ b/client/entity/schema.go @@ -0,0 +1,341 @@ +// 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 entity + +import ( + "strconv" + + "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" +) + +const ( + // TypeParamDim is the const for field type param dimension + TypeParamDim = "dim" + + // TypeParamMaxLength is the const for varchar type maximal length + TypeParamMaxLength = "max_length" + + // TypeParamMaxCapacity is the const for array type max capacity + TypeParamMaxCapacity = `max_capacity` + + // ClStrong strong consistency level + ClStrong ConsistencyLevel = ConsistencyLevel(commonpb.ConsistencyLevel_Strong) + // ClBounded bounded consistency level with default tolerance of 5 seconds + ClBounded ConsistencyLevel = ConsistencyLevel(commonpb.ConsistencyLevel_Bounded) + // ClSession session consistency level + ClSession ConsistencyLevel = ConsistencyLevel(commonpb.ConsistencyLevel_Session) + // ClEvenually eventually consistency level + ClEventually ConsistencyLevel = ConsistencyLevel(commonpb.ConsistencyLevel_Eventually) + // ClCustomized customized consistency level and users pass their own `guarantee_timestamp`. + ClCustomized ConsistencyLevel = ConsistencyLevel(commonpb.ConsistencyLevel_Customized) +) + +// ConsistencyLevel enum type for collection Consistency Level +type ConsistencyLevel commonpb.ConsistencyLevel + +// CommonConsistencyLevel returns corresponding commonpb.ConsistencyLevel +func (cl ConsistencyLevel) CommonConsistencyLevel() commonpb.ConsistencyLevel { + return commonpb.ConsistencyLevel(cl) +} + +// Schema represents schema info of collection in milvus +type Schema struct { + CollectionName string + Description string + AutoID bool + Fields []*Field + EnableDynamicField bool +} + +// NewSchema creates an empty schema object. +func NewSchema() *Schema { + return &Schema{} +} + +// WithName sets the name value of schema, returns schema itself. +func (s *Schema) WithName(name string) *Schema { + s.CollectionName = name + return s +} + +// WithDescription sets the description value of schema, returns schema itself. +func (s *Schema) WithDescription(desc string) *Schema { + s.Description = desc + return s +} + +func (s *Schema) WithAutoID(autoID bool) *Schema { + s.AutoID = autoID + return s +} + +func (s *Schema) WithDynamicFieldEnabled(dynamicEnabled bool) *Schema { + s.EnableDynamicField = dynamicEnabled + return s +} + +// WithField adds a field into schema and returns schema itself. +func (s *Schema) WithField(f *Field) *Schema { + s.Fields = append(s.Fields, f) + return s +} + +// ProtoMessage returns corresponding server.CollectionSchema +func (s *Schema) ProtoMessage() *schemapb.CollectionSchema { + r := &schemapb.CollectionSchema{ + Name: s.CollectionName, + Description: s.Description, + AutoID: s.AutoID, + EnableDynamicField: s.EnableDynamicField, + } + r.Fields = make([]*schemapb.FieldSchema, 0, len(s.Fields)) + for _, field := range s.Fields { + r.Fields = append(r.Fields, field.ProtoMessage()) + } + return r +} + +// ReadProto parses proto Collection Schema +func (s *Schema) ReadProto(p *schemapb.CollectionSchema) *Schema { + s.Description = p.GetDescription() + s.CollectionName = p.GetName() + s.Fields = make([]*Field, 0, len(p.GetFields())) + for _, fp := range p.GetFields() { + if fp.GetAutoID() { + s.AutoID = true + } + s.Fields = append(s.Fields, NewField().ReadProto(fp)) + } + s.EnableDynamicField = p.GetEnableDynamicField() + return s +} + +// PKFieldName returns pk field name for this schemapb. +func (s *Schema) PKFieldName() string { + for _, field := range s.Fields { + if field.PrimaryKey { + return field.Name + } + } + return "" +} + +// Field represent field schema in milvus +type Field struct { + ID int64 // field id, generated when collection is created, input value is ignored + Name string // field name + PrimaryKey bool // is primary key + AutoID bool // is auto id + Description string + DataType FieldType + TypeParams map[string]string + IndexParams map[string]string + IsDynamic bool + IsPartitionKey bool + ElementType FieldType +} + +// ProtoMessage generates corresponding FieldSchema +func (f *Field) ProtoMessage() *schemapb.FieldSchema { + return &schemapb.FieldSchema{ + FieldID: f.ID, + Name: f.Name, + Description: f.Description, + IsPrimaryKey: f.PrimaryKey, + AutoID: f.AutoID, + DataType: schemapb.DataType(f.DataType), + TypeParams: MapKvPairs(f.TypeParams), + IndexParams: MapKvPairs(f.IndexParams), + IsDynamic: f.IsDynamic, + IsPartitionKey: f.IsPartitionKey, + ElementType: schemapb.DataType(f.ElementType), + } +} + +// NewField creates a new Field with map initialized. +func NewField() *Field { + return &Field{ + TypeParams: make(map[string]string), + IndexParams: make(map[string]string), + } +} + +func (f *Field) WithName(name string) *Field { + f.Name = name + return f +} + +func (f *Field) WithDescription(desc string) *Field { + f.Description = desc + return f +} + +func (f *Field) WithDataType(dataType FieldType) *Field { + f.DataType = dataType + return f +} + +func (f *Field) WithIsPrimaryKey(isPrimaryKey bool) *Field { + f.PrimaryKey = isPrimaryKey + return f +} + +func (f *Field) WithIsAutoID(isAutoID bool) *Field { + f.AutoID = isAutoID + return f +} + +func (f *Field) WithIsDynamic(isDynamic bool) *Field { + f.IsDynamic = isDynamic + return f +} + +func (f *Field) WithIsPartitionKey(isPartitionKey bool) *Field { + f.IsPartitionKey = isPartitionKey + return f +} + +/* +func (f *Field) WithDefaultValueBool(defaultValue bool) *Field { + f.DefaultValue = &schemapb.ValueField{ + Data: &schemapb.ValueField_BoolData{ + BoolData: defaultValue, + }, + } + return f +} + +func (f *Field) WithDefaultValueInt(defaultValue int32) *Field { + f.DefaultValue = &schemapb.ValueField{ + Data: &schemapb.ValueField_IntData{ + IntData: defaultValue, + }, + } + return f +} + +func (f *Field) WithDefaultValueLong(defaultValue int64) *Field { + f.DefaultValue = &schemapb.ValueField{ + Data: &schemapb.ValueField_LongData{ + LongData: defaultValue, + }, + } + return f +} + +func (f *Field) WithDefaultValueFloat(defaultValue float32) *Field { + f.DefaultValue = &schemapb.ValueField{ + Data: &schemapb.ValueField_FloatData{ + FloatData: defaultValue, + }, + } + return f +} + +func (f *Field) WithDefaultValueDouble(defaultValue float64) *Field { + f.DefaultValue = &schemapb.ValueField{ + Data: &schemapb.ValueField_DoubleData{ + DoubleData: defaultValue, + }, + } + return f +} + +func (f *Field) WithDefaultValueString(defaultValue string) *Field { + f.DefaultValue = &schemapb.ValueField{ + Data: &schemapb.ValueField_StringData{ + StringData: defaultValue, + }, + } + return f +}*/ + +func (f *Field) WithTypeParams(key string, value string) *Field { + if f.TypeParams == nil { + f.TypeParams = make(map[string]string) + } + f.TypeParams[key] = value + return f +} + +func (f *Field) WithDim(dim int64) *Field { + if f.TypeParams == nil { + f.TypeParams = make(map[string]string) + } + f.TypeParams[TypeParamDim] = strconv.FormatInt(dim, 10) + return f +} + +func (f *Field) WithMaxLength(maxLen int64) *Field { + if f.TypeParams == nil { + f.TypeParams = make(map[string]string) + } + f.TypeParams[TypeParamMaxLength] = strconv.FormatInt(maxLen, 10) + return f +} + +func (f *Field) WithElementType(eleType FieldType) *Field { + f.ElementType = eleType + return f +} + +func (f *Field) WithMaxCapacity(maxCap int64) *Field { + if f.TypeParams == nil { + f.TypeParams = make(map[string]string) + } + f.TypeParams[TypeParamMaxCapacity] = strconv.FormatInt(maxCap, 10) + return f +} + +// ReadProto parses FieldSchema +func (f *Field) ReadProto(p *schemapb.FieldSchema) *Field { + f.ID = p.GetFieldID() + f.Name = p.GetName() + f.PrimaryKey = p.GetIsPrimaryKey() + f.AutoID = p.GetAutoID() + f.Description = p.GetDescription() + f.DataType = FieldType(p.GetDataType()) + f.TypeParams = KvPairsMap(p.GetTypeParams()) + f.IndexParams = KvPairsMap(p.GetIndexParams()) + f.IsDynamic = p.GetIsDynamic() + f.IsPartitionKey = p.GetIsPartitionKey() + f.ElementType = FieldType(p.GetElementType()) + + return f +} + +// MapKvPairs converts map into commonpb.KeyValuePair slice +func MapKvPairs(m map[string]string) []*commonpb.KeyValuePair { + pairs := make([]*commonpb.KeyValuePair, 0, len(m)) + for k, v := range m { + pairs = append(pairs, &commonpb.KeyValuePair{ + Key: k, + Value: v, + }) + } + return pairs +} + +// KvPairsMap converts commonpb.KeyValuePair slices into map +func KvPairsMap(kvps []*commonpb.KeyValuePair) map[string]string { + m := make(map[string]string) + for _, kvp := range kvps { + m[kvp.Key] = kvp.Value + } + return m +} diff --git a/client/entity/schema_test.go b/client/entity/schema_test.go new file mode 100644 index 0000000000000..4f32f5b68a3a3 --- /dev/null +++ b/client/entity/schema_test.go @@ -0,0 +1,138 @@ +// 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 entity + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/suite" + + "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" +) + +func TestCL_CommonCL(t *testing.T) { + cls := []ConsistencyLevel{ + ClStrong, + ClBounded, + ClSession, + ClEventually, + } + for _, cl := range cls { + assert.EqualValues(t, commonpb.ConsistencyLevel(cl), cl.CommonConsistencyLevel()) + } +} + +func TestFieldSchema(t *testing.T) { + fields := []*Field{ + NewField().WithName("int_field").WithDataType(FieldTypeInt64).WithIsAutoID(true).WithIsPrimaryKey(true).WithDescription("int_field desc"), + NewField().WithName("string_field").WithDataType(FieldTypeString).WithIsAutoID(false).WithIsPrimaryKey(true).WithIsDynamic(false).WithTypeParams("max_len", "32").WithDescription("string_field desc"), + NewField().WithName("partition_key").WithDataType(FieldTypeInt32).WithIsPartitionKey(true), + NewField().WithName("array_field").WithDataType(FieldTypeArray).WithElementType(FieldTypeBool).WithMaxCapacity(128), + /* + NewField().WithName("default_value_bool").WithDataType(FieldTypeBool).WithDefaultValueBool(true), + NewField().WithName("default_value_int").WithDataType(FieldTypeInt32).WithDefaultValueInt(1), + NewField().WithName("default_value_long").WithDataType(FieldTypeInt64).WithDefaultValueLong(1), + NewField().WithName("default_value_float").WithDataType(FieldTypeFloat).WithDefaultValueFloat(1), + NewField().WithName("default_value_double").WithDataType(FieldTypeDouble).WithDefaultValueDouble(1), + NewField().WithName("default_value_string").WithDataType(FieldTypeString).WithDefaultValueString("a"),*/ + } + + for _, field := range fields { + fieldSchema := field.ProtoMessage() + assert.Equal(t, field.ID, fieldSchema.GetFieldID()) + assert.Equal(t, field.Name, fieldSchema.GetName()) + assert.EqualValues(t, field.DataType, fieldSchema.GetDataType()) + assert.Equal(t, field.AutoID, fieldSchema.GetAutoID()) + assert.Equal(t, field.PrimaryKey, fieldSchema.GetIsPrimaryKey()) + assert.Equal(t, field.IsPartitionKey, fieldSchema.GetIsPartitionKey()) + assert.Equal(t, field.IsDynamic, fieldSchema.GetIsDynamic()) + assert.Equal(t, field.Description, fieldSchema.GetDescription()) + assert.Equal(t, field.TypeParams, KvPairsMap(fieldSchema.GetTypeParams())) + assert.EqualValues(t, field.ElementType, fieldSchema.GetElementType()) + // marshal & unmarshal, still equals + nf := &Field{} + nf = nf.ReadProto(fieldSchema) + assert.Equal(t, field.ID, nf.ID) + assert.Equal(t, field.Name, nf.Name) + assert.EqualValues(t, field.DataType, nf.DataType) + assert.Equal(t, field.AutoID, nf.AutoID) + assert.Equal(t, field.PrimaryKey, nf.PrimaryKey) + assert.Equal(t, field.Description, nf.Description) + assert.Equal(t, field.IsDynamic, nf.IsDynamic) + assert.Equal(t, field.IsPartitionKey, nf.IsPartitionKey) + assert.EqualValues(t, field.TypeParams, nf.TypeParams) + assert.EqualValues(t, field.ElementType, nf.ElementType) + } + + assert.NotPanics(t, func() { + (&Field{}).WithTypeParams("a", "b") + }) +} + +type SchemaSuite struct { + suite.Suite +} + +func (s *SchemaSuite) TestBasic() { + cases := []struct { + tag string + input *Schema + pkName string + }{ + { + "test_collection", + NewSchema().WithName("test_collection_1").WithDescription("test_collection_1 desc").WithAutoID(false). + WithField(NewField().WithName("ID").WithDataType(FieldTypeInt64).WithIsPrimaryKey(true)). + WithField(NewField().WithName("vector").WithDataType(FieldTypeFloatVector).WithDim(128)), + "ID", + }, + { + "dynamic_schema", + NewSchema().WithName("dynamic_schema").WithDescription("dynamic_schema desc").WithAutoID(true).WithDynamicFieldEnabled(true). + WithField(NewField().WithName("ID").WithDataType(FieldTypeVarChar).WithMaxLength(256)). + WithField(NewField().WithName("$meta").WithIsDynamic(true)), + "", + }, + } + + for _, c := range cases { + s.Run(c.tag, func() { + sch := c.input + p := sch.ProtoMessage() + s.Equal(sch.CollectionName, p.GetName()) + s.Equal(sch.AutoID, p.GetAutoID()) + s.Equal(sch.Description, p.GetDescription()) + s.Equal(sch.EnableDynamicField, p.GetEnableDynamicField()) + s.Equal(len(sch.Fields), len(p.GetFields())) + + nsch := &Schema{} + nsch = nsch.ReadProto(p) + + s.Equal(sch.CollectionName, nsch.CollectionName) + s.Equal(sch.Description, nsch.Description) + s.Equal(sch.EnableDynamicField, nsch.EnableDynamicField) + s.Equal(len(sch.Fields), len(nsch.Fields)) + s.Equal(c.pkName, sch.PKFieldName()) + s.Equal(c.pkName, nsch.PKFieldName()) + }) + } +} + +func TestSchema(t *testing.T) { + suite.Run(t, new(SchemaSuite)) +} diff --git a/client/entity/sparse.go b/client/entity/sparse.go new file mode 100644 index 0000000000000..00f41c60d355e --- /dev/null +++ b/client/entity/sparse.go @@ -0,0 +1,124 @@ +// 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 entity + +import ( + "encoding/binary" + "math" + "sort" + + "github.com/cockroachdb/errors" +) + +type SparseEmbedding interface { + Dim() int // the dimension + Len() int // the actual items in this vector + Get(idx int) (pos uint32, value float32, ok bool) + Serialize() []byte +} + +var ( + _ SparseEmbedding = sliceSparseEmbedding{} + _ Vector = sliceSparseEmbedding{} +) + +type sliceSparseEmbedding struct { + positions []uint32 + values []float32 + dim int + len int +} + +func (e sliceSparseEmbedding) Dim() int { + return e.dim +} + +func (e sliceSparseEmbedding) Len() int { + return e.len +} + +func (e sliceSparseEmbedding) FieldType() FieldType { + return FieldTypeSparseVector +} + +func (e sliceSparseEmbedding) Get(idx int) (uint32, float32, bool) { + if idx < 0 || idx >= int(e.len) { + return 0, 0, false + } + return e.positions[idx], e.values[idx], true +} + +func (e sliceSparseEmbedding) Serialize() []byte { + row := make([]byte, 8*e.Len()) + for idx := 0; idx < e.Len(); idx++ { + pos, value, _ := e.Get(idx) + binary.LittleEndian.PutUint32(row[idx*8:], pos) + binary.LittleEndian.PutUint32(row[pos*8+4:], math.Float32bits(value)) + } + return row +} + +// Less implements sort.Interce +func (e sliceSparseEmbedding) Less(i, j int) bool { + return e.positions[i] < e.positions[j] +} + +func (e sliceSparseEmbedding) Swap(i, j int) { + e.positions[i], e.positions[j] = e.positions[j], e.positions[i] + e.values[i], e.values[j] = e.values[j], e.values[i] +} + +func deserializeSliceSparceEmbedding(bs []byte) (sliceSparseEmbedding, error) { + length := len(bs) + if length%8 != 0 { + return sliceSparseEmbedding{}, errors.New("not valid sparse embedding bytes") + } + + length = length / 8 + + result := sliceSparseEmbedding{ + positions: make([]uint32, length), + values: make([]float32, length), + len: length, + } + + for i := 0; i < length; i++ { + result.positions[i] = binary.LittleEndian.Uint32(bs[i*8 : i*8+4]) + result.values[i] = math.Float32frombits(binary.LittleEndian.Uint32(bs[i*8+4 : i*8+8])) + } + return result, nil +} + +func NewSliceSparseEmbedding(positions []uint32, values []float32) (SparseEmbedding, error) { + if len(positions) != len(values) { + return nil, errors.New("invalid sparse embedding input, positions shall have same number of values") + } + + se := sliceSparseEmbedding{ + positions: positions, + values: values, + len: len(positions), + } + + sort.Sort(se) + + if se.len > 0 { + se.dim = int(se.positions[se.len-1]) + 1 + } + + return se, nil +} diff --git a/client/entity/sparse_test.go b/client/entity/sparse_test.go new file mode 100644 index 0000000000000..24f6b08a1975b --- /dev/null +++ b/client/entity/sparse_test.go @@ -0,0 +1,68 @@ +// 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 entity + +import ( + "math/rand" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestSliceSparseEmbedding(t *testing.T) { + t.Run("normal_case", func(t *testing.T) { + length := 1 + rand.Intn(5) + positions := make([]uint32, length) + values := make([]float32, length) + for i := 0; i < length; i++ { + positions[i] = uint32(i) + values[i] = rand.Float32() + } + se, err := NewSliceSparseEmbedding(positions, values) + require.NoError(t, err) + + assert.EqualValues(t, length, se.Dim()) + assert.EqualValues(t, length, se.Len()) + + bs := se.Serialize() + nv, err := deserializeSliceSparceEmbedding(bs) + require.NoError(t, err) + + for i := 0; i < length; i++ { + pos, val, ok := se.Get(i) + require.True(t, ok) + assert.Equal(t, positions[i], pos) + assert.Equal(t, values[i], val) + + npos, nval, ok := nv.Get(i) + require.True(t, ok) + assert.Equal(t, positions[i], npos) + assert.Equal(t, values[i], nval) + } + + _, _, ok := se.Get(-1) + assert.False(t, ok) + _, _, ok = se.Get(length) + assert.False(t, ok) + }) + + t.Run("position values not match", func(t *testing.T) { + _, err := NewSliceSparseEmbedding([]uint32{1}, []float32{}) + assert.Error(t, err) + }) +} diff --git a/client/entity/vectors.go b/client/entity/vectors.go new file mode 100644 index 0000000000000..82f1fe5979020 --- /dev/null +++ b/client/entity/vectors.go @@ -0,0 +1,106 @@ +// 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 entity + +import ( + "encoding/binary" + "math" +) + +// Vector interface vector used int search +type Vector interface { + Dim() int + Serialize() []byte + FieldType() FieldType +} + +// FloatVector float32 vector wrapper. +type FloatVector []float32 + +// Dim returns vector dimension. +func (fv FloatVector) Dim() int { + return len(fv) +} + +// entity.FieldType returns coresponding field type. +func (fv FloatVector) FieldType() FieldType { + return FieldTypeFloatVector +} + +// Serialize serializes vector into byte slice, used in search placeholder +// LittleEndian is used for convention +func (fv FloatVector) Serialize() []byte { + data := make([]byte, 0, 4*len(fv)) // float32 occupies 4 bytes + buf := make([]byte, 4) + for _, f := range fv { + binary.LittleEndian.PutUint32(buf, math.Float32bits(f)) + data = append(data, buf...) + } + return data +} + +// FloatVector float32 vector wrapper. +type Float16Vector []byte + +// Dim returns vector dimension. +func (fv Float16Vector) Dim() int { + return len(fv) / 2 +} + +// entity.FieldType returns coresponding field type. +func (fv Float16Vector) FieldType() FieldType { + return FieldTypeFloat16Vector +} + +func (fv Float16Vector) Serialize() []byte { + return fv +} + +// FloatVector float32 vector wrapper. +type BFloat16Vector []byte + +// Dim returns vector dimension. +func (fv BFloat16Vector) Dim() int { + return len(fv) / 2 +} + +// entity.FieldType returns coresponding field type. +func (fv BFloat16Vector) FieldType() FieldType { + return FieldTypeBFloat16Vector +} + +func (fv BFloat16Vector) Serialize() []byte { + return fv +} + +// BinaryVector []byte vector wrapper +type BinaryVector []byte + +// Dim return vector dimension, note that binary vector is bits count +func (bv BinaryVector) Dim() int { + return 8 * len(bv) +} + +// Serialize just return bytes +func (bv BinaryVector) Serialize() []byte { + return bv +} + +// entity.FieldType returns coresponding field type. +func (bv BinaryVector) FieldType() FieldType { + return FieldTypeBinaryVector +} diff --git a/client/entity/vectors_test.go b/client/entity/vectors_test.go new file mode 100644 index 0000000000000..95785f7644f88 --- /dev/null +++ b/client/entity/vectors_test.go @@ -0,0 +1,51 @@ +// 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 entity + +import ( + "math/rand" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestVectors(t *testing.T) { + dim := rand.Intn(127) + 1 + + t.Run("test float vector", func(t *testing.T) { + raw := make([]float32, dim) + for i := 0; i < dim; i++ { + raw[i] = rand.Float32() + } + + fv := FloatVector(raw) + + assert.Equal(t, dim, fv.Dim()) + assert.Equal(t, dim*4, len(fv.Serialize())) + }) + + t.Run("test binary vector", func(t *testing.T) { + raw := make([]byte, dim) + _, err := rand.Read(raw) + assert.Nil(t, err) + + bv := BinaryVector(raw) + + assert.Equal(t, dim*8, bv.Dim()) + assert.ElementsMatch(t, raw, bv.Serialize()) + }) +} diff --git a/client/go.mod b/client/go.mod new file mode 100644 index 0000000000000..e7936babbf0ac --- /dev/null +++ b/client/go.mod @@ -0,0 +1,125 @@ +module github.com/milvus-io/milvus/client/v2 + +go 1.21.8 + +require ( + github.com/blang/semver/v4 v4.0.0 + github.com/cockroachdb/errors v1.9.1 + github.com/gogo/status v1.1.0 + github.com/golang/protobuf v1.5.3 + github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 + github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20240228061649-a922b16f2a46 + github.com/milvus-io/milvus/pkg v0.0.2-0.20240317152703-17b4938985f3 + github.com/samber/lo v1.27.0 + github.com/stretchr/testify v1.8.4 + github.com/tidwall/gjson v1.17.1 + go.uber.org/atomic v1.10.0 + google.golang.org/grpc v1.54.0 +) + +require ( + github.com/benbjohnson/clock v1.1.0 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cilium/ebpf v0.11.0 // indirect + github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f // indirect + github.com/cockroachdb/redact v1.1.3 // indirect + github.com/containerd/cgroups/v3 v3.0.3 // indirect + github.com/coreos/go-semver v0.3.0 // indirect + github.com/coreos/go-systemd/v22 v22.3.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/docker/go-units v0.4.0 // indirect + github.com/dustin/go-humanize v1.0.0 // indirect + github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect + github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/getsentry/sentry-go v0.12.0 // indirect + github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect + github.com/godbus/dbus/v5 v5.0.4 // indirect + github.com/gogo/googleapis v1.4.1 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/btree v1.1.2 // indirect + github.com/gorilla/websocket v1.4.2 // indirect + github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect + github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/jonboulle/clockwork v0.2.2 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect + github.com/magiconair/properties v1.8.5 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/mitchellh/mapstructure v1.4.1 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/opencontainers/runtime-spec v1.0.2 // indirect + github.com/panjf2000/ants/v2 v2.7.2 // indirect + github.com/pelletier/go-toml v1.9.3 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect + github.com/prometheus/client_golang v1.14.0 // indirect + github.com/prometheus/client_model v0.3.0 // indirect + github.com/prometheus/common v0.42.0 // indirect + github.com/prometheus/procfs v0.9.0 // indirect + github.com/rogpeppe/go-internal v1.10.0 // indirect + github.com/shirou/gopsutil/v3 v3.22.9 // indirect + github.com/sirupsen/logrus v1.9.0 // indirect + github.com/soheilhy/cmux v0.1.5 // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect + github.com/spf13/afero v1.6.0 // indirect + github.com/spf13/cast v1.3.1 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/viper v1.8.1 // indirect + github.com/stretchr/objx v0.5.0 // indirect + github.com/subosito/gotenv v1.2.0 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.0 // indirect + github.com/tklauser/go-sysconf v0.3.10 // indirect + github.com/tklauser/numcpus v0.4.0 // indirect + github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect + github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect + github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect + github.com/yusufpapurcu/wmi v1.2.2 // indirect + go.etcd.io/bbolt v1.3.6 // indirect + go.etcd.io/etcd/api/v3 v3.5.5 // indirect + go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect + go.etcd.io/etcd/client/v2 v2.305.5 // indirect + go.etcd.io/etcd/client/v3 v3.5.5 // indirect + go.etcd.io/etcd/pkg/v3 v3.5.5 // indirect + go.etcd.io/etcd/raft/v3 v3.5.5 // indirect + go.etcd.io/etcd/server/v3 v3.5.5 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.38.0 // indirect + go.opentelemetry.io/otel v1.13.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.13.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.13.0 // indirect + go.opentelemetry.io/otel/metric v0.35.0 // indirect + go.opentelemetry.io/otel/sdk v1.13.0 // indirect + go.opentelemetry.io/otel/trace v1.13.0 // indirect + go.opentelemetry.io/proto/otlp v0.19.0 // indirect + go.uber.org/automaxprocs v1.5.2 // indirect + go.uber.org/multierr v1.7.0 // indirect + go.uber.org/zap v1.20.0 // indirect + golang.org/x/crypto v0.16.0 // indirect + golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/sync v0.1.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/time v0.3.0 // indirect + google.golang.org/genproto v0.0.0-20230331144136-dcfb400f0633 // indirect + google.golang.org/protobuf v1.31.0 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/ini.v1 v1.62.0 // indirect + gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/apimachinery v0.28.6 // indirect + sigs.k8s.io/yaml v1.3.0 // indirect +) diff --git a/client/go.sum b/client/go.sum new file mode 100644 index 0000000000000..3b9d4b61ccba1 --- /dev/null +++ b/client/go.sum @@ -0,0 +1,1121 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= +cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= +cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= +cloud.google.com/go v0.110.0 h1:Zc8gqp3+a9/Eyph2KDmcGaPtbKRIoqq4YTlL4NMD0Ys= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/compute v1.19.0 h1:+9zda3WGgW1ZSTlVppLCYFIr48Pa35q1uG2N1itbCEQ= +cloud.google.com/go/compute v1.19.0/go.mod h1:rikpw2y+UMidAe9tISo04EHNOIf42RLYF/q8Bs93scU= +cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= +cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= +github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= +github.com/CloudyKit/jet/v3 v3.0.0/go.mod h1:HKQPgSJmdK8hdoAbKUUWajkHyHo4RaU5rMdUywE7VMo= +github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= +github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= +github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= +github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= +github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= +github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= +github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/cilium/ebpf v0.11.0 h1:V8gS/bTCCjX9uUnkUFUpPsksM8n1lXBAvHcpiFk1X2Y= +github.com/cilium/ebpf v0.11.0/go.mod h1:WE7CZAnqOL2RouJ4f1uyNhqr2P4CCvXFIqdRDUgWsVs= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo= +github.com/cockroachdb/datadriven v1.0.2 h1:H9MtNqVoVhvd9nCBwOyDjUEdZCREqbIdCJD93PBm/jA= +github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= +github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA= +github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5bEV8= +github.com/cockroachdb/errors v1.9.1/go.mod h1:2sxOtL2WIc096WSZqZ5h8fa17rdDq9HZOZLBCor4mBk= +github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= +github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f h1:6jduT9Hfc0njg5jJ1DdKCFPdMBrp/mdZfCpa5h+WM74= +github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ= +github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= +github.com/containerd/cgroups/v3 v3.0.3 h1:S5ByHZ/h9PMe5IOQoN7E+nMc2UcLEM/V48DGDJ9kip0= +github.com/containerd/cgroups/v3 v3.0.3/go.mod h1:8HBe7V3aWGLFPd/k03swSIsGjZhHI2WzJmticMgVuz0= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= +github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= +github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/form3tech-oss/jwt-go v3.2.3+incompatible h1:7ZaBxOI7TMoYBfyA3cQHErNNyAWIKUMIwqxEtgHOs5c= +github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= +github.com/frankban/quicktest v1.14.5 h1:dfYrrRyLtiqT9GyKXgdh+k4inNeTvmGbuSgZ3lx3GhA= +github.com/frankban/quicktest v1.14.5/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= +github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= +github.com/getsentry/sentry-go v0.12.0 h1:era7g0re5iY13bHSdN/xMkyV+5zZppjRVQhZrXCaEIk= +github.com/getsentry/sentry-go v0.12.0/go.mod h1:NSap0JBYWzHND8oMbyi0+XZhUalc1TBdRL1M71JZW2c= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= +github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= +github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= +github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w= +github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= +github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= +github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= +github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= +github.com/godbus/dbus/v5 v5.0.4 h1:9349emZab16e7zQvpmsbtjc18ykshndd8y2PG3sgJbA= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= +github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/gogo/status v1.1.0 h1:+eIkrewn5q6b30y+g/BJINVVdi2xH7je5MPJ3ZPK3JA= +github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= +github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= +github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= +github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= +github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 h1:l5lAOZEym3oK3SQ2HBHWsJUfbNBiTXJDeW2QDxw9AQ0= +github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI= +github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0= +github.com/iris-contrib/jade v1.1.3/go.mod h1:H/geBymxJhShH5kecoiOCSssPX7QWYH7UaeZTSWddIk= +github.com/iris-contrib/pongo2 v0.0.1/go.mod h1:Ssh+00+3GAZqSQb30AvBRNxBx7rf0GqwkjqxNd0u65g= +github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= +github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= +github.com/kataras/golog v0.0.10/go.mod h1:yJ8YKCmyL+nWjERB90Qwn+bdyBZsaQwU3bTVFgkFIp8= +github.com/kataras/iris/v12 v12.1.8/go.mod h1:LMYy4VlP67TQ3Zgriz8RE2h2kMZV2SgMYbq3UhfoFmE= +github.com/kataras/neffos v0.0.14/go.mod h1:8lqADm8PnbeFfL7CLXh1WHw53dG27MC3pgi2R1rmoTE= +github.com/kataras/pio v0.0.2/go.mod h1:hAoW0t9UmXi4R5Oyq5Z4irTbaTsOemSrDGUtaTl7Dro= +github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubcGyk0Bz8= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +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/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/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/labstack/echo/v4 v4.5.0/go.mod h1:czIriw4a0C1dFun+ObrXp7ok03xON0N1awStJ6ArI7Y= +github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= +github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8= +github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20240228061649-a922b16f2a46 h1:IgoGNTbsRPa2kdNI+IWuZrrortFEjTB42/gYDklZHVU= +github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20240228061649-a922b16f2a46/go.mod h1:1OIl0v5PQeNxIJhCvY+K55CBUOYDZevw9g9380u1Wek= +github.com/milvus-io/milvus/pkg v0.0.2-0.20240317152703-17b4938985f3 h1:ZBpRWhBa7FTFxW4YYVv9AUESoW1Xyb3KNXTzTqfkZmw= +github.com/milvus-io/milvus/pkg v0.0.2-0.20240317152703-17b4938985f3/go.mod h1:jQ2BUZny1COsgv1Qbcv8dmbppW+V9J/c4YQZNb3EOm8= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/opencontainers/runtime-spec v1.0.2 h1:UfAcuLBJB9Coz72x1hgl8O5RVzTdNiaglX6v2DM6FI0= +github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/panjf2000/ants/v2 v2.7.2 h1:2NUt9BaZFO5kQzrieOmK/wdb/tQ/K+QHaxN8sOgD63U= +github.com/panjf2000/ants/v2 v2.7.2/go.mod h1:KIBmYG9QQX5U2qzFP/yQJaq/nSb6rahS9iEHkrCMgM8= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ= +github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c h1:xpW9bvK+HuuTmyFqUwr+jcCvpVkK7sumiz+ko5H9eq4= +github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= +github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= +github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= +github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= +github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= +github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/samber/lo v1.27.0 h1:GOyDWxsblvqYobqsmUuMddPa2/mMzkKyojlXol4+LaQ= +github.com/samber/lo v1.27.0/go.mod h1:it33p9UtPMS7z72fP4gw/EIfQB2eI8ke7GR2wc6+Rhg= +github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shirou/gopsutil/v3 v3.22.9 h1:yibtJhIVEMcdw+tCTbOPiF1VcsuDeTE4utJ8Dm4c5eA= +github.com/shirou/gopsutil/v3 v3.22.9/go.mod h1:bBYl1kjgEJpWpxeHmLI+dVHWtyAwfcmSBLDsp2TNT8A= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/assertions v1.1.0 h1:MkTeG1DMwsrdH7QtLXy5W+fUxWq+vmb6cLmyJ7aRtF0= +github.com/smartystreets/assertions v1.1.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= +github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= +github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.8.1 h1:Kq1fyeebqsBfbjZj4EL7gj2IO0mMaiyjYUWcUsl2O44= +github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/thoas/go-funk v0.9.1 h1:O549iLZqPpTUQ10ykd26sZhzD+rmR5pWhuElrhbC20M= +github.com/thoas/go-funk v0.9.1/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q= +github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U= +github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= +github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw= +github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= +github.com/tklauser/numcpus v0.4.0 h1:E53Dm1HjH1/R2/aoCtXtPgzmElmn51aOkhCFSuZq//o= +github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 h1:uruHq4dN7GR16kFc5fp3d1RIYzJW5onx8Ybykw2YQFA= +github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/uber/jaeger-client-go v2.30.0+incompatible h1:D6wyKGCecFaSRUpo8lCVbaOOb6ThwMmTEbhRwtKR97o= +github.com/uber/jaeger-client-go v2.30.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= +github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= +github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI= +github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= +github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= +github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= +github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= +go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= +go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/api/v3 v3.5.5 h1:BX4JIbQ7hl7+jL+g+2j5UAr0o1bctCm6/Ct+ArBGkf0= +go.etcd.io/etcd/api/v3 v3.5.5/go.mod h1:KFtNaxGDw4Yx/BA4iPPwevUTAuqcsPxzyX8PHydchN8= +go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/pkg/v3 v3.5.5 h1:9S0JUVvmrVl7wCF39iTQthdaaNIiAaQbmK75ogO6GU8= +go.etcd.io/etcd/client/pkg/v3 v3.5.5/go.mod h1:ggrwbk069qxpKPq8/FKkQ3Xq9y39kbFR4LnKszpRXeQ= +go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= +go.etcd.io/etcd/client/v2 v2.305.5 h1:DktRP60//JJpnPC0VBymAN/7V71GHMdjDCBt4ZPXDjI= +go.etcd.io/etcd/client/v2 v2.305.5/go.mod h1:zQjKllfqfBVyVStbt4FaosoX2iYd8fV/GRy/PbowgP4= +go.etcd.io/etcd/client/v3 v3.5.5 h1:q++2WTJbUgpQu4B6hCuT7VkdwaTP7Qz6Daak3WzbrlI= +go.etcd.io/etcd/client/v3 v3.5.5/go.mod h1:aApjR4WGlSumpnJ2kloS75h6aHUmAyaPLjHMxpc7E7c= +go.etcd.io/etcd/pkg/v3 v3.5.5 h1:Ablg7T7OkR+AeeeU32kdVhw/AGDsitkKPl7aW73ssjU= +go.etcd.io/etcd/pkg/v3 v3.5.5/go.mod h1:6ksYFxttiUGzC2uxyqiyOEvhAiD0tuIqSZkX3TyPdaE= +go.etcd.io/etcd/raft/v3 v3.5.5 h1:Ibz6XyZ60OYyRopu73lLM/P+qco3YtlZMOhnXNS051I= +go.etcd.io/etcd/raft/v3 v3.5.5/go.mod h1:76TA48q03g1y1VpTue92jZLr9lIHKUNcYdZOOGyx8rI= +go.etcd.io/etcd/server/v3 v3.5.5 h1:jNjYm/9s+f9A9r6+SC4RvNaz6AqixpOvhrFdT0PvIj0= +go.etcd.io/etcd/server/v3 v3.5.5/go.mod h1:rZ95vDw/jrvsbj9XpTqPrTAB9/kzchVdhRirySPkUBc= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.25.0/go.mod h1:E5NNboN0UqSAki0Atn9kVwaN7I+l25gGxDqBueo/74E= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.38.0 h1:g/BAN5o90Pr6D8xMRezjzGOHBpc15U+4oE53nZLiae4= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.38.0/go.mod h1:+F41JBSkye7aYJELRvIMF0Z66reIwIOL0St75ZVwSJs= +go.opentelemetry.io/otel v1.0.1/go.mod h1:OPEOD4jIT2SlZPMmwT6FqZz2C0ZNdQqiWcoK6M0SNFU= +go.opentelemetry.io/otel v1.13.0 h1:1ZAKnNQKwBBxFtww/GwxNUyTf0AxkZzrukO8MeXqe4Y= +go.opentelemetry.io/otel v1.13.0/go.mod h1:FH3RtdZCzRkJYFTCsAKDy9l/XYjMdNv6QrkFFB8DvVg= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 h1:pa05sNT/P8OsIQ8mPZKTIyiBuzS/xDGLVx+DCt0y6Vs= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0/go.mod h1:rqbht/LlhVBgn5+k3M5QK96K5Xb0DvXpMJ5SFQpY6uw= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.0.1/go.mod h1:Kv8liBeVNFkkkbilbgWRpV+wWuu+H5xdOT6HAgd30iw= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.13.0 h1:Any/nVxaoMq1T2w0W85d6w5COlLuCCgOYKQhJJWEMwQ= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.13.0/go.mod h1:46vAP6RWfNn7EKov73l5KBFlNxz8kYlxR1woU+bJ4ZY= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.0.1/go.mod h1:xOvWoTOrQjxjW61xtOmD/WKGRYb/P4NzRo3bs65U6Rk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.13.0 h1:Wz7UQn7/eIqZVDJbuNEM6PmqeA71cWXrWcXekP5HZgU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.13.0/go.mod h1:OhH1xvgA5jZW2M/S4PcvtDlFE1VULRRBsibBrKuJQGI= +go.opentelemetry.io/otel/metric v0.35.0 h1:aPT5jk/w7F9zW51L7WgRqNKDElBdyRLGuBtI5MX34e8= +go.opentelemetry.io/otel/metric v0.35.0/go.mod h1:qAcbhaTRFU6uG8QM7dDo7XvFsWcugziq/5YI065TokQ= +go.opentelemetry.io/otel/sdk v1.0.1/go.mod h1:HrdXne+BiwsOHYYkBE5ysIcv2bvdZstxzmCQhxTcZkI= +go.opentelemetry.io/otel/sdk v1.13.0 h1:BHib5g8MvdqS65yo2vV1s6Le42Hm6rrw08qU6yz5JaM= +go.opentelemetry.io/otel/sdk v1.13.0/go.mod h1:YLKPx5+6Vx/o1TCUYYs+bpymtkmazOMT6zoRrC7AQ7I= +go.opentelemetry.io/otel/trace v1.0.1/go.mod h1:5g4i4fKLaX2BQpSBsxw8YYcgKpMMSW3x7ZTuYBr3sUk= +go.opentelemetry.io/otel/trace v1.13.0 h1:CBgRZ6ntv+Amuj1jDsMhZtlAPT6gbyIRdaIzFhfBSdY= +go.opentelemetry.io/otel/trace v1.13.0/go.mod h1:muCvmmO9KKpvuXSf3KKAXXB2ygNYHQ+ZfI5X08d3tds= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.opentelemetry.io/proto/otlp v0.9.0/go.mod h1:1vKfU9rv61e9EVGthD1zNvUbiwPcimSsOPU9brfSHJg= +go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= +go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= +go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/automaxprocs v1.5.2 h1:2LxUOGiR3O6tw8ui5sZa2LAaHnsviZdVOUZw4fvbnME= +go.uber.org/automaxprocs v1.5.2/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= +go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec= +go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= +go.uber.org/zap v1.20.0 h1:N4oPlghZwYG55MlU6LXk/Zp00FVNE9X9wrYO8CEs4lc= +go.uber.org/zap v1.20.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 h1:Jvc7gsqn21cJHCmAWx0LiimpP18LZmUxkT5Mp7EZ1mI= +golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.6.0 h1:Lh8GPgSKBfWSwFvtuWOfeI3aAAnbXTSutYxJiOJFgIw= +golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190327201419-c70d86f8b7cf/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= +google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= +google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20230331144136-dcfb400f0633 h1:0BOZf6qNozI3pkN3fJLwNubheHJYHhMh91GRFOWWK08= +google.golang.org/genproto v0.0.0-20230331144136-dcfb400f0633/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= +google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= +google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= +gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.51.1/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU= +gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= +gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= +gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +k8s.io/apimachinery v0.28.6 h1:RsTeR4z6S07srPg6XYrwXpTJVMXsjPXn0ODakMytSW0= +k8s.io/apimachinery v0.28.6/go.mod h1:QFNX/kCl/EMT2WTSz8k4WLCv2XnkOLMaL8GAVRMdpsA= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= +sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= +sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/client/index.go b/client/index.go new file mode 100644 index 0000000000000..79dd57ed3e9c6 --- /dev/null +++ b/client/index.go @@ -0,0 +1,159 @@ +// 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 client + +import ( + "context" + "fmt" + "time" + + "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus/client/v2/entity" + "github.com/milvus-io/milvus/client/v2/index" + "github.com/milvus-io/milvus/pkg/util/merr" + "google.golang.org/grpc" +) + +type CreateIndexTask struct { + client *Client + collectionName string + fieldName string + indexName string + interval time.Duration +} + +func (t *CreateIndexTask) Await(ctx context.Context) error { + ticker := time.NewTicker(t.interval) + defer ticker.Stop() + for { + select { + case <-ticker.C: + finished := false + err := t.client.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.DescribeIndex(ctx, &milvuspb.DescribeIndexRequest{ + CollectionName: t.collectionName, + FieldName: t.fieldName, + IndexName: t.indexName, + }) + err = merr.CheckRPCCall(resp, err) + if err != nil { + return err + } + + for _, info := range resp.GetIndexDescriptions() { + if (t.indexName == "" && info.GetFieldName() == t.fieldName) || t.indexName == info.GetIndexName() { + switch info.GetState() { + case commonpb.IndexState_Finished: + finished = true + return nil + case commonpb.IndexState_Failed: + return fmt.Errorf("create index failed, reason: %s", info.GetIndexStateFailReason()) + } + } + } + return nil + }) + if err != nil { + return err + } + if finished { + return nil + } + ticker.Reset(t.interval) + case <-ctx.Done(): + return ctx.Err() + } + } +} + +func (c *Client) CreateIndex(ctx context.Context, option CreateIndexOption, callOptions ...grpc.CallOption) (*CreateIndexTask, error) { + req := option.Request() + var task *CreateIndexTask + + err := c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.CreateIndex(ctx, req, callOptions...) + if err = merr.CheckRPCCall(resp, err); err != nil { + return err + } + + task = &CreateIndexTask{ + client: c, + collectionName: req.GetCollectionName(), + fieldName: req.GetFieldName(), + indexName: req.GetIndexName(), + interval: time.Millisecond * 100, + } + + return nil + }) + + return task, err +} + +func (c *Client) ListIndexes(ctx context.Context, opt ListIndexOption, callOptions ...grpc.CallOption) ([]string, error) { + req := opt.Request() + + var indexes []string + + err := c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.DescribeIndex(ctx, req, callOptions...) + if err = merr.CheckRPCCall(resp, err); err != nil { + return err + } + for _, idxDef := range resp.GetIndexDescriptions() { + if opt.Matches(idxDef) { + indexes = append(indexes, idxDef.GetIndexName()) + } + } + return nil + }) + return indexes, err +} + +func (c *Client) DescribeIndex(ctx context.Context, opt DescribeIndexOption, callOptions ...grpc.CallOption) (index.Index, error) { + req := opt.Request() + var idx index.Index + + err := c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.DescribeIndex(ctx, req, callOptions...) + if err = merr.CheckRPCCall(resp, err); err != nil { + return err + } + + if len(resp.GetIndexDescriptions()) == 0 { + return merr.WrapErrIndexNotFound(req.GetIndexName()) + } + for _, idxDef := range resp.GetIndexDescriptions() { + if idxDef.GetIndexName() == req.GetIndexName() { + idx = index.NewGenericIndex(idxDef.GetIndexName(), entity.KvPairsMap(idxDef.GetParams())) + } + } + return nil + }) + + return idx, err +} + +func (c *Client) DropIndex(ctx context.Context, opt DropIndexOption, callOptions ...grpc.CallOption) error { + req := opt.Request() + + return c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.DropIndex(ctx, req, callOptions...) + return merr.CheckRPCCall(resp, err) + }) +} diff --git a/client/index/common.go b/client/index/common.go new file mode 100644 index 0000000000000..58e4da922f39f --- /dev/null +++ b/client/index/common.go @@ -0,0 +1,61 @@ +// 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 index + +import ( + "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" + "github.com/milvus-io/milvus/client/v2/entity" +) + +// index param field tag +const ( + IndexTypeKey = `index_type` + MetricTypeKey = `metric_type` + ParamsKey = `params` +) + +// IndexState export index state +type IndexState commonpb.IndexState + +// IndexType index type +type IndexType string + +// MetricType alias for `entity.MetricsType`. +type MetricType = entity.MetricType + +// Index Constants +const ( + Flat IndexType = "FLAT" // faiss + BinFlat IndexType = "BIN_FLAT" + IvfFlat IndexType = "IVF_FLAT" // faiss + BinIvfFlat IndexType = "BIN_IVF_FLAT" + IvfPQ IndexType = "IVF_PQ" // faiss + IvfSQ8 IndexType = "IVF_SQ8" + HNSW IndexType = "HNSW" + IvfHNSW IndexType = "IVF_HNSW" + AUTOINDEX IndexType = "AUTOINDEX" + DISKANN IndexType = "DISKANN" + SCANN IndexType = "SCANN" + + GPUIvfFlat IndexType = "GPU_IVF_FLAT" + GPUIvfPQ IndexType = "GPU_IVF_PQ" + + GPUCagra IndexType = "GPU_CAGRA" + GPUBruteForce IndexType = "GPU_BRUTE_FORCE" + + Scalar IndexType = "SCALAR" +) diff --git a/client/index/disk_ann.go b/client/index/disk_ann.go new file mode 100644 index 0000000000000..4a029b7da8d3c --- /dev/null +++ b/client/index/disk_ann.go @@ -0,0 +1,38 @@ +// 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 index + +var _ Index = diskANNIndex{} + +type diskANNIndex struct { + baseIndex +} + +func (idx diskANNIndex) Params() map[string]string { + return map[string]string{ + MetricTypeKey: string(idx.metricType), + IndexTypeKey: string(DISKANN), + } +} + +func NewDiskANNIndex(metricType MetricType) Index { + return &diskANNIndex{ + baseIndex: baseIndex{ + metricType: metricType, + }, + } +} diff --git a/client/index/flat.go b/client/index/flat.go new file mode 100644 index 0000000000000..205fb4df2f1eb --- /dev/null +++ b/client/index/flat.go @@ -0,0 +1,38 @@ +// 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 index + +var _ Index = flatIndex{} + +type flatIndex struct { + baseIndex +} + +func (idx flatIndex) Params() map[string]string { + return map[string]string{ + MetricTypeKey: string(idx.metricType), + IndexTypeKey: string(Flat), + } +} + +func NewFlatIndex(metricType MetricType) Index { + return flatIndex{ + baseIndex: baseIndex{ + metricType: metricType, + }, + } +} diff --git a/client/index/hnsw.go b/client/index/hnsw.go new file mode 100644 index 0000000000000..8c0d9e60e9b00 --- /dev/null +++ b/client/index/hnsw.go @@ -0,0 +1,53 @@ +// 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 index + +import "strconv" + +const ( + hnswMKey = `M` + hsnwEfConstruction = `efConstruction` +) + +var _ Index = hnswIndex{} + +type hnswIndex struct { + baseIndex + + m int + efConstruction int // exploratory factor when building index +} + +func (idx hnswIndex) Params() map[string]string { + return map[string]string{ + MetricTypeKey: string(idx.metricType), + IndexTypeKey: string(HNSW), + hnswMKey: strconv.Itoa(idx.m), + hsnwEfConstruction: strconv.Itoa(idx.efConstruction), + } +} + +func NewHNSWIndex(metricType MetricType, M int, efConstruction int) Index { + return hnswIndex{ + baseIndex: baseIndex{ + metricType: metricType, + indexType: HNSW, + }, + m: M, + efConstruction: efConstruction, + } +} diff --git a/client/index/index.go b/client/index/index.go new file mode 100644 index 0000000000000..e04b92b3f69d7 --- /dev/null +++ b/client/index/index.go @@ -0,0 +1,79 @@ +// 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 index + +import "encoding/json" + +// Index represent index definition in milvus. +type Index interface { + Name() string + IndexType() IndexType + Params() map[string]string +} + +type baseIndex struct { + name string + metricType MetricType + indexType IndexType + params map[string]string +} + +func (idx baseIndex) Name() string { + return idx.name +} + +func (idx baseIndex) IndexType() IndexType { + return idx.indexType +} + +func (idx baseIndex) Params() map[string]string { + return idx.params +} + +func (idx baseIndex) getExtraParams(params map[string]any) string { + bs, _ := json.Marshal(params) + return string(bs) +} + +var _ Index = GenericIndex{} + +type GenericIndex struct { + baseIndex + params map[string]string +} + +// Params implements Index +func (gi GenericIndex) Params() map[string]string { + m := make(map[string]string) + if gi.baseIndex.indexType != "" { + m[IndexTypeKey] = string(gi.IndexType()) + } + for k, v := range gi.params { + m[k] = v + } + return m +} + +// NewGenericIndex create generic index instance +func NewGenericIndex(name string, params map[string]string) Index { + return GenericIndex{ + baseIndex: baseIndex{ + name: name, + }, + params: params, + } +} diff --git a/client/index/index_test.go b/client/index/index_test.go new file mode 100644 index 0000000000000..b7dbd65274fe3 --- /dev/null +++ b/client/index/index_test.go @@ -0,0 +1,17 @@ +// 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 index diff --git a/client/index/ivf.go b/client/index/ivf.go new file mode 100644 index 0000000000000..e22d243459bdb --- /dev/null +++ b/client/index/ivf.go @@ -0,0 +1,108 @@ +// 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 index + +import "strconv" + +const ( + ivfNlistKey = `nlist` + ivfPQMKey = `m` + ivfPQNbits = `nbits` +) + +var _ Index = ivfFlatIndex{} + +type ivfFlatIndex struct { + baseIndex + + nlist int +} + +func (idx ivfFlatIndex) Params() map[string]string { + return map[string]string{ + MetricTypeKey: string(idx.metricType), + IndexTypeKey: string(IvfFlat), + ivfNlistKey: strconv.Itoa(idx.nlist), + } +} + +func NewIvfFlatIndex(metricType MetricType, nlist int) Index { + return ivfFlatIndex{ + baseIndex: baseIndex{ + metricType: metricType, + indexType: IvfFlat, + }, + + nlist: nlist, + } +} + +type ivfPQIndex struct { + baseIndex + + nlist int + m int + nbits int +} + +func (idx ivfPQIndex) Params() map[string]string { + return map[string]string{ + MetricTypeKey: string(idx.metricType), + IndexTypeKey: string(IvfPQ), + ivfNlistKey: strconv.Itoa(idx.nlist), + ivfPQMKey: strconv.Itoa(idx.m), + ivfPQNbits: strconv.Itoa(idx.nbits), + } +} + +func NewIvfPQIndex(metricType MetricType, nlist int, m int, nbits int) Index { + return ivfPQIndex{ + baseIndex: baseIndex{ + metricType: metricType, + indexType: IvfPQ, + }, + + nlist: nlist, + m: m, + nbits: nbits, + } +} + +type ivfSQ8Index struct { + baseIndex + + nlist int +} + +func (idx ivfSQ8Index) Params() map[string]string { + return map[string]string{ + MetricTypeKey: string(idx.metricType), + IndexTypeKey: string(IvfSQ8), + ivfNlistKey: strconv.Itoa(idx.nlist), + } +} + +func NewIvfSQ8Index(metricType MetricType, nlist int) Index { + return ivfPQIndex{ + baseIndex: baseIndex{ + metricType: metricType, + indexType: IvfSQ8, + }, + + nlist: nlist, + } +} diff --git a/client/index/scann.go b/client/index/scann.go new file mode 100644 index 0000000000000..e0f866684942f --- /dev/null +++ b/client/index/scann.go @@ -0,0 +1,50 @@ +// 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 index + +import "strconv" + +const ( + scannNlistKey = `nlist` + scannWithRawDataKey = `with_raw_data` +) + +type scannIndex struct { + baseIndex + + nlist int + withRawData bool +} + +func (idx scannIndex) Params() map[string]string { + return map[string]string{ + MetricTypeKey: string(idx.metricType), + IndexTypeKey: string(IvfFlat), + ivfNlistKey: strconv.Itoa(idx.nlist), + } +} + +func NewSCANNIndex(metricType MetricType, nlist int) Index { + return ivfFlatIndex{ + baseIndex: baseIndex{ + metricType: metricType, + indexType: IvfFlat, + }, + + nlist: nlist, + } +} diff --git a/client/index_options.go b/client/index_options.go new file mode 100644 index 0000000000000..272d6cdef84c7 --- /dev/null +++ b/client/index_options.go @@ -0,0 +1,137 @@ +// 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 client + +import ( + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus/client/v2/entity" + "github.com/milvus-io/milvus/client/v2/index" +) + +type CreateIndexOption interface { + Request() *milvuspb.CreateIndexRequest +} + +type createIndexOption struct { + collectionName string + fieldName string + indexName string + indexDef index.Index +} + +func (opt *createIndexOption) Request() *milvuspb.CreateIndexRequest { + return &milvuspb.CreateIndexRequest{ + CollectionName: opt.collectionName, + FieldName: opt.fieldName, + IndexName: opt.indexName, + ExtraParams: entity.MapKvPairs(opt.indexDef.Params()), + } +} + +func (opt *createIndexOption) WithIndexName(indexName string) *createIndexOption { + opt.indexName = indexName + return opt +} + +func NewCreateIndexOption(collectionName string, fieldName string, index index.Index) *createIndexOption { + return &createIndexOption{ + collectionName: collectionName, + fieldName: fieldName, + indexDef: index, + } +} + +type ListIndexOption interface { + Request() *milvuspb.DescribeIndexRequest + Matches(*milvuspb.IndexDescription) bool +} + +var _ ListIndexOption = (*listIndexOption)(nil) + +type listIndexOption struct { + collectionName string + fieldName string +} + +func (opt *listIndexOption) WithFieldName(fieldName string) *listIndexOption { + opt.fieldName = fieldName + return opt +} + +func (opt *listIndexOption) Matches(idxDef *milvuspb.IndexDescription) bool { + return opt.fieldName == "" || idxDef.GetFieldName() == opt.fieldName +} + +func (opt *listIndexOption) Request() *milvuspb.DescribeIndexRequest { + return &milvuspb.DescribeIndexRequest{ + CollectionName: opt.collectionName, + FieldName: opt.fieldName, + } +} + +func NewListIndexOption(collectionName string) *listIndexOption { + return &listIndexOption{ + collectionName: collectionName, + } +} + +type DescribeIndexOption interface { + Request() *milvuspb.DescribeIndexRequest +} + +type describeIndexOption struct { + collectionName string + fieldName string + indexName string +} + +func (opt *describeIndexOption) Request() *milvuspb.DescribeIndexRequest { + return &milvuspb.DescribeIndexRequest{ + CollectionName: opt.collectionName, + IndexName: opt.indexName, + } +} + +func NewDescribeIndexOption(collectionName string, indexName string) *describeIndexOption { + return &describeIndexOption{ + collectionName: collectionName, + indexName: indexName, + } +} + +type DropIndexOption interface { + Request() *milvuspb.DropIndexRequest +} + +type dropIndexOption struct { + collectionName string + indexName string +} + +func (opt *dropIndexOption) Request() *milvuspb.DropIndexRequest { + return &milvuspb.DropIndexRequest{ + CollectionName: opt.collectionName, + IndexName: opt.indexName, + } +} + +func NewDropIndexOption(collectionName string, indexName string) *dropIndexOption { + return &dropIndexOption{ + collectionName: collectionName, + indexName: indexName, + } +} diff --git a/client/index_test.go b/client/index_test.go new file mode 100644 index 0000000000000..ac9f5e40699e5 --- /dev/null +++ b/client/index_test.go @@ -0,0 +1,221 @@ +// 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 client + +import ( + "context" + "fmt" + "testing" + "time" + + "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus/client/v2/entity" + "github.com/milvus-io/milvus/client/v2/index" + "github.com/milvus-io/milvus/pkg/util/merr" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/suite" + "go.uber.org/atomic" +) + +type IndexSuite struct { + MockSuiteBase +} + +func (s *IndexSuite) TestCreateIndex() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + s.Run("success", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + fieldName := fmt.Sprintf("field_%s", s.randString(4)) + indexName := fmt.Sprintf("idx_%s", s.randString(6)) + + done := atomic.NewBool(false) + + s.mock.EXPECT().CreateIndex(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, cir *milvuspb.CreateIndexRequest) (*commonpb.Status, error) { + s.Equal(collectionName, cir.GetCollectionName()) + s.Equal(fieldName, cir.GetFieldName()) + s.Equal(indexName, cir.GetIndexName()) + return merr.Success(), nil + }).Once() + s.mock.EXPECT().DescribeIndex(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, dir *milvuspb.DescribeIndexRequest) (*milvuspb.DescribeIndexResponse, error) { + state := commonpb.IndexState_InProgress + if done.Load() { + state = commonpb.IndexState_Finished + } + return &milvuspb.DescribeIndexResponse{ + Status: merr.Success(), + IndexDescriptions: []*milvuspb.IndexDescription{ + { + FieldName: fieldName, + IndexName: indexName, + State: state, + }, + }, + }, nil + }) + defer s.mock.EXPECT().DescribeIndex(mock.Anything, mock.Anything).Unset() + + task, err := s.client.CreateIndex(ctx, NewCreateIndexOption(collectionName, fieldName, index.NewHNSWIndex(entity.L2, 32, 128)).WithIndexName(indexName)) + s.NoError(err) + + ch := make(chan struct{}) + go func() { + defer close(ch) + err := task.Await(ctx) + s.NoError(err) + }() + + select { + case <-ch: + s.FailNow("task done before index state set to finish") + case <-time.After(time.Second): + } + + done.Store(true) + + select { + case <-ch: + case <-time.After(time.Second): + s.FailNow("task not done after index set finished") + } + }) + + s.Run("failure", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + fieldName := fmt.Sprintf("field_%s", s.randString(4)) + indexName := fmt.Sprintf("idx_%s", s.randString(6)) + + s.mock.EXPECT().CreateIndex(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + _, err := s.client.CreateIndex(ctx, NewCreateIndexOption(collectionName, fieldName, index.NewHNSWIndex(entity.L2, 32, 128)).WithIndexName(indexName)) + s.Error(err) + }) +} + +func (s *IndexSuite) TestListIndexes() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + s.Run("success", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + s.mock.EXPECT().DescribeIndex(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, dir *milvuspb.DescribeIndexRequest) (*milvuspb.DescribeIndexResponse, error) { + s.Equal(collectionName, dir.GetCollectionName()) + return &milvuspb.DescribeIndexResponse{ + Status: merr.Success(), + IndexDescriptions: []*milvuspb.IndexDescription{ + {IndexName: "test_idx"}, + }, + }, nil + }).Once() + + names, err := s.client.ListIndexes(ctx, NewListIndexOption(collectionName)) + s.NoError(err) + s.ElementsMatch([]string{"test_idx"}, names) + }) + + s.Run("failure", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + s.mock.EXPECT().DescribeIndex(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + _, err := s.client.ListIndexes(ctx, NewListIndexOption(collectionName)) + s.Error(err) + }) +} + +func (s *IndexSuite) TestDescribeIndex() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + s.Run("success", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + indexName := fmt.Sprintf("idx_%s", s.randString(6)) + s.mock.EXPECT().DescribeIndex(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, dir *milvuspb.DescribeIndexRequest) (*milvuspb.DescribeIndexResponse, error) { + s.Equal(collectionName, dir.GetCollectionName()) + s.Equal(indexName, dir.GetIndexName()) + return &milvuspb.DescribeIndexResponse{ + Status: merr.Success(), + IndexDescriptions: []*milvuspb.IndexDescription{ + {IndexName: indexName, Params: []*commonpb.KeyValuePair{ + {Key: index.IndexTypeKey, Value: string(index.HNSW)}, + }}, + }, + }, nil + }).Once() + + index, err := s.client.DescribeIndex(ctx, NewDescribeIndexOption(collectionName, indexName)) + s.NoError(err) + s.Equal(indexName, index.Name()) + }) + + s.Run("no_index_found", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + indexName := fmt.Sprintf("idx_%s", s.randString(6)) + s.mock.EXPECT().DescribeIndex(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, dir *milvuspb.DescribeIndexRequest) (*milvuspb.DescribeIndexResponse, error) { + s.Equal(collectionName, dir.GetCollectionName()) + s.Equal(indexName, dir.GetIndexName()) + return &milvuspb.DescribeIndexResponse{ + Status: merr.Success(), + IndexDescriptions: []*milvuspb.IndexDescription{}, + }, nil + }).Once() + + _, err := s.client.DescribeIndex(ctx, NewDescribeIndexOption(collectionName, indexName)) + s.Error(err) + s.ErrorIs(err, merr.ErrIndexNotFound) + }) + + s.Run("failure", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + indexName := fmt.Sprintf("idx_%s", s.randString(6)) + s.mock.EXPECT().DescribeIndex(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + _, err := s.client.DescribeIndex(ctx, NewDescribeIndexOption(collectionName, indexName)) + s.Error(err) + }) +} + +func (s *IndexSuite) TestDropIndexOption() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + indexName := fmt.Sprintf("idx_%s", s.randString(6)) + opt := NewDropIndexOption(collectionName, indexName) + req := opt.Request() + + s.Equal(collectionName, req.GetCollectionName()) + s.Equal(indexName, req.GetIndexName()) +} + +func (s *IndexSuite) TestDropIndex() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + s.Run("success", func() { + s.mock.EXPECT().DropIndex(mock.Anything, mock.Anything).Return(merr.Success(), nil).Once() + + err := s.client.DropIndex(ctx, NewDropIndexOption("testCollection", "testIndex")) + s.NoError(err) + }) + + s.Run("failure", func() { + s.mock.EXPECT().DropIndex(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + err := s.client.DropIndex(ctx, NewDropIndexOption("testCollection", "testIndex")) + s.Error(err) + }) +} + +func TestIndex(t *testing.T) { + suite.Run(t, new(IndexSuite)) +} diff --git a/client/maintenance.go b/client/maintenance.go new file mode 100644 index 0000000000000..98ec167b39de1 --- /dev/null +++ b/client/maintenance.go @@ -0,0 +1,171 @@ +// 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 client + +import ( + "context" + "time" + + "google.golang.org/grpc" + + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus/pkg/util/merr" +) + +type LoadTask struct { + client *Client + collectionName string + partitionNames []string + interval time.Duration +} + +func (t *LoadTask) Await(ctx context.Context) error { + ticker := time.NewTicker(t.interval) + defer ticker.Stop() + for { + select { + case <-ticker.C: + loaded := false + t.client.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.GetLoadingProgress(ctx, &milvuspb.GetLoadingProgressRequest{ + CollectionName: t.collectionName, + PartitionNames: t.partitionNames, + }) + if err = merr.CheckRPCCall(resp, err); err != nil { + return err + } + loaded = resp.GetProgress() == 100 + return nil + }) + if loaded { + return nil + } + ticker.Reset(t.interval) + case <-ctx.Done(): + return ctx.Err() + } + } +} + +func (c *Client) LoadCollection(ctx context.Context, option LoadCollectionOption, callOptions ...grpc.CallOption) (LoadTask, error) { + req := option.Request() + + var task LoadTask + + err := c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.LoadCollection(ctx, req, callOptions...) + if err = merr.CheckRPCCall(resp, err); err != nil { + return err + } + + task = LoadTask{ + client: c, + collectionName: req.GetCollectionName(), + interval: option.CheckInterval(), + } + + return nil + }) + return task, err +} + +func (c *Client) LoadPartitions(ctx context.Context, option LoadPartitionsOption, callOptions ...grpc.CallOption) (LoadTask, error) { + req := option.Request() + + var task LoadTask + + err := c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.LoadPartitions(ctx, req, callOptions...) + if err = merr.CheckRPCCall(resp, err); err != nil { + return err + } + + task = LoadTask{ + client: c, + collectionName: req.GetCollectionName(), + partitionNames: req.GetPartitionNames(), + interval: option.CheckInterval(), + } + + return nil + }) + return task, err +} + +type FlushTask struct { + client *Client + collectionName string + segmentIDs []int64 + flushTs uint64 + interval time.Duration +} + +func (t *FlushTask) Await(ctx context.Context) error { + ticker := time.NewTicker(t.interval) + defer ticker.Stop() + for { + select { + case <-ticker.C: + flushed := false + t.client.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.GetFlushState(ctx, &milvuspb.GetFlushStateRequest{ + CollectionName: t.collectionName, + SegmentIDs: t.segmentIDs, + FlushTs: t.flushTs, + }) + err = merr.CheckRPCCall(resp, err) + if err != nil { + return err + } + flushed = resp.GetFlushed() + + return nil + }) + if flushed { + return nil + } + ticker.Reset(t.interval) + case <-ctx.Done(): + return ctx.Err() + } + } +} + +func (c *Client) Flush(ctx context.Context, option FlushOption, callOptions ...grpc.CallOption) (*FlushTask, error) { + req := option.Request() + collectionName := option.CollectionName() + var task *FlushTask + + err := c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.Flush(ctx, req, callOptions...) + err = merr.CheckRPCCall(resp, err) + if err != nil { + return err + } + + task = &FlushTask{ + client: c, + collectionName: collectionName, + segmentIDs: resp.GetCollSegIDs()[collectionName].GetData(), + flushTs: resp.GetCollFlushTs()[collectionName], + interval: option.CheckInterval(), + } + + return nil + }) + return task, err +} diff --git a/client/maintenance_options.go b/client/maintenance_options.go new file mode 100644 index 0000000000000..37bd4423895fa --- /dev/null +++ b/client/maintenance_options.go @@ -0,0 +1,125 @@ +// 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 client + +import ( + "time" + + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" +) + +type LoadCollectionOption interface { + Request() *milvuspb.LoadCollectionRequest + CheckInterval() time.Duration +} + +type loadCollectionOption struct { + collectionName string + interval time.Duration + replicaNum int +} + +func (opt *loadCollectionOption) Request() *milvuspb.LoadCollectionRequest { + return &milvuspb.LoadCollectionRequest{ + CollectionName: opt.collectionName, + ReplicaNumber: int32(opt.replicaNum), + } +} + +func (opt *loadCollectionOption) CheckInterval() time.Duration { + return opt.interval +} + +func (opt *loadCollectionOption) WithReplica(num int) *loadCollectionOption { + opt.replicaNum = num + return opt +} + +func NewLoadCollectionOption(collectionName string) *loadCollectionOption { + return &loadCollectionOption{ + collectionName: collectionName, + replicaNum: 1, + interval: time.Millisecond * 200, + } +} + +type LoadPartitionsOption interface { + Request() *milvuspb.LoadPartitionsRequest + CheckInterval() time.Duration +} + +var _ LoadPartitionsOption = (*loadPartitionsOption)(nil) + +type loadPartitionsOption struct { + collectionName string + partitionNames []string + interval time.Duration + replicaNum int +} + +func (opt *loadPartitionsOption) Request() *milvuspb.LoadPartitionsRequest { + return &milvuspb.LoadPartitionsRequest{ + CollectionName: opt.collectionName, + PartitionNames: opt.partitionNames, + ReplicaNumber: int32(opt.replicaNum), + } +} + +func (opt *loadPartitionsOption) CheckInterval() time.Duration { + return opt.interval +} + +func NewLoadPartitionsOption(collectionName string, partitionsNames []string) *loadPartitionsOption { + return &loadPartitionsOption{ + collectionName: collectionName, + partitionNames: partitionsNames, + replicaNum: 1, + interval: time.Millisecond * 200, + } +} + +type FlushOption interface { + Request() *milvuspb.FlushRequest + CollectionName() string + CheckInterval() time.Duration +} + +type flushOption struct { + collectionName string + interval time.Duration +} + +func (opt *flushOption) Request() *milvuspb.FlushRequest { + return &milvuspb.FlushRequest{ + CollectionNames: []string{opt.collectionName}, + } +} + +func (opt *flushOption) CollectionName() string { + return opt.collectionName +} + +func (opt *flushOption) CheckInterval() time.Duration { + return opt.interval +} + +func NewFlushOption(collName string) *flushOption { + return &flushOption{ + collectionName: collName, + interval: time.Millisecond * 200, + } +} diff --git a/client/maintenance_test.go b/client/maintenance_test.go new file mode 100644 index 0000000000000..333146f8ca4c9 --- /dev/null +++ b/client/maintenance_test.go @@ -0,0 +1,229 @@ +// 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 client + +import ( + "context" + "fmt" + "testing" + "time" + + "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/pkg/util/merr" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/suite" + "go.uber.org/atomic" +) + +type MaintenanceSuite struct { + MockSuiteBase +} + +func (s *MaintenanceSuite) TestLoadCollection() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + s.Run("success", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + + done := atomic.NewBool(false) + s.mock.EXPECT().LoadCollection(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, lcr *milvuspb.LoadCollectionRequest) (*commonpb.Status, error) { + s.Equal(collectionName, lcr.GetCollectionName()) + return merr.Success(), nil + }).Once() + s.mock.EXPECT().GetLoadingProgress(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, glpr *milvuspb.GetLoadingProgressRequest) (*milvuspb.GetLoadingProgressResponse, error) { + s.Equal(collectionName, glpr.GetCollectionName()) + + progress := int64(50) + if done.Load() { + progress = 100 + } + + return &milvuspb.GetLoadingProgressResponse{ + Status: merr.Success(), + Progress: progress, + }, nil + }) + defer s.mock.EXPECT().GetLoadingProgress(mock.Anything, mock.Anything).Unset() + + task, err := s.client.LoadCollection(ctx, NewLoadCollectionOption(collectionName)) + s.NoError(err) + + ch := make(chan struct{}) + go func() { + defer close(ch) + err := task.Await(ctx) + s.NoError(err) + }() + + select { + case <-ch: + s.FailNow("task done before index state set to finish") + case <-time.After(time.Second): + } + + done.Store(true) + + select { + case <-ch: + case <-time.After(time.Second): + s.FailNow("task not done after index set finished") + } + }) + + s.Run("failure", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + + s.mock.EXPECT().LoadCollection(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + _, err := s.client.LoadCollection(ctx, NewLoadCollectionOption(collectionName)) + s.Error(err) + }) +} + +func (s *MaintenanceSuite) TestLoadPartitions() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + s.Run("success", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + partitionName := fmt.Sprintf("part_%s", s.randString(6)) + + done := atomic.NewBool(false) + s.mock.EXPECT().LoadPartitions(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, lpr *milvuspb.LoadPartitionsRequest) (*commonpb.Status, error) { + s.Equal(collectionName, lpr.GetCollectionName()) + s.ElementsMatch([]string{partitionName}, lpr.GetPartitionNames()) + return merr.Success(), nil + }).Once() + s.mock.EXPECT().GetLoadingProgress(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, glpr *milvuspb.GetLoadingProgressRequest) (*milvuspb.GetLoadingProgressResponse, error) { + s.Equal(collectionName, glpr.GetCollectionName()) + s.ElementsMatch([]string{partitionName}, glpr.GetPartitionNames()) + + progress := int64(50) + if done.Load() { + progress = 100 + } + + return &milvuspb.GetLoadingProgressResponse{ + Status: merr.Success(), + Progress: progress, + }, nil + }) + defer s.mock.EXPECT().GetLoadingProgress(mock.Anything, mock.Anything).Unset() + + task, err := s.client.LoadPartitions(ctx, NewLoadPartitionsOption(collectionName, []string{partitionName})) + s.NoError(err) + + ch := make(chan struct{}) + go func() { + defer close(ch) + err := task.Await(ctx) + s.NoError(err) + }() + + select { + case <-ch: + s.FailNow("task done before index state set to finish") + case <-time.After(time.Second): + } + + done.Store(true) + + select { + case <-ch: + case <-time.After(time.Second): + s.FailNow("task not done after index set finished") + } + }) + + s.Run("failure", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + partitionName := fmt.Sprintf("part_%s", s.randString(6)) + + s.mock.EXPECT().LoadPartitions(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + _, err := s.client.LoadPartitions(ctx, NewLoadPartitionsOption(collectionName, []string{partitionName})) + s.Error(err) + }) +} + +func (s *MaintenanceSuite) TestFlush() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + s.Run("success", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + + done := atomic.NewBool(false) + s.mock.EXPECT().Flush(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, fr *milvuspb.FlushRequest) (*milvuspb.FlushResponse, error) { + s.ElementsMatch([]string{collectionName}, fr.GetCollectionNames()) + return &milvuspb.FlushResponse{ + Status: merr.Success(), + CollSegIDs: map[string]*schemapb.LongArray{ + collectionName: {Data: []int64{1, 2, 3}}, + }, + CollFlushTs: map[string]uint64{collectionName: 321}, + }, nil + }).Once() + s.mock.EXPECT().GetFlushState(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, gfsr *milvuspb.GetFlushStateRequest) (*milvuspb.GetFlushStateResponse, error) { + s.Equal(collectionName, gfsr.GetCollectionName()) + s.ElementsMatch([]int64{1, 2, 3}, gfsr.GetSegmentIDs()) + s.EqualValues(321, gfsr.GetFlushTs()) + return &milvuspb.GetFlushStateResponse{ + Status: merr.Success(), + Flushed: done.Load(), + }, nil + }) + defer s.mock.EXPECT().GetFlushState(mock.Anything, mock.Anything).Unset() + + task, err := s.client.Flush(ctx, NewFlushOption(collectionName)) + s.NoError(err) + + ch := make(chan struct{}) + go func() { + defer close(ch) + err := task.Await(ctx) + s.NoError(err) + }() + + select { + case <-ch: + s.FailNow("task done before index state set to finish") + case <-time.After(time.Second): + } + + done.Store(true) + + select { + case <-ch: + case <-time.After(time.Second): + s.FailNow("task not done after index set finished") + } + }) + + s.Run("failure", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + + s.mock.EXPECT().Flush(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + _, err := s.client.Flush(ctx, NewFlushOption(collectionName)) + s.Error(err) + }) +} + +func TestMaintenance(t *testing.T) { + suite.Run(t, new(MaintenanceSuite)) +} diff --git a/client/mock_milvus_server_test.go b/client/mock_milvus_server_test.go new file mode 100644 index 0000000000000..1f4adeb7e7635 --- /dev/null +++ b/client/mock_milvus_server_test.go @@ -0,0 +1,4717 @@ +// Code generated by mockery v2.32.4. DO NOT EDIT. + +package client + +import ( + context "context" + + commonpb "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" + + federpb "github.com/milvus-io/milvus-proto/go-api/v2/federpb" + + milvuspb "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + + mock "github.com/stretchr/testify/mock" +) + +// MilvusServiceServer is an autogenerated mock type for the MilvusServiceServer type +type MilvusServiceServer struct { + mock.Mock +} + +type MilvusServiceServer_Expecter struct { + mock *mock.Mock +} + +func (_m *MilvusServiceServer) EXPECT() *MilvusServiceServer_Expecter { + return &MilvusServiceServer_Expecter{mock: &_m.Mock} +} + +// AllocTimestamp provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) AllocTimestamp(_a0 context.Context, _a1 *milvuspb.AllocTimestampRequest) (*milvuspb.AllocTimestampResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.AllocTimestampResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AllocTimestampRequest) (*milvuspb.AllocTimestampResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AllocTimestampRequest) *milvuspb.AllocTimestampResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.AllocTimestampResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.AllocTimestampRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_AllocTimestamp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AllocTimestamp' +type MilvusServiceServer_AllocTimestamp_Call struct { + *mock.Call +} + +// AllocTimestamp is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_AllocTimestamp_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.AllocTimestampRequest)) *MilvusServiceServer_AllocTimestamp_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.AllocTimestampRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_AllocTimestamp_Call) Return(_a0 *milvuspb.AllocTimestampResponse, _a1 error) *MilvusServiceServer_AllocTimestamp_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_AllocTimestamp_Call) RunAndReturn(run func(context.Context, *milvuspb.AllocTimestampRequest) (*milvuspb.AllocTimestampResponse, error)) *MilvusServiceServer_AllocTimestamp_Call { + _c.Call.Return(run) + return _c +} + +// AlterAlias provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) AlterAlias(_a0 context.Context, _a1 *milvuspb.AlterAliasRequest) (*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.AlterAliasRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AlterAliasRequest) *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.AlterAliasRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_AlterAlias_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AlterAlias' +type MilvusServiceServer_AlterAlias_Call struct { + *mock.Call +} + +// AlterAlias is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_AlterAlias_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.AlterAliasRequest)) *MilvusServiceServer_AlterAlias_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.AlterAliasRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_AlterAlias_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_AlterAlias_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_AlterAlias_Call) RunAndReturn(run func(context.Context, *milvuspb.AlterAliasRequest) (*commonpb.Status, error)) *MilvusServiceServer_AlterAlias_Call { + _c.Call.Return(run) + return _c +} + +// AlterCollection provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) AlterCollection(_a0 context.Context, _a1 *milvuspb.AlterCollectionRequest) (*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.AlterCollectionRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AlterCollectionRequest) *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.AlterCollectionRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_AlterCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AlterCollection' +type MilvusServiceServer_AlterCollection_Call struct { + *mock.Call +} + +// AlterCollection is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_AlterCollection_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.AlterCollectionRequest)) *MilvusServiceServer_AlterCollection_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.AlterCollectionRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_AlterCollection_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_AlterCollection_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_AlterCollection_Call) RunAndReturn(run func(context.Context, *milvuspb.AlterCollectionRequest) (*commonpb.Status, error)) *MilvusServiceServer_AlterCollection_Call { + _c.Call.Return(run) + return _c +} + +// AlterDatabase provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) AlterDatabase(_a0 context.Context, _a1 *milvuspb.AlterDatabaseRequest) (*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.AlterDatabaseRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AlterDatabaseRequest) *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.AlterDatabaseRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_AlterDatabase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AlterDatabase' +type MilvusServiceServer_AlterDatabase_Call struct { + *mock.Call +} + +// AlterDatabase is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *milvuspb.AlterDatabaseRequest +func (_e *MilvusServiceServer_Expecter) AlterDatabase(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_AlterDatabase_Call { + return &MilvusServiceServer_AlterDatabase_Call{Call: _e.mock.On("AlterDatabase", _a0, _a1)} +} + +func (_c *MilvusServiceServer_AlterDatabase_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.AlterDatabaseRequest)) *MilvusServiceServer_AlterDatabase_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.AlterDatabaseRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_AlterDatabase_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_AlterDatabase_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_AlterDatabase_Call) RunAndReturn(run func(context.Context, *milvuspb.AlterDatabaseRequest) (*commonpb.Status, error)) *MilvusServiceServer_AlterDatabase_Call { + _c.Call.Return(run) + 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) + + var r0 *milvuspb.CalcDistanceResults + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CalcDistanceRequest) (*milvuspb.CalcDistanceResults, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CalcDistanceRequest) *milvuspb.CalcDistanceResults); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.CalcDistanceResults) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.CalcDistanceRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_CalcDistance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CalcDistance' +type MilvusServiceServer_CalcDistance_Call struct { + *mock.Call +} + +// CalcDistance is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_CalcDistance_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.CalcDistanceRequest)) *MilvusServiceServer_CalcDistance_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.CalcDistanceRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_CalcDistance_Call) Return(_a0 *milvuspb.CalcDistanceResults, _a1 error) *MilvusServiceServer_CalcDistance_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_CalcDistance_Call) RunAndReturn(run func(context.Context, *milvuspb.CalcDistanceRequest) (*milvuspb.CalcDistanceResults, error)) *MilvusServiceServer_CalcDistance_Call { + _c.Call.Return(run) + return _c +} + +// CheckHealth provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) CheckHealth(_a0 context.Context, _a1 *milvuspb.CheckHealthRequest) (*milvuspb.CheckHealthResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.CheckHealthResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CheckHealthRequest) (*milvuspb.CheckHealthResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CheckHealthRequest) *milvuspb.CheckHealthResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.CheckHealthResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.CheckHealthRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_CheckHealth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckHealth' +type MilvusServiceServer_CheckHealth_Call struct { + *mock.Call +} + +// CheckHealth is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_CheckHealth_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.CheckHealthRequest)) *MilvusServiceServer_CheckHealth_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.CheckHealthRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_CheckHealth_Call) Return(_a0 *milvuspb.CheckHealthResponse, _a1 error) *MilvusServiceServer_CheckHealth_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_CheckHealth_Call) RunAndReturn(run func(context.Context, *milvuspb.CheckHealthRequest) (*milvuspb.CheckHealthResponse, error)) *MilvusServiceServer_CheckHealth_Call { + _c.Call.Return(run) + return _c +} + +// Connect provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) Connect(_a0 context.Context, _a1 *milvuspb.ConnectRequest) (*milvuspb.ConnectResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.ConnectResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ConnectRequest) (*milvuspb.ConnectResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ConnectRequest) *milvuspb.ConnectResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.ConnectResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.ConnectRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_Connect_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Connect' +type MilvusServiceServer_Connect_Call struct { + *mock.Call +} + +// Connect is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_Connect_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.ConnectRequest)) *MilvusServiceServer_Connect_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.ConnectRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_Connect_Call) Return(_a0 *milvuspb.ConnectResponse, _a1 error) *MilvusServiceServer_Connect_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_Connect_Call) RunAndReturn(run func(context.Context, *milvuspb.ConnectRequest) (*milvuspb.ConnectResponse, error)) *MilvusServiceServer_Connect_Call { + _c.Call.Return(run) + return _c +} + +// CreateAlias provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) CreateAlias(_a0 context.Context, _a1 *milvuspb.CreateAliasRequest) (*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.CreateAliasRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CreateAliasRequest) *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.CreateAliasRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_CreateAlias_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateAlias' +type MilvusServiceServer_CreateAlias_Call struct { + *mock.Call +} + +// CreateAlias is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_CreateAlias_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.CreateAliasRequest)) *MilvusServiceServer_CreateAlias_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.CreateAliasRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_CreateAlias_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_CreateAlias_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_CreateAlias_Call) RunAndReturn(run func(context.Context, *milvuspb.CreateAliasRequest) (*commonpb.Status, error)) *MilvusServiceServer_CreateAlias_Call { + _c.Call.Return(run) + return _c +} + +// CreateCollection provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) CreateCollection(_a0 context.Context, _a1 *milvuspb.CreateCollectionRequest) (*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.CreateCollectionRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CreateCollectionRequest) *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.CreateCollectionRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_CreateCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateCollection' +type MilvusServiceServer_CreateCollection_Call struct { + *mock.Call +} + +// CreateCollection is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_CreateCollection_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.CreateCollectionRequest)) *MilvusServiceServer_CreateCollection_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.CreateCollectionRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_CreateCollection_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_CreateCollection_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_CreateCollection_Call) RunAndReturn(run func(context.Context, *milvuspb.CreateCollectionRequest) (*commonpb.Status, error)) *MilvusServiceServer_CreateCollection_Call { + _c.Call.Return(run) + return _c +} + +// CreateCredential provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) CreateCredential(_a0 context.Context, _a1 *milvuspb.CreateCredentialRequest) (*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.CreateCredentialRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CreateCredentialRequest) *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.CreateCredentialRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_CreateCredential_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateCredential' +type MilvusServiceServer_CreateCredential_Call struct { + *mock.Call +} + +// CreateCredential is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_CreateCredential_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.CreateCredentialRequest)) *MilvusServiceServer_CreateCredential_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.CreateCredentialRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_CreateCredential_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_CreateCredential_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_CreateCredential_Call) RunAndReturn(run func(context.Context, *milvuspb.CreateCredentialRequest) (*commonpb.Status, error)) *MilvusServiceServer_CreateCredential_Call { + _c.Call.Return(run) + return _c +} + +// CreateDatabase provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) CreateDatabase(_a0 context.Context, _a1 *milvuspb.CreateDatabaseRequest) (*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.CreateDatabaseRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CreateDatabaseRequest) *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.CreateDatabaseRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_CreateDatabase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateDatabase' +type MilvusServiceServer_CreateDatabase_Call struct { + *mock.Call +} + +// CreateDatabase is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_CreateDatabase_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.CreateDatabaseRequest)) *MilvusServiceServer_CreateDatabase_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.CreateDatabaseRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_CreateDatabase_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_CreateDatabase_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_CreateDatabase_Call) RunAndReturn(run func(context.Context, *milvuspb.CreateDatabaseRequest) (*commonpb.Status, error)) *MilvusServiceServer_CreateDatabase_Call { + _c.Call.Return(run) + return _c +} + +// CreateIndex provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) CreateIndex(_a0 context.Context, _a1 *milvuspb.CreateIndexRequest) (*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.CreateIndexRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CreateIndexRequest) *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.CreateIndexRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_CreateIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateIndex' +type MilvusServiceServer_CreateIndex_Call struct { + *mock.Call +} + +// CreateIndex is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_CreateIndex_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.CreateIndexRequest)) *MilvusServiceServer_CreateIndex_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.CreateIndexRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_CreateIndex_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_CreateIndex_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_CreateIndex_Call) RunAndReturn(run func(context.Context, *milvuspb.CreateIndexRequest) (*commonpb.Status, error)) *MilvusServiceServer_CreateIndex_Call { + _c.Call.Return(run) + return _c +} + +// CreatePartition provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) CreatePartition(_a0 context.Context, _a1 *milvuspb.CreatePartitionRequest) (*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.CreatePartitionRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CreatePartitionRequest) *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.CreatePartitionRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_CreatePartition_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreatePartition' +type MilvusServiceServer_CreatePartition_Call struct { + *mock.Call +} + +// CreatePartition is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_CreatePartition_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.CreatePartitionRequest)) *MilvusServiceServer_CreatePartition_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.CreatePartitionRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_CreatePartition_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_CreatePartition_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_CreatePartition_Call) RunAndReturn(run func(context.Context, *milvuspb.CreatePartitionRequest) (*commonpb.Status, error)) *MilvusServiceServer_CreatePartition_Call { + _c.Call.Return(run) + return _c +} + +// CreateResourceGroup provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) CreateResourceGroup(_a0 context.Context, _a1 *milvuspb.CreateResourceGroupRequest) (*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.CreateResourceGroupRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CreateResourceGroupRequest) *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.CreateResourceGroupRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_CreateResourceGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateResourceGroup' +type MilvusServiceServer_CreateResourceGroup_Call struct { + *mock.Call +} + +// CreateResourceGroup is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_CreateResourceGroup_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.CreateResourceGroupRequest)) *MilvusServiceServer_CreateResourceGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.CreateResourceGroupRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_CreateResourceGroup_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_CreateResourceGroup_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_CreateResourceGroup_Call) RunAndReturn(run func(context.Context, *milvuspb.CreateResourceGroupRequest) (*commonpb.Status, error)) *MilvusServiceServer_CreateResourceGroup_Call { + _c.Call.Return(run) + return _c +} + +// CreateRole provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) CreateRole(_a0 context.Context, _a1 *milvuspb.CreateRoleRequest) (*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.CreateRoleRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CreateRoleRequest) *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.CreateRoleRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_CreateRole_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateRole' +type MilvusServiceServer_CreateRole_Call struct { + *mock.Call +} + +// CreateRole is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_CreateRole_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.CreateRoleRequest)) *MilvusServiceServer_CreateRole_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.CreateRoleRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_CreateRole_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_CreateRole_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_CreateRole_Call) RunAndReturn(run func(context.Context, *milvuspb.CreateRoleRequest) (*commonpb.Status, error)) *MilvusServiceServer_CreateRole_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) Delete(_a0 context.Context, _a1 *milvuspb.DeleteRequest) (*milvuspb.MutationResult, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.MutationResult + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DeleteRequest) (*milvuspb.MutationResult, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DeleteRequest) *milvuspb.MutationResult); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.MutationResult) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.DeleteRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MilvusServiceServer_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_Delete_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.DeleteRequest)) *MilvusServiceServer_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.DeleteRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_Delete_Call) Return(_a0 *milvuspb.MutationResult, _a1 error) *MilvusServiceServer_Delete_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_Delete_Call) RunAndReturn(run func(context.Context, *milvuspb.DeleteRequest) (*milvuspb.MutationResult, error)) *MilvusServiceServer_Delete_Call { + _c.Call.Return(run) + return _c +} + +// DeleteCredential provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) DeleteCredential(_a0 context.Context, _a1 *milvuspb.DeleteCredentialRequest) (*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.DeleteCredentialRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DeleteCredentialRequest) *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.DeleteCredentialRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_DeleteCredential_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteCredential' +type MilvusServiceServer_DeleteCredential_Call struct { + *mock.Call +} + +// DeleteCredential is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_DeleteCredential_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.DeleteCredentialRequest)) *MilvusServiceServer_DeleteCredential_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.DeleteCredentialRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_DeleteCredential_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_DeleteCredential_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_DeleteCredential_Call) RunAndReturn(run func(context.Context, *milvuspb.DeleteCredentialRequest) (*commonpb.Status, error)) *MilvusServiceServer_DeleteCredential_Call { + _c.Call.Return(run) + return _c +} + +// DescribeAlias provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) DescribeAlias(_a0 context.Context, _a1 *milvuspb.DescribeAliasRequest) (*milvuspb.DescribeAliasResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.DescribeAliasResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DescribeAliasRequest) (*milvuspb.DescribeAliasResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DescribeAliasRequest) *milvuspb.DescribeAliasResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.DescribeAliasResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.DescribeAliasRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_DescribeAlias_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DescribeAlias' +type MilvusServiceServer_DescribeAlias_Call struct { + *mock.Call +} + +// DescribeAlias is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_DescribeAlias_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.DescribeAliasRequest)) *MilvusServiceServer_DescribeAlias_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.DescribeAliasRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_DescribeAlias_Call) Return(_a0 *milvuspb.DescribeAliasResponse, _a1 error) *MilvusServiceServer_DescribeAlias_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_DescribeAlias_Call) RunAndReturn(run func(context.Context, *milvuspb.DescribeAliasRequest) (*milvuspb.DescribeAliasResponse, error)) *MilvusServiceServer_DescribeAlias_Call { + _c.Call.Return(run) + return _c +} + +// DescribeCollection provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) DescribeCollection(_a0 context.Context, _a1 *milvuspb.DescribeCollectionRequest) (*milvuspb.DescribeCollectionResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.DescribeCollectionResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DescribeCollectionRequest) (*milvuspb.DescribeCollectionResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DescribeCollectionRequest) *milvuspb.DescribeCollectionResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.DescribeCollectionResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.DescribeCollectionRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_DescribeCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DescribeCollection' +type MilvusServiceServer_DescribeCollection_Call struct { + *mock.Call +} + +// DescribeCollection is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_DescribeCollection_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.DescribeCollectionRequest)) *MilvusServiceServer_DescribeCollection_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.DescribeCollectionRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_DescribeCollection_Call) Return(_a0 *milvuspb.DescribeCollectionResponse, _a1 error) *MilvusServiceServer_DescribeCollection_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_DescribeCollection_Call) RunAndReturn(run func(context.Context, *milvuspb.DescribeCollectionRequest) (*milvuspb.DescribeCollectionResponse, error)) *MilvusServiceServer_DescribeCollection_Call { + _c.Call.Return(run) + return _c +} + +// DescribeIndex provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) DescribeIndex(_a0 context.Context, _a1 *milvuspb.DescribeIndexRequest) (*milvuspb.DescribeIndexResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.DescribeIndexResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DescribeIndexRequest) (*milvuspb.DescribeIndexResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DescribeIndexRequest) *milvuspb.DescribeIndexResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.DescribeIndexResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.DescribeIndexRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_DescribeIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DescribeIndex' +type MilvusServiceServer_DescribeIndex_Call struct { + *mock.Call +} + +// DescribeIndex is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_DescribeIndex_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.DescribeIndexRequest)) *MilvusServiceServer_DescribeIndex_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.DescribeIndexRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_DescribeIndex_Call) Return(_a0 *milvuspb.DescribeIndexResponse, _a1 error) *MilvusServiceServer_DescribeIndex_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_DescribeIndex_Call) RunAndReturn(run func(context.Context, *milvuspb.DescribeIndexRequest) (*milvuspb.DescribeIndexResponse, error)) *MilvusServiceServer_DescribeIndex_Call { + _c.Call.Return(run) + return _c +} + +// DescribeResourceGroup provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) DescribeResourceGroup(_a0 context.Context, _a1 *milvuspb.DescribeResourceGroupRequest) (*milvuspb.DescribeResourceGroupResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.DescribeResourceGroupResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DescribeResourceGroupRequest) (*milvuspb.DescribeResourceGroupResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DescribeResourceGroupRequest) *milvuspb.DescribeResourceGroupResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.DescribeResourceGroupResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.DescribeResourceGroupRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_DescribeResourceGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DescribeResourceGroup' +type MilvusServiceServer_DescribeResourceGroup_Call struct { + *mock.Call +} + +// DescribeResourceGroup is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_DescribeResourceGroup_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.DescribeResourceGroupRequest)) *MilvusServiceServer_DescribeResourceGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.DescribeResourceGroupRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_DescribeResourceGroup_Call) Return(_a0 *milvuspb.DescribeResourceGroupResponse, _a1 error) *MilvusServiceServer_DescribeResourceGroup_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_DescribeResourceGroup_Call) RunAndReturn(run func(context.Context, *milvuspb.DescribeResourceGroupRequest) (*milvuspb.DescribeResourceGroupResponse, error)) *MilvusServiceServer_DescribeResourceGroup_Call { + _c.Call.Return(run) + return _c +} + +// DescribeSegmentIndexData provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) DescribeSegmentIndexData(_a0 context.Context, _a1 *federpb.DescribeSegmentIndexDataRequest) (*federpb.DescribeSegmentIndexDataResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *federpb.DescribeSegmentIndexDataResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *federpb.DescribeSegmentIndexDataRequest) (*federpb.DescribeSegmentIndexDataResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *federpb.DescribeSegmentIndexDataRequest) *federpb.DescribeSegmentIndexDataResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*federpb.DescribeSegmentIndexDataResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *federpb.DescribeSegmentIndexDataRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_DescribeSegmentIndexData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DescribeSegmentIndexData' +type MilvusServiceServer_DescribeSegmentIndexData_Call struct { + *mock.Call +} + +// DescribeSegmentIndexData is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_DescribeSegmentIndexData_Call) Run(run func(_a0 context.Context, _a1 *federpb.DescribeSegmentIndexDataRequest)) *MilvusServiceServer_DescribeSegmentIndexData_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*federpb.DescribeSegmentIndexDataRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_DescribeSegmentIndexData_Call) Return(_a0 *federpb.DescribeSegmentIndexDataResponse, _a1 error) *MilvusServiceServer_DescribeSegmentIndexData_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_DescribeSegmentIndexData_Call) RunAndReturn(run func(context.Context, *federpb.DescribeSegmentIndexDataRequest) (*federpb.DescribeSegmentIndexDataResponse, error)) *MilvusServiceServer_DescribeSegmentIndexData_Call { + _c.Call.Return(run) + return _c +} + +// DropAlias provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) DropAlias(_a0 context.Context, _a1 *milvuspb.DropAliasRequest) (*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.DropAliasRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DropAliasRequest) *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.DropAliasRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_DropAlias_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropAlias' +type MilvusServiceServer_DropAlias_Call struct { + *mock.Call +} + +// DropAlias is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_DropAlias_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.DropAliasRequest)) *MilvusServiceServer_DropAlias_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.DropAliasRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_DropAlias_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_DropAlias_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_DropAlias_Call) RunAndReturn(run func(context.Context, *milvuspb.DropAliasRequest) (*commonpb.Status, error)) *MilvusServiceServer_DropAlias_Call { + _c.Call.Return(run) + return _c +} + +// DropCollection provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) DropCollection(_a0 context.Context, _a1 *milvuspb.DropCollectionRequest) (*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.DropCollectionRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DropCollectionRequest) *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.DropCollectionRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_DropCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropCollection' +type MilvusServiceServer_DropCollection_Call struct { + *mock.Call +} + +// DropCollection is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_DropCollection_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.DropCollectionRequest)) *MilvusServiceServer_DropCollection_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.DropCollectionRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_DropCollection_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_DropCollection_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_DropCollection_Call) RunAndReturn(run func(context.Context, *milvuspb.DropCollectionRequest) (*commonpb.Status, error)) *MilvusServiceServer_DropCollection_Call { + _c.Call.Return(run) + return _c +} + +// DropDatabase provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) DropDatabase(_a0 context.Context, _a1 *milvuspb.DropDatabaseRequest) (*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.DropDatabaseRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DropDatabaseRequest) *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.DropDatabaseRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_DropDatabase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropDatabase' +type MilvusServiceServer_DropDatabase_Call struct { + *mock.Call +} + +// DropDatabase is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_DropDatabase_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.DropDatabaseRequest)) *MilvusServiceServer_DropDatabase_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.DropDatabaseRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_DropDatabase_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_DropDatabase_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_DropDatabase_Call) RunAndReturn(run func(context.Context, *milvuspb.DropDatabaseRequest) (*commonpb.Status, error)) *MilvusServiceServer_DropDatabase_Call { + _c.Call.Return(run) + return _c +} + +// DropIndex provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) DropIndex(_a0 context.Context, _a1 *milvuspb.DropIndexRequest) (*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.DropIndexRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DropIndexRequest) *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.DropIndexRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_DropIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropIndex' +type MilvusServiceServer_DropIndex_Call struct { + *mock.Call +} + +// DropIndex is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_DropIndex_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.DropIndexRequest)) *MilvusServiceServer_DropIndex_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.DropIndexRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_DropIndex_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_DropIndex_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_DropIndex_Call) RunAndReturn(run func(context.Context, *milvuspb.DropIndexRequest) (*commonpb.Status, error)) *MilvusServiceServer_DropIndex_Call { + _c.Call.Return(run) + return _c +} + +// DropPartition provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) DropPartition(_a0 context.Context, _a1 *milvuspb.DropPartitionRequest) (*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.DropPartitionRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DropPartitionRequest) *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.DropPartitionRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_DropPartition_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropPartition' +type MilvusServiceServer_DropPartition_Call struct { + *mock.Call +} + +// DropPartition is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_DropPartition_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.DropPartitionRequest)) *MilvusServiceServer_DropPartition_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.DropPartitionRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_DropPartition_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_DropPartition_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_DropPartition_Call) RunAndReturn(run func(context.Context, *milvuspb.DropPartitionRequest) (*commonpb.Status, error)) *MilvusServiceServer_DropPartition_Call { + _c.Call.Return(run) + return _c +} + +// DropResourceGroup provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) DropResourceGroup(_a0 context.Context, _a1 *milvuspb.DropResourceGroupRequest) (*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.DropResourceGroupRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DropResourceGroupRequest) *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.DropResourceGroupRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_DropResourceGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropResourceGroup' +type MilvusServiceServer_DropResourceGroup_Call struct { + *mock.Call +} + +// DropResourceGroup is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_DropResourceGroup_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.DropResourceGroupRequest)) *MilvusServiceServer_DropResourceGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.DropResourceGroupRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_DropResourceGroup_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_DropResourceGroup_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_DropResourceGroup_Call) RunAndReturn(run func(context.Context, *milvuspb.DropResourceGroupRequest) (*commonpb.Status, error)) *MilvusServiceServer_DropResourceGroup_Call { + _c.Call.Return(run) + return _c +} + +// DropRole provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) DropRole(_a0 context.Context, _a1 *milvuspb.DropRoleRequest) (*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.DropRoleRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DropRoleRequest) *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.DropRoleRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_DropRole_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropRole' +type MilvusServiceServer_DropRole_Call struct { + *mock.Call +} + +// DropRole is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_DropRole_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.DropRoleRequest)) *MilvusServiceServer_DropRole_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.DropRoleRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_DropRole_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_DropRole_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_DropRole_Call) RunAndReturn(run func(context.Context, *milvuspb.DropRoleRequest) (*commonpb.Status, error)) *MilvusServiceServer_DropRole_Call { + _c.Call.Return(run) + return _c +} + +// Dummy provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) Dummy(_a0 context.Context, _a1 *milvuspb.DummyRequest) (*milvuspb.DummyResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.DummyResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DummyRequest) (*milvuspb.DummyResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DummyRequest) *milvuspb.DummyResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.DummyResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.DummyRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_Dummy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Dummy' +type MilvusServiceServer_Dummy_Call struct { + *mock.Call +} + +// Dummy is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_Dummy_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.DummyRequest)) *MilvusServiceServer_Dummy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.DummyRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_Dummy_Call) Return(_a0 *milvuspb.DummyResponse, _a1 error) *MilvusServiceServer_Dummy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_Dummy_Call) RunAndReturn(run func(context.Context, *milvuspb.DummyRequest) (*milvuspb.DummyResponse, error)) *MilvusServiceServer_Dummy_Call { + _c.Call.Return(run) + return _c +} + +// Flush provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) Flush(_a0 context.Context, _a1 *milvuspb.FlushRequest) (*milvuspb.FlushResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.FlushResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.FlushRequest) (*milvuspb.FlushResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.FlushRequest) *milvuspb.FlushResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.FlushResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.FlushRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_Flush_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Flush' +type MilvusServiceServer_Flush_Call struct { + *mock.Call +} + +// Flush is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_Flush_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.FlushRequest)) *MilvusServiceServer_Flush_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.FlushRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_Flush_Call) Return(_a0 *milvuspb.FlushResponse, _a1 error) *MilvusServiceServer_Flush_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_Flush_Call) RunAndReturn(run func(context.Context, *milvuspb.FlushRequest) (*milvuspb.FlushResponse, error)) *MilvusServiceServer_Flush_Call { + _c.Call.Return(run) + return _c +} + +// FlushAll provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) FlushAll(_a0 context.Context, _a1 *milvuspb.FlushAllRequest) (*milvuspb.FlushAllResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.FlushAllResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.FlushAllRequest) (*milvuspb.FlushAllResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.FlushAllRequest) *milvuspb.FlushAllResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.FlushAllResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.FlushAllRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_FlushAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FlushAll' +type MilvusServiceServer_FlushAll_Call struct { + *mock.Call +} + +// FlushAll is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_FlushAll_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.FlushAllRequest)) *MilvusServiceServer_FlushAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.FlushAllRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_FlushAll_Call) Return(_a0 *milvuspb.FlushAllResponse, _a1 error) *MilvusServiceServer_FlushAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_FlushAll_Call) RunAndReturn(run func(context.Context, *milvuspb.FlushAllRequest) (*milvuspb.FlushAllResponse, error)) *MilvusServiceServer_FlushAll_Call { + _c.Call.Return(run) + return _c +} + +// GetCollectionStatistics provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) GetCollectionStatistics(_a0 context.Context, _a1 *milvuspb.GetCollectionStatisticsRequest) (*milvuspb.GetCollectionStatisticsResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.GetCollectionStatisticsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetCollectionStatisticsRequest) (*milvuspb.GetCollectionStatisticsResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetCollectionStatisticsRequest) *milvuspb.GetCollectionStatisticsResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.GetCollectionStatisticsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetCollectionStatisticsRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_GetCollectionStatistics_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCollectionStatistics' +type MilvusServiceServer_GetCollectionStatistics_Call struct { + *mock.Call +} + +// GetCollectionStatistics is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_GetCollectionStatistics_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetCollectionStatisticsRequest)) *MilvusServiceServer_GetCollectionStatistics_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.GetCollectionStatisticsRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_GetCollectionStatistics_Call) Return(_a0 *milvuspb.GetCollectionStatisticsResponse, _a1 error) *MilvusServiceServer_GetCollectionStatistics_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_GetCollectionStatistics_Call) RunAndReturn(run func(context.Context, *milvuspb.GetCollectionStatisticsRequest) (*milvuspb.GetCollectionStatisticsResponse, error)) *MilvusServiceServer_GetCollectionStatistics_Call { + _c.Call.Return(run) + return _c +} + +// GetCompactionState provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) GetCompactionState(_a0 context.Context, _a1 *milvuspb.GetCompactionStateRequest) (*milvuspb.GetCompactionStateResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.GetCompactionStateResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetCompactionStateRequest) (*milvuspb.GetCompactionStateResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetCompactionStateRequest) *milvuspb.GetCompactionStateResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.GetCompactionStateResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetCompactionStateRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_GetCompactionState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCompactionState' +type MilvusServiceServer_GetCompactionState_Call struct { + *mock.Call +} + +// GetCompactionState is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_GetCompactionState_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetCompactionStateRequest)) *MilvusServiceServer_GetCompactionState_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.GetCompactionStateRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_GetCompactionState_Call) Return(_a0 *milvuspb.GetCompactionStateResponse, _a1 error) *MilvusServiceServer_GetCompactionState_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_GetCompactionState_Call) RunAndReturn(run func(context.Context, *milvuspb.GetCompactionStateRequest) (*milvuspb.GetCompactionStateResponse, error)) *MilvusServiceServer_GetCompactionState_Call { + _c.Call.Return(run) + return _c +} + +// GetCompactionStateWithPlans provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) GetCompactionStateWithPlans(_a0 context.Context, _a1 *milvuspb.GetCompactionPlansRequest) (*milvuspb.GetCompactionPlansResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.GetCompactionPlansResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetCompactionPlansRequest) (*milvuspb.GetCompactionPlansResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetCompactionPlansRequest) *milvuspb.GetCompactionPlansResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.GetCompactionPlansResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetCompactionPlansRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_GetCompactionStateWithPlans_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCompactionStateWithPlans' +type MilvusServiceServer_GetCompactionStateWithPlans_Call struct { + *mock.Call +} + +// GetCompactionStateWithPlans is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_GetCompactionStateWithPlans_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetCompactionPlansRequest)) *MilvusServiceServer_GetCompactionStateWithPlans_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.GetCompactionPlansRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_GetCompactionStateWithPlans_Call) Return(_a0 *milvuspb.GetCompactionPlansResponse, _a1 error) *MilvusServiceServer_GetCompactionStateWithPlans_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_GetCompactionStateWithPlans_Call) RunAndReturn(run func(context.Context, *milvuspb.GetCompactionPlansRequest) (*milvuspb.GetCompactionPlansResponse, error)) *MilvusServiceServer_GetCompactionStateWithPlans_Call { + _c.Call.Return(run) + return _c +} + +// GetComponentStates provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) GetComponentStates(_a0 context.Context, _a1 *milvuspb.GetComponentStatesRequest) (*milvuspb.ComponentStates, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.ComponentStates + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetComponentStatesRequest) (*milvuspb.ComponentStates, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetComponentStatesRequest) *milvuspb.ComponentStates); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.ComponentStates) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetComponentStatesRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_GetComponentStates_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetComponentStates' +type MilvusServiceServer_GetComponentStates_Call struct { + *mock.Call +} + +// GetComponentStates is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_GetComponentStates_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetComponentStatesRequest)) *MilvusServiceServer_GetComponentStates_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.GetComponentStatesRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_GetComponentStates_Call) Return(_a0 *milvuspb.ComponentStates, _a1 error) *MilvusServiceServer_GetComponentStates_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_GetComponentStates_Call) RunAndReturn(run func(context.Context, *milvuspb.GetComponentStatesRequest) (*milvuspb.ComponentStates, error)) *MilvusServiceServer_GetComponentStates_Call { + _c.Call.Return(run) + return _c +} + +// GetFlushAllState provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) GetFlushAllState(_a0 context.Context, _a1 *milvuspb.GetFlushAllStateRequest) (*milvuspb.GetFlushAllStateResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.GetFlushAllStateResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetFlushAllStateRequest) (*milvuspb.GetFlushAllStateResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetFlushAllStateRequest) *milvuspb.GetFlushAllStateResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.GetFlushAllStateResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetFlushAllStateRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_GetFlushAllState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFlushAllState' +type MilvusServiceServer_GetFlushAllState_Call struct { + *mock.Call +} + +// GetFlushAllState is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_GetFlushAllState_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetFlushAllStateRequest)) *MilvusServiceServer_GetFlushAllState_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.GetFlushAllStateRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_GetFlushAllState_Call) Return(_a0 *milvuspb.GetFlushAllStateResponse, _a1 error) *MilvusServiceServer_GetFlushAllState_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_GetFlushAllState_Call) RunAndReturn(run func(context.Context, *milvuspb.GetFlushAllStateRequest) (*milvuspb.GetFlushAllStateResponse, error)) *MilvusServiceServer_GetFlushAllState_Call { + _c.Call.Return(run) + return _c +} + +// GetFlushState provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) GetFlushState(_a0 context.Context, _a1 *milvuspb.GetFlushStateRequest) (*milvuspb.GetFlushStateResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.GetFlushStateResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetFlushStateRequest) (*milvuspb.GetFlushStateResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetFlushStateRequest) *milvuspb.GetFlushStateResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.GetFlushStateResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetFlushStateRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_GetFlushState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFlushState' +type MilvusServiceServer_GetFlushState_Call struct { + *mock.Call +} + +// GetFlushState is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_GetFlushState_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetFlushStateRequest)) *MilvusServiceServer_GetFlushState_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.GetFlushStateRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_GetFlushState_Call) Return(_a0 *milvuspb.GetFlushStateResponse, _a1 error) *MilvusServiceServer_GetFlushState_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_GetFlushState_Call) RunAndReturn(run func(context.Context, *milvuspb.GetFlushStateRequest) (*milvuspb.GetFlushStateResponse, error)) *MilvusServiceServer_GetFlushState_Call { + _c.Call.Return(run) + return _c +} + +// GetImportState provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) GetImportState(_a0 context.Context, _a1 *milvuspb.GetImportStateRequest) (*milvuspb.GetImportStateResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.GetImportStateResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetImportStateRequest) (*milvuspb.GetImportStateResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetImportStateRequest) *milvuspb.GetImportStateResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.GetImportStateResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetImportStateRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_GetImportState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetImportState' +type MilvusServiceServer_GetImportState_Call struct { + *mock.Call +} + +// GetImportState is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_GetImportState_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetImportStateRequest)) *MilvusServiceServer_GetImportState_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.GetImportStateRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_GetImportState_Call) Return(_a0 *milvuspb.GetImportStateResponse, _a1 error) *MilvusServiceServer_GetImportState_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_GetImportState_Call) RunAndReturn(run func(context.Context, *milvuspb.GetImportStateRequest) (*milvuspb.GetImportStateResponse, error)) *MilvusServiceServer_GetImportState_Call { + _c.Call.Return(run) + return _c +} + +// GetIndexBuildProgress provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) GetIndexBuildProgress(_a0 context.Context, _a1 *milvuspb.GetIndexBuildProgressRequest) (*milvuspb.GetIndexBuildProgressResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.GetIndexBuildProgressResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetIndexBuildProgressRequest) (*milvuspb.GetIndexBuildProgressResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetIndexBuildProgressRequest) *milvuspb.GetIndexBuildProgressResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.GetIndexBuildProgressResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetIndexBuildProgressRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_GetIndexBuildProgress_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetIndexBuildProgress' +type MilvusServiceServer_GetIndexBuildProgress_Call struct { + *mock.Call +} + +// GetIndexBuildProgress is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_GetIndexBuildProgress_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetIndexBuildProgressRequest)) *MilvusServiceServer_GetIndexBuildProgress_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.GetIndexBuildProgressRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_GetIndexBuildProgress_Call) Return(_a0 *milvuspb.GetIndexBuildProgressResponse, _a1 error) *MilvusServiceServer_GetIndexBuildProgress_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_GetIndexBuildProgress_Call) RunAndReturn(run func(context.Context, *milvuspb.GetIndexBuildProgressRequest) (*milvuspb.GetIndexBuildProgressResponse, error)) *MilvusServiceServer_GetIndexBuildProgress_Call { + _c.Call.Return(run) + return _c +} + +// GetIndexState provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) GetIndexState(_a0 context.Context, _a1 *milvuspb.GetIndexStateRequest) (*milvuspb.GetIndexStateResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.GetIndexStateResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetIndexStateRequest) (*milvuspb.GetIndexStateResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetIndexStateRequest) *milvuspb.GetIndexStateResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.GetIndexStateResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetIndexStateRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_GetIndexState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetIndexState' +type MilvusServiceServer_GetIndexState_Call struct { + *mock.Call +} + +// GetIndexState is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_GetIndexState_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetIndexStateRequest)) *MilvusServiceServer_GetIndexState_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.GetIndexStateRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_GetIndexState_Call) Return(_a0 *milvuspb.GetIndexStateResponse, _a1 error) *MilvusServiceServer_GetIndexState_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_GetIndexState_Call) RunAndReturn(run func(context.Context, *milvuspb.GetIndexStateRequest) (*milvuspb.GetIndexStateResponse, error)) *MilvusServiceServer_GetIndexState_Call { + _c.Call.Return(run) + return _c +} + +// GetIndexStatistics provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) GetIndexStatistics(_a0 context.Context, _a1 *milvuspb.GetIndexStatisticsRequest) (*milvuspb.GetIndexStatisticsResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.GetIndexStatisticsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetIndexStatisticsRequest) (*milvuspb.GetIndexStatisticsResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetIndexStatisticsRequest) *milvuspb.GetIndexStatisticsResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.GetIndexStatisticsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetIndexStatisticsRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_GetIndexStatistics_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetIndexStatistics' +type MilvusServiceServer_GetIndexStatistics_Call struct { + *mock.Call +} + +// GetIndexStatistics is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_GetIndexStatistics_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetIndexStatisticsRequest)) *MilvusServiceServer_GetIndexStatistics_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.GetIndexStatisticsRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_GetIndexStatistics_Call) Return(_a0 *milvuspb.GetIndexStatisticsResponse, _a1 error) *MilvusServiceServer_GetIndexStatistics_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_GetIndexStatistics_Call) RunAndReturn(run func(context.Context, *milvuspb.GetIndexStatisticsRequest) (*milvuspb.GetIndexStatisticsResponse, error)) *MilvusServiceServer_GetIndexStatistics_Call { + _c.Call.Return(run) + return _c +} + +// GetLoadState provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) GetLoadState(_a0 context.Context, _a1 *milvuspb.GetLoadStateRequest) (*milvuspb.GetLoadStateResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.GetLoadStateResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetLoadStateRequest) (*milvuspb.GetLoadStateResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetLoadStateRequest) *milvuspb.GetLoadStateResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.GetLoadStateResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetLoadStateRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_GetLoadState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLoadState' +type MilvusServiceServer_GetLoadState_Call struct { + *mock.Call +} + +// GetLoadState is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_GetLoadState_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetLoadStateRequest)) *MilvusServiceServer_GetLoadState_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.GetLoadStateRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_GetLoadState_Call) Return(_a0 *milvuspb.GetLoadStateResponse, _a1 error) *MilvusServiceServer_GetLoadState_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_GetLoadState_Call) RunAndReturn(run func(context.Context, *milvuspb.GetLoadStateRequest) (*milvuspb.GetLoadStateResponse, error)) *MilvusServiceServer_GetLoadState_Call { + _c.Call.Return(run) + return _c +} + +// GetLoadingProgress provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) GetLoadingProgress(_a0 context.Context, _a1 *milvuspb.GetLoadingProgressRequest) (*milvuspb.GetLoadingProgressResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.GetLoadingProgressResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetLoadingProgressRequest) (*milvuspb.GetLoadingProgressResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetLoadingProgressRequest) *milvuspb.GetLoadingProgressResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.GetLoadingProgressResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetLoadingProgressRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_GetLoadingProgress_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLoadingProgress' +type MilvusServiceServer_GetLoadingProgress_Call struct { + *mock.Call +} + +// GetLoadingProgress is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_GetLoadingProgress_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetLoadingProgressRequest)) *MilvusServiceServer_GetLoadingProgress_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.GetLoadingProgressRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_GetLoadingProgress_Call) Return(_a0 *milvuspb.GetLoadingProgressResponse, _a1 error) *MilvusServiceServer_GetLoadingProgress_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_GetLoadingProgress_Call) RunAndReturn(run func(context.Context, *milvuspb.GetLoadingProgressRequest) (*milvuspb.GetLoadingProgressResponse, error)) *MilvusServiceServer_GetLoadingProgress_Call { + _c.Call.Return(run) + return _c +} + +// GetMetrics provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) GetMetrics(_a0 context.Context, _a1 *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.GetMetricsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetMetricsRequest) *milvuspb.GetMetricsResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.GetMetricsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetMetricsRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_GetMetrics_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMetrics' +type MilvusServiceServer_GetMetrics_Call struct { + *mock.Call +} + +// GetMetrics is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_GetMetrics_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetMetricsRequest)) *MilvusServiceServer_GetMetrics_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.GetMetricsRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_GetMetrics_Call) Return(_a0 *milvuspb.GetMetricsResponse, _a1 error) *MilvusServiceServer_GetMetrics_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_GetMetrics_Call) RunAndReturn(run func(context.Context, *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error)) *MilvusServiceServer_GetMetrics_Call { + _c.Call.Return(run) + return _c +} + +// GetPartitionStatistics provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) GetPartitionStatistics(_a0 context.Context, _a1 *milvuspb.GetPartitionStatisticsRequest) (*milvuspb.GetPartitionStatisticsResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.GetPartitionStatisticsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetPartitionStatisticsRequest) (*milvuspb.GetPartitionStatisticsResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetPartitionStatisticsRequest) *milvuspb.GetPartitionStatisticsResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.GetPartitionStatisticsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetPartitionStatisticsRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_GetPartitionStatistics_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPartitionStatistics' +type MilvusServiceServer_GetPartitionStatistics_Call struct { + *mock.Call +} + +// GetPartitionStatistics is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_GetPartitionStatistics_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetPartitionStatisticsRequest)) *MilvusServiceServer_GetPartitionStatistics_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.GetPartitionStatisticsRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_GetPartitionStatistics_Call) Return(_a0 *milvuspb.GetPartitionStatisticsResponse, _a1 error) *MilvusServiceServer_GetPartitionStatistics_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_GetPartitionStatistics_Call) RunAndReturn(run func(context.Context, *milvuspb.GetPartitionStatisticsRequest) (*milvuspb.GetPartitionStatisticsResponse, error)) *MilvusServiceServer_GetPartitionStatistics_Call { + _c.Call.Return(run) + return _c +} + +// GetPersistentSegmentInfo provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) GetPersistentSegmentInfo(_a0 context.Context, _a1 *milvuspb.GetPersistentSegmentInfoRequest) (*milvuspb.GetPersistentSegmentInfoResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.GetPersistentSegmentInfoResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetPersistentSegmentInfoRequest) (*milvuspb.GetPersistentSegmentInfoResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetPersistentSegmentInfoRequest) *milvuspb.GetPersistentSegmentInfoResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.GetPersistentSegmentInfoResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetPersistentSegmentInfoRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_GetPersistentSegmentInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPersistentSegmentInfo' +type MilvusServiceServer_GetPersistentSegmentInfo_Call struct { + *mock.Call +} + +// GetPersistentSegmentInfo is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_GetPersistentSegmentInfo_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetPersistentSegmentInfoRequest)) *MilvusServiceServer_GetPersistentSegmentInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.GetPersistentSegmentInfoRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_GetPersistentSegmentInfo_Call) Return(_a0 *milvuspb.GetPersistentSegmentInfoResponse, _a1 error) *MilvusServiceServer_GetPersistentSegmentInfo_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_GetPersistentSegmentInfo_Call) RunAndReturn(run func(context.Context, *milvuspb.GetPersistentSegmentInfoRequest) (*milvuspb.GetPersistentSegmentInfoResponse, error)) *MilvusServiceServer_GetPersistentSegmentInfo_Call { + _c.Call.Return(run) + return _c +} + +// GetQuerySegmentInfo provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) GetQuerySegmentInfo(_a0 context.Context, _a1 *milvuspb.GetQuerySegmentInfoRequest) (*milvuspb.GetQuerySegmentInfoResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.GetQuerySegmentInfoResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetQuerySegmentInfoRequest) (*milvuspb.GetQuerySegmentInfoResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetQuerySegmentInfoRequest) *milvuspb.GetQuerySegmentInfoResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.GetQuerySegmentInfoResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetQuerySegmentInfoRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_GetQuerySegmentInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetQuerySegmentInfo' +type MilvusServiceServer_GetQuerySegmentInfo_Call struct { + *mock.Call +} + +// GetQuerySegmentInfo is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_GetQuerySegmentInfo_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetQuerySegmentInfoRequest)) *MilvusServiceServer_GetQuerySegmentInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.GetQuerySegmentInfoRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_GetQuerySegmentInfo_Call) Return(_a0 *milvuspb.GetQuerySegmentInfoResponse, _a1 error) *MilvusServiceServer_GetQuerySegmentInfo_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_GetQuerySegmentInfo_Call) RunAndReturn(run func(context.Context, *milvuspb.GetQuerySegmentInfoRequest) (*milvuspb.GetQuerySegmentInfoResponse, error)) *MilvusServiceServer_GetQuerySegmentInfo_Call { + _c.Call.Return(run) + return _c +} + +// GetReplicas provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) GetReplicas(_a0 context.Context, _a1 *milvuspb.GetReplicasRequest) (*milvuspb.GetReplicasResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.GetReplicasResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetReplicasRequest) (*milvuspb.GetReplicasResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetReplicasRequest) *milvuspb.GetReplicasResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.GetReplicasResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetReplicasRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_GetReplicas_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetReplicas' +type MilvusServiceServer_GetReplicas_Call struct { + *mock.Call +} + +// GetReplicas is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_GetReplicas_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetReplicasRequest)) *MilvusServiceServer_GetReplicas_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.GetReplicasRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_GetReplicas_Call) Return(_a0 *milvuspb.GetReplicasResponse, _a1 error) *MilvusServiceServer_GetReplicas_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_GetReplicas_Call) RunAndReturn(run func(context.Context, *milvuspb.GetReplicasRequest) (*milvuspb.GetReplicasResponse, error)) *MilvusServiceServer_GetReplicas_Call { + _c.Call.Return(run) + return _c +} + +// GetVersion provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) GetVersion(_a0 context.Context, _a1 *milvuspb.GetVersionRequest) (*milvuspb.GetVersionResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.GetVersionResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetVersionRequest) (*milvuspb.GetVersionResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetVersionRequest) *milvuspb.GetVersionResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.GetVersionResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetVersionRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_GetVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetVersion' +type MilvusServiceServer_GetVersion_Call struct { + *mock.Call +} + +// GetVersion is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_GetVersion_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetVersionRequest)) *MilvusServiceServer_GetVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.GetVersionRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_GetVersion_Call) Return(_a0 *milvuspb.GetVersionResponse, _a1 error) *MilvusServiceServer_GetVersion_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_GetVersion_Call) RunAndReturn(run func(context.Context, *milvuspb.GetVersionRequest) (*milvuspb.GetVersionResponse, error)) *MilvusServiceServer_GetVersion_Call { + _c.Call.Return(run) + return _c +} + +// HasCollection provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) HasCollection(_a0 context.Context, _a1 *milvuspb.HasCollectionRequest) (*milvuspb.BoolResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.BoolResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.HasCollectionRequest) (*milvuspb.BoolResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.HasCollectionRequest) *milvuspb.BoolResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.BoolResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.HasCollectionRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_HasCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasCollection' +type MilvusServiceServer_HasCollection_Call struct { + *mock.Call +} + +// HasCollection is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_HasCollection_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.HasCollectionRequest)) *MilvusServiceServer_HasCollection_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.HasCollectionRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_HasCollection_Call) Return(_a0 *milvuspb.BoolResponse, _a1 error) *MilvusServiceServer_HasCollection_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_HasCollection_Call) RunAndReturn(run func(context.Context, *milvuspb.HasCollectionRequest) (*milvuspb.BoolResponse, error)) *MilvusServiceServer_HasCollection_Call { + _c.Call.Return(run) + return _c +} + +// HasPartition provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) HasPartition(_a0 context.Context, _a1 *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.BoolResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.HasPartitionRequest) *milvuspb.BoolResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.BoolResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.HasPartitionRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_HasPartition_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasPartition' +type MilvusServiceServer_HasPartition_Call struct { + *mock.Call +} + +// HasPartition is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_HasPartition_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.HasPartitionRequest)) *MilvusServiceServer_HasPartition_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.HasPartitionRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_HasPartition_Call) Return(_a0 *milvuspb.BoolResponse, _a1 error) *MilvusServiceServer_HasPartition_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_HasPartition_Call) RunAndReturn(run func(context.Context, *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error)) *MilvusServiceServer_HasPartition_Call { + _c.Call.Return(run) + return _c +} + +// HybridSearch provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) HybridSearch(_a0 context.Context, _a1 *milvuspb.HybridSearchRequest) (*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.HybridSearchRequest) (*milvuspb.SearchResults, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.HybridSearchRequest) *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.HybridSearchRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_HybridSearch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HybridSearch' +type MilvusServiceServer_HybridSearch_Call struct { + *mock.Call +} + +// HybridSearch is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *milvuspb.HybridSearchRequest +func (_e *MilvusServiceServer_Expecter) HybridSearch(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_HybridSearch_Call { + return &MilvusServiceServer_HybridSearch_Call{Call: _e.mock.On("HybridSearch", _a0, _a1)} +} + +func (_c *MilvusServiceServer_HybridSearch_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.HybridSearchRequest)) *MilvusServiceServer_HybridSearch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.HybridSearchRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_HybridSearch_Call) Return(_a0 *milvuspb.SearchResults, _a1 error) *MilvusServiceServer_HybridSearch_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_HybridSearch_Call) RunAndReturn(run func(context.Context, *milvuspb.HybridSearchRequest) (*milvuspb.SearchResults, error)) *MilvusServiceServer_HybridSearch_Call { + _c.Call.Return(run) + return _c +} + +// Import provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) Import(_a0 context.Context, _a1 *milvuspb.ImportRequest) (*milvuspb.ImportResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.ImportResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ImportRequest) (*milvuspb.ImportResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ImportRequest) *milvuspb.ImportResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.ImportResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.ImportRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_Import_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Import' +type MilvusServiceServer_Import_Call struct { + *mock.Call +} + +// Import is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_Import_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.ImportRequest)) *MilvusServiceServer_Import_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.ImportRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_Import_Call) Return(_a0 *milvuspb.ImportResponse, _a1 error) *MilvusServiceServer_Import_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_Import_Call) RunAndReturn(run func(context.Context, *milvuspb.ImportRequest) (*milvuspb.ImportResponse, error)) *MilvusServiceServer_Import_Call { + _c.Call.Return(run) + return _c +} + +// Insert provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) Insert(_a0 context.Context, _a1 *milvuspb.InsertRequest) (*milvuspb.MutationResult, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.MutationResult + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.InsertRequest) (*milvuspb.MutationResult, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.InsertRequest) *milvuspb.MutationResult); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.MutationResult) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.InsertRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_Insert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Insert' +type MilvusServiceServer_Insert_Call struct { + *mock.Call +} + +// Insert is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_Insert_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.InsertRequest)) *MilvusServiceServer_Insert_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.InsertRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_Insert_Call) Return(_a0 *milvuspb.MutationResult, _a1 error) *MilvusServiceServer_Insert_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_Insert_Call) RunAndReturn(run func(context.Context, *milvuspb.InsertRequest) (*milvuspb.MutationResult, error)) *MilvusServiceServer_Insert_Call { + _c.Call.Return(run) + return _c +} + +// ListAliases provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) ListAliases(_a0 context.Context, _a1 *milvuspb.ListAliasesRequest) (*milvuspb.ListAliasesResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.ListAliasesResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListAliasesRequest) (*milvuspb.ListAliasesResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListAliasesRequest) *milvuspb.ListAliasesResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.ListAliasesResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.ListAliasesRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_ListAliases_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAliases' +type MilvusServiceServer_ListAliases_Call struct { + *mock.Call +} + +// ListAliases is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_ListAliases_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.ListAliasesRequest)) *MilvusServiceServer_ListAliases_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.ListAliasesRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_ListAliases_Call) Return(_a0 *milvuspb.ListAliasesResponse, _a1 error) *MilvusServiceServer_ListAliases_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_ListAliases_Call) RunAndReturn(run func(context.Context, *milvuspb.ListAliasesRequest) (*milvuspb.ListAliasesResponse, error)) *MilvusServiceServer_ListAliases_Call { + _c.Call.Return(run) + return _c +} + +// ListCredUsers provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) ListCredUsers(_a0 context.Context, _a1 *milvuspb.ListCredUsersRequest) (*milvuspb.ListCredUsersResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.ListCredUsersResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListCredUsersRequest) (*milvuspb.ListCredUsersResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListCredUsersRequest) *milvuspb.ListCredUsersResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.ListCredUsersResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.ListCredUsersRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_ListCredUsers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListCredUsers' +type MilvusServiceServer_ListCredUsers_Call struct { + *mock.Call +} + +// ListCredUsers is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_ListCredUsers_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.ListCredUsersRequest)) *MilvusServiceServer_ListCredUsers_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.ListCredUsersRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_ListCredUsers_Call) Return(_a0 *milvuspb.ListCredUsersResponse, _a1 error) *MilvusServiceServer_ListCredUsers_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_ListCredUsers_Call) RunAndReturn(run func(context.Context, *milvuspb.ListCredUsersRequest) (*milvuspb.ListCredUsersResponse, error)) *MilvusServiceServer_ListCredUsers_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabases provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) ListDatabases(_a0 context.Context, _a1 *milvuspb.ListDatabasesRequest) (*milvuspb.ListDatabasesResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.ListDatabasesResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListDatabasesRequest) (*milvuspb.ListDatabasesResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListDatabasesRequest) *milvuspb.ListDatabasesResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.ListDatabasesResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.ListDatabasesRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_ListDatabases_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabases' +type MilvusServiceServer_ListDatabases_Call struct { + *mock.Call +} + +// ListDatabases is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_ListDatabases_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.ListDatabasesRequest)) *MilvusServiceServer_ListDatabases_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.ListDatabasesRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_ListDatabases_Call) Return(_a0 *milvuspb.ListDatabasesResponse, _a1 error) *MilvusServiceServer_ListDatabases_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_ListDatabases_Call) RunAndReturn(run func(context.Context, *milvuspb.ListDatabasesRequest) (*milvuspb.ListDatabasesResponse, error)) *MilvusServiceServer_ListDatabases_Call { + _c.Call.Return(run) + return _c +} + +// ListImportTasks provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) ListImportTasks(_a0 context.Context, _a1 *milvuspb.ListImportTasksRequest) (*milvuspb.ListImportTasksResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.ListImportTasksResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListImportTasksRequest) (*milvuspb.ListImportTasksResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListImportTasksRequest) *milvuspb.ListImportTasksResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.ListImportTasksResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.ListImportTasksRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_ListImportTasks_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListImportTasks' +type MilvusServiceServer_ListImportTasks_Call struct { + *mock.Call +} + +// ListImportTasks is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_ListImportTasks_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.ListImportTasksRequest)) *MilvusServiceServer_ListImportTasks_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.ListImportTasksRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_ListImportTasks_Call) Return(_a0 *milvuspb.ListImportTasksResponse, _a1 error) *MilvusServiceServer_ListImportTasks_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_ListImportTasks_Call) RunAndReturn(run func(context.Context, *milvuspb.ListImportTasksRequest) (*milvuspb.ListImportTasksResponse, error)) *MilvusServiceServer_ListImportTasks_Call { + _c.Call.Return(run) + return _c +} + +// ListIndexedSegment provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) ListIndexedSegment(_a0 context.Context, _a1 *federpb.ListIndexedSegmentRequest) (*federpb.ListIndexedSegmentResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *federpb.ListIndexedSegmentResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *federpb.ListIndexedSegmentRequest) (*federpb.ListIndexedSegmentResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *federpb.ListIndexedSegmentRequest) *federpb.ListIndexedSegmentResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*federpb.ListIndexedSegmentResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *federpb.ListIndexedSegmentRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_ListIndexedSegment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListIndexedSegment' +type MilvusServiceServer_ListIndexedSegment_Call struct { + *mock.Call +} + +// ListIndexedSegment is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_ListIndexedSegment_Call) Run(run func(_a0 context.Context, _a1 *federpb.ListIndexedSegmentRequest)) *MilvusServiceServer_ListIndexedSegment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*federpb.ListIndexedSegmentRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_ListIndexedSegment_Call) Return(_a0 *federpb.ListIndexedSegmentResponse, _a1 error) *MilvusServiceServer_ListIndexedSegment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_ListIndexedSegment_Call) RunAndReturn(run func(context.Context, *federpb.ListIndexedSegmentRequest) (*federpb.ListIndexedSegmentResponse, error)) *MilvusServiceServer_ListIndexedSegment_Call { + _c.Call.Return(run) + return _c +} + +// ListResourceGroups provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) ListResourceGroups(_a0 context.Context, _a1 *milvuspb.ListResourceGroupsRequest) (*milvuspb.ListResourceGroupsResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.ListResourceGroupsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListResourceGroupsRequest) (*milvuspb.ListResourceGroupsResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListResourceGroupsRequest) *milvuspb.ListResourceGroupsResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.ListResourceGroupsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.ListResourceGroupsRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_ListResourceGroups_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListResourceGroups' +type MilvusServiceServer_ListResourceGroups_Call struct { + *mock.Call +} + +// ListResourceGroups is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_ListResourceGroups_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.ListResourceGroupsRequest)) *MilvusServiceServer_ListResourceGroups_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.ListResourceGroupsRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_ListResourceGroups_Call) Return(_a0 *milvuspb.ListResourceGroupsResponse, _a1 error) *MilvusServiceServer_ListResourceGroups_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_ListResourceGroups_Call) RunAndReturn(run func(context.Context, *milvuspb.ListResourceGroupsRequest) (*milvuspb.ListResourceGroupsResponse, error)) *MilvusServiceServer_ListResourceGroups_Call { + _c.Call.Return(run) + return _c +} + +// LoadBalance provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) LoadBalance(_a0 context.Context, _a1 *milvuspb.LoadBalanceRequest) (*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.LoadBalanceRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.LoadBalanceRequest) *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.LoadBalanceRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_LoadBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadBalance' +type MilvusServiceServer_LoadBalance_Call struct { + *mock.Call +} + +// LoadBalance is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_LoadBalance_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.LoadBalanceRequest)) *MilvusServiceServer_LoadBalance_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.LoadBalanceRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_LoadBalance_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_LoadBalance_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_LoadBalance_Call) RunAndReturn(run func(context.Context, *milvuspb.LoadBalanceRequest) (*commonpb.Status, error)) *MilvusServiceServer_LoadBalance_Call { + _c.Call.Return(run) + return _c +} + +// LoadCollection provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) LoadCollection(_a0 context.Context, _a1 *milvuspb.LoadCollectionRequest) (*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.LoadCollectionRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.LoadCollectionRequest) *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.LoadCollectionRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_LoadCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadCollection' +type MilvusServiceServer_LoadCollection_Call struct { + *mock.Call +} + +// LoadCollection is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_LoadCollection_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.LoadCollectionRequest)) *MilvusServiceServer_LoadCollection_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.LoadCollectionRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_LoadCollection_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_LoadCollection_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_LoadCollection_Call) RunAndReturn(run func(context.Context, *milvuspb.LoadCollectionRequest) (*commonpb.Status, error)) *MilvusServiceServer_LoadCollection_Call { + _c.Call.Return(run) + return _c +} + +// LoadPartitions provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) LoadPartitions(_a0 context.Context, _a1 *milvuspb.LoadPartitionsRequest) (*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.LoadPartitionsRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.LoadPartitionsRequest) *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.LoadPartitionsRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_LoadPartitions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadPartitions' +type MilvusServiceServer_LoadPartitions_Call struct { + *mock.Call +} + +// LoadPartitions is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_LoadPartitions_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.LoadPartitionsRequest)) *MilvusServiceServer_LoadPartitions_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.LoadPartitionsRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_LoadPartitions_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_LoadPartitions_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_LoadPartitions_Call) RunAndReturn(run func(context.Context, *milvuspb.LoadPartitionsRequest) (*commonpb.Status, error)) *MilvusServiceServer_LoadPartitions_Call { + _c.Call.Return(run) + return _c +} + +// ManualCompaction provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) ManualCompaction(_a0 context.Context, _a1 *milvuspb.ManualCompactionRequest) (*milvuspb.ManualCompactionResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.ManualCompactionResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ManualCompactionRequest) (*milvuspb.ManualCompactionResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ManualCompactionRequest) *milvuspb.ManualCompactionResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.ManualCompactionResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.ManualCompactionRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_ManualCompaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ManualCompaction' +type MilvusServiceServer_ManualCompaction_Call struct { + *mock.Call +} + +// ManualCompaction is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_ManualCompaction_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.ManualCompactionRequest)) *MilvusServiceServer_ManualCompaction_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.ManualCompactionRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_ManualCompaction_Call) Return(_a0 *milvuspb.ManualCompactionResponse, _a1 error) *MilvusServiceServer_ManualCompaction_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_ManualCompaction_Call) RunAndReturn(run func(context.Context, *milvuspb.ManualCompactionRequest) (*milvuspb.ManualCompactionResponse, error)) *MilvusServiceServer_ManualCompaction_Call { + _c.Call.Return(run) + return _c +} + +// OperatePrivilege provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) OperatePrivilege(_a0 context.Context, _a1 *milvuspb.OperatePrivilegeRequest) (*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.OperatePrivilegeRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.OperatePrivilegeRequest) *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.OperatePrivilegeRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_OperatePrivilege_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OperatePrivilege' +type MilvusServiceServer_OperatePrivilege_Call struct { + *mock.Call +} + +// OperatePrivilege is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_OperatePrivilege_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.OperatePrivilegeRequest)) *MilvusServiceServer_OperatePrivilege_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.OperatePrivilegeRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_OperatePrivilege_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_OperatePrivilege_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_OperatePrivilege_Call) RunAndReturn(run func(context.Context, *milvuspb.OperatePrivilegeRequest) (*commonpb.Status, error)) *MilvusServiceServer_OperatePrivilege_Call { + _c.Call.Return(run) + return _c +} + +// OperateUserRole provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) OperateUserRole(_a0 context.Context, _a1 *milvuspb.OperateUserRoleRequest) (*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.OperateUserRoleRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.OperateUserRoleRequest) *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.OperateUserRoleRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_OperateUserRole_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OperateUserRole' +type MilvusServiceServer_OperateUserRole_Call struct { + *mock.Call +} + +// OperateUserRole is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_OperateUserRole_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.OperateUserRoleRequest)) *MilvusServiceServer_OperateUserRole_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.OperateUserRoleRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_OperateUserRole_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_OperateUserRole_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_OperateUserRole_Call) RunAndReturn(run func(context.Context, *milvuspb.OperateUserRoleRequest) (*commonpb.Status, error)) *MilvusServiceServer_OperateUserRole_Call { + _c.Call.Return(run) + return _c +} + +// Query provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) Query(_a0 context.Context, _a1 *milvuspb.QueryRequest) (*milvuspb.QueryResults, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.QueryResults + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.QueryRequest) (*milvuspb.QueryResults, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.QueryRequest) *milvuspb.QueryResults); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.QueryResults) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.QueryRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_Query_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Query' +type MilvusServiceServer_Query_Call struct { + *mock.Call +} + +// Query is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_Query_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.QueryRequest)) *MilvusServiceServer_Query_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.QueryRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_Query_Call) Return(_a0 *milvuspb.QueryResults, _a1 error) *MilvusServiceServer_Query_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_Query_Call) RunAndReturn(run func(context.Context, *milvuspb.QueryRequest) (*milvuspb.QueryResults, error)) *MilvusServiceServer_Query_Call { + _c.Call.Return(run) + return _c +} + +// RegisterLink provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) RegisterLink(_a0 context.Context, _a1 *milvuspb.RegisterLinkRequest) (*milvuspb.RegisterLinkResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.RegisterLinkResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.RegisterLinkRequest) (*milvuspb.RegisterLinkResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.RegisterLinkRequest) *milvuspb.RegisterLinkResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.RegisterLinkResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.RegisterLinkRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_RegisterLink_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterLink' +type MilvusServiceServer_RegisterLink_Call struct { + *mock.Call +} + +// RegisterLink is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_RegisterLink_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.RegisterLinkRequest)) *MilvusServiceServer_RegisterLink_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.RegisterLinkRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_RegisterLink_Call) Return(_a0 *milvuspb.RegisterLinkResponse, _a1 error) *MilvusServiceServer_RegisterLink_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_RegisterLink_Call) RunAndReturn(run func(context.Context, *milvuspb.RegisterLinkRequest) (*milvuspb.RegisterLinkResponse, error)) *MilvusServiceServer_RegisterLink_Call { + _c.Call.Return(run) + return _c +} + +// ReleaseCollection provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) ReleaseCollection(_a0 context.Context, _a1 *milvuspb.ReleaseCollectionRequest) (*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.ReleaseCollectionRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ReleaseCollectionRequest) *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.ReleaseCollectionRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_ReleaseCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReleaseCollection' +type MilvusServiceServer_ReleaseCollection_Call struct { + *mock.Call +} + +// ReleaseCollection is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_ReleaseCollection_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.ReleaseCollectionRequest)) *MilvusServiceServer_ReleaseCollection_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.ReleaseCollectionRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_ReleaseCollection_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_ReleaseCollection_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_ReleaseCollection_Call) RunAndReturn(run func(context.Context, *milvuspb.ReleaseCollectionRequest) (*commonpb.Status, error)) *MilvusServiceServer_ReleaseCollection_Call { + _c.Call.Return(run) + return _c +} + +// ReleasePartitions provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) ReleasePartitions(_a0 context.Context, _a1 *milvuspb.ReleasePartitionsRequest) (*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.ReleasePartitionsRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ReleasePartitionsRequest) *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.ReleasePartitionsRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_ReleasePartitions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReleasePartitions' +type MilvusServiceServer_ReleasePartitions_Call struct { + *mock.Call +} + +// ReleasePartitions is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_ReleasePartitions_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.ReleasePartitionsRequest)) *MilvusServiceServer_ReleasePartitions_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.ReleasePartitionsRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_ReleasePartitions_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_ReleasePartitions_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_ReleasePartitions_Call) RunAndReturn(run func(context.Context, *milvuspb.ReleasePartitionsRequest) (*commonpb.Status, error)) *MilvusServiceServer_ReleasePartitions_Call { + _c.Call.Return(run) + return _c +} + +// RenameCollection provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) RenameCollection(_a0 context.Context, _a1 *milvuspb.RenameCollectionRequest) (*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.RenameCollectionRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.RenameCollectionRequest) *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.RenameCollectionRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_RenameCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RenameCollection' +type MilvusServiceServer_RenameCollection_Call struct { + *mock.Call +} + +// RenameCollection is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_RenameCollection_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.RenameCollectionRequest)) *MilvusServiceServer_RenameCollection_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.RenameCollectionRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_RenameCollection_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_RenameCollection_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_RenameCollection_Call) RunAndReturn(run func(context.Context, *milvuspb.RenameCollectionRequest) (*commonpb.Status, error)) *MilvusServiceServer_RenameCollection_Call { + _c.Call.Return(run) + return _c +} + +// ReplicateMessage provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) ReplicateMessage(_a0 context.Context, _a1 *milvuspb.ReplicateMessageRequest) (*milvuspb.ReplicateMessageResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.ReplicateMessageResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ReplicateMessageRequest) (*milvuspb.ReplicateMessageResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ReplicateMessageRequest) *milvuspb.ReplicateMessageResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.ReplicateMessageResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.ReplicateMessageRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_ReplicateMessage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReplicateMessage' +type MilvusServiceServer_ReplicateMessage_Call struct { + *mock.Call +} + +// ReplicateMessage is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *milvuspb.ReplicateMessageRequest +func (_e *MilvusServiceServer_Expecter) ReplicateMessage(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_ReplicateMessage_Call { + return &MilvusServiceServer_ReplicateMessage_Call{Call: _e.mock.On("ReplicateMessage", _a0, _a1)} +} + +func (_c *MilvusServiceServer_ReplicateMessage_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.ReplicateMessageRequest)) *MilvusServiceServer_ReplicateMessage_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.ReplicateMessageRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_ReplicateMessage_Call) Return(_a0 *milvuspb.ReplicateMessageResponse, _a1 error) *MilvusServiceServer_ReplicateMessage_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_ReplicateMessage_Call) RunAndReturn(run func(context.Context, *milvuspb.ReplicateMessageRequest) (*milvuspb.ReplicateMessageResponse, error)) *MilvusServiceServer_ReplicateMessage_Call { + _c.Call.Return(run) + return _c +} + +// Search provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) Search(_a0 context.Context, _a1 *milvuspb.SearchRequest) (*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.SearchRequest) (*milvuspb.SearchResults, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.SearchRequest) *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.SearchRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_Search_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Search' +type MilvusServiceServer_Search_Call struct { + *mock.Call +} + +// Search is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_Search_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.SearchRequest)) *MilvusServiceServer_Search_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.SearchRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_Search_Call) Return(_a0 *milvuspb.SearchResults, _a1 error) *MilvusServiceServer_Search_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_Search_Call) RunAndReturn(run func(context.Context, *milvuspb.SearchRequest) (*milvuspb.SearchResults, error)) *MilvusServiceServer_Search_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) + + var r0 *milvuspb.SelectGrantResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.SelectGrantRequest) (*milvuspb.SelectGrantResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.SelectGrantRequest) *milvuspb.SelectGrantResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.SelectGrantResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.SelectGrantRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_SelectGrant_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SelectGrant' +type MilvusServiceServer_SelectGrant_Call struct { + *mock.Call +} + +// SelectGrant is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_SelectGrant_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.SelectGrantRequest)) *MilvusServiceServer_SelectGrant_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.SelectGrantRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_SelectGrant_Call) Return(_a0 *milvuspb.SelectGrantResponse, _a1 error) *MilvusServiceServer_SelectGrant_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_SelectGrant_Call) RunAndReturn(run func(context.Context, *milvuspb.SelectGrantRequest) (*milvuspb.SelectGrantResponse, error)) *MilvusServiceServer_SelectGrant_Call { + _c.Call.Return(run) + return _c +} + +// SelectRole provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) SelectRole(_a0 context.Context, _a1 *milvuspb.SelectRoleRequest) (*milvuspb.SelectRoleResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.SelectRoleResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.SelectRoleRequest) (*milvuspb.SelectRoleResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.SelectRoleRequest) *milvuspb.SelectRoleResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.SelectRoleResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.SelectRoleRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_SelectRole_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SelectRole' +type MilvusServiceServer_SelectRole_Call struct { + *mock.Call +} + +// SelectRole is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_SelectRole_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.SelectRoleRequest)) *MilvusServiceServer_SelectRole_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.SelectRoleRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_SelectRole_Call) Return(_a0 *milvuspb.SelectRoleResponse, _a1 error) *MilvusServiceServer_SelectRole_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_SelectRole_Call) RunAndReturn(run func(context.Context, *milvuspb.SelectRoleRequest) (*milvuspb.SelectRoleResponse, error)) *MilvusServiceServer_SelectRole_Call { + _c.Call.Return(run) + return _c +} + +// SelectUser provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) SelectUser(_a0 context.Context, _a1 *milvuspb.SelectUserRequest) (*milvuspb.SelectUserResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.SelectUserResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.SelectUserRequest) (*milvuspb.SelectUserResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.SelectUserRequest) *milvuspb.SelectUserResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.SelectUserResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.SelectUserRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_SelectUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SelectUser' +type MilvusServiceServer_SelectUser_Call struct { + *mock.Call +} + +// SelectUser is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_SelectUser_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.SelectUserRequest)) *MilvusServiceServer_SelectUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.SelectUserRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_SelectUser_Call) Return(_a0 *milvuspb.SelectUserResponse, _a1 error) *MilvusServiceServer_SelectUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_SelectUser_Call) RunAndReturn(run func(context.Context, *milvuspb.SelectUserRequest) (*milvuspb.SelectUserResponse, error)) *MilvusServiceServer_SelectUser_Call { + _c.Call.Return(run) + return _c +} + +// ShowCollections provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) ShowCollections(_a0 context.Context, _a1 *milvuspb.ShowCollectionsRequest) (*milvuspb.ShowCollectionsResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.ShowCollectionsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ShowCollectionsRequest) (*milvuspb.ShowCollectionsResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ShowCollectionsRequest) *milvuspb.ShowCollectionsResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.ShowCollectionsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.ShowCollectionsRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_ShowCollections_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ShowCollections' +type MilvusServiceServer_ShowCollections_Call struct { + *mock.Call +} + +// ShowCollections is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_ShowCollections_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.ShowCollectionsRequest)) *MilvusServiceServer_ShowCollections_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.ShowCollectionsRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_ShowCollections_Call) Return(_a0 *milvuspb.ShowCollectionsResponse, _a1 error) *MilvusServiceServer_ShowCollections_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_ShowCollections_Call) RunAndReturn(run func(context.Context, *milvuspb.ShowCollectionsRequest) (*milvuspb.ShowCollectionsResponse, error)) *MilvusServiceServer_ShowCollections_Call { + _c.Call.Return(run) + return _c +} + +// ShowPartitions provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) ShowPartitions(_a0 context.Context, _a1 *milvuspb.ShowPartitionsRequest) (*milvuspb.ShowPartitionsResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.ShowPartitionsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ShowPartitionsRequest) (*milvuspb.ShowPartitionsResponse, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ShowPartitionsRequest) *milvuspb.ShowPartitionsResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.ShowPartitionsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.ShowPartitionsRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_ShowPartitions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ShowPartitions' +type MilvusServiceServer_ShowPartitions_Call struct { + *mock.Call +} + +// ShowPartitions is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_ShowPartitions_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.ShowPartitionsRequest)) *MilvusServiceServer_ShowPartitions_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.ShowPartitionsRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_ShowPartitions_Call) Return(_a0 *milvuspb.ShowPartitionsResponse, _a1 error) *MilvusServiceServer_ShowPartitions_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_ShowPartitions_Call) RunAndReturn(run func(context.Context, *milvuspb.ShowPartitionsRequest) (*milvuspb.ShowPartitionsResponse, error)) *MilvusServiceServer_ShowPartitions_Call { + _c.Call.Return(run) + return _c +} + +// TransferNode provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) TransferNode(_a0 context.Context, _a1 *milvuspb.TransferNodeRequest) (*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.TransferNodeRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.TransferNodeRequest) *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.TransferNodeRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_TransferNode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TransferNode' +type MilvusServiceServer_TransferNode_Call struct { + *mock.Call +} + +// TransferNode is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_TransferNode_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.TransferNodeRequest)) *MilvusServiceServer_TransferNode_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.TransferNodeRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_TransferNode_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_TransferNode_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_TransferNode_Call) RunAndReturn(run func(context.Context, *milvuspb.TransferNodeRequest) (*commonpb.Status, error)) *MilvusServiceServer_TransferNode_Call { + _c.Call.Return(run) + return _c +} + +// TransferReplica provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) TransferReplica(_a0 context.Context, _a1 *milvuspb.TransferReplicaRequest) (*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.TransferReplicaRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.TransferReplicaRequest) *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.TransferReplicaRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_TransferReplica_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TransferReplica' +type MilvusServiceServer_TransferReplica_Call struct { + *mock.Call +} + +// TransferReplica is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_TransferReplica_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.TransferReplicaRequest)) *MilvusServiceServer_TransferReplica_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.TransferReplicaRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_TransferReplica_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_TransferReplica_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_TransferReplica_Call) RunAndReturn(run func(context.Context, *milvuspb.TransferReplicaRequest) (*commonpb.Status, error)) *MilvusServiceServer_TransferReplica_Call { + _c.Call.Return(run) + return _c +} + +// UpdateCredential provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) UpdateCredential(_a0 context.Context, _a1 *milvuspb.UpdateCredentialRequest) (*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.UpdateCredentialRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.UpdateCredentialRequest) *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.UpdateCredentialRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_UpdateCredential_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateCredential' +type MilvusServiceServer_UpdateCredential_Call struct { + *mock.Call +} + +// UpdateCredential is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_UpdateCredential_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.UpdateCredentialRequest)) *MilvusServiceServer_UpdateCredential_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.UpdateCredentialRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_UpdateCredential_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_UpdateCredential_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_UpdateCredential_Call) RunAndReturn(run func(context.Context, *milvuspb.UpdateCredentialRequest) (*commonpb.Status, error)) *MilvusServiceServer_UpdateCredential_Call { + _c.Call.Return(run) + return _c +} + +// UpdateResourceGroups provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) UpdateResourceGroups(_a0 context.Context, _a1 *milvuspb.UpdateResourceGroupsRequest) (*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.UpdateResourceGroupsRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.UpdateResourceGroupsRequest) *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.UpdateResourceGroupsRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_UpdateResourceGroups_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateResourceGroups' +type MilvusServiceServer_UpdateResourceGroups_Call struct { + *mock.Call +} + +// UpdateResourceGroups is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *milvuspb.UpdateResourceGroupsRequest +func (_e *MilvusServiceServer_Expecter) UpdateResourceGroups(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_UpdateResourceGroups_Call { + return &MilvusServiceServer_UpdateResourceGroups_Call{Call: _e.mock.On("UpdateResourceGroups", _a0, _a1)} +} + +func (_c *MilvusServiceServer_UpdateResourceGroups_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.UpdateResourceGroupsRequest)) *MilvusServiceServer_UpdateResourceGroups_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.UpdateResourceGroupsRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_UpdateResourceGroups_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_UpdateResourceGroups_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_UpdateResourceGroups_Call) RunAndReturn(run func(context.Context, *milvuspb.UpdateResourceGroupsRequest) (*commonpb.Status, error)) *MilvusServiceServer_UpdateResourceGroups_Call { + _c.Call.Return(run) + return _c +} + +// Upsert provides a mock function with given fields: _a0, _a1 +func (_m *MilvusServiceServer) Upsert(_a0 context.Context, _a1 *milvuspb.UpsertRequest) (*milvuspb.MutationResult, error) { + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.MutationResult + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.UpsertRequest) (*milvuspb.MutationResult, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.UpsertRequest) *milvuspb.MutationResult); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.MutationResult) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.UpsertRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MilvusServiceServer_Upsert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Upsert' +type MilvusServiceServer_Upsert_Call struct { + *mock.Call +} + +// Upsert is a helper method to define mock.On call +// - _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)} +} + +func (_c *MilvusServiceServer_Upsert_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.UpsertRequest)) *MilvusServiceServer_Upsert_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.UpsertRequest)) + }) + return _c +} + +func (_c *MilvusServiceServer_Upsert_Call) Return(_a0 *milvuspb.MutationResult, _a1 error) *MilvusServiceServer_Upsert_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MilvusServiceServer_Upsert_Call) RunAndReturn(run func(context.Context, *milvuspb.UpsertRequest) (*milvuspb.MutationResult, error)) *MilvusServiceServer_Upsert_Call { + _c.Call.Return(run) + return _c +} + +// NewMilvusServiceServer creates a new instance of MilvusServiceServer. 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 NewMilvusServiceServer(t interface { + mock.TestingT + Cleanup(func()) +}) *MilvusServiceServer { + mock := &MilvusServiceServer{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/client/partition.go b/client/partition.go new file mode 100644 index 0000000000000..93036b2300dc8 --- /dev/null +++ b/client/partition.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 client + +import ( + "context" + + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus/pkg/util/merr" + "google.golang.org/grpc" +) + +// CreatePartition is the API for creating a partition for a collection. +func (c *Client) CreatePartition(ctx context.Context, opt CreatePartitionOption, callOptions ...grpc.CallOption) error { + req := opt.Request() + + err := c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.CreatePartition(ctx, req, callOptions...) + return merr.CheckRPCCall(resp, err) + }) + + return err +} + +func (c *Client) DropPartition(ctx context.Context, opt DropPartitionOption, callOptions ...grpc.CallOption) error { + req := opt.Request() + + err := c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.DropPartition(ctx, req, callOptions...) + return merr.CheckRPCCall(resp, err) + }) + return err +} + +func (c *Client) HasPartition(ctx context.Context, opt HasPartitionOption, callOptions ...grpc.CallOption) (has bool, err error) { + req := opt.Request() + + err = c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.HasPartition(ctx, req, callOptions...) + err = merr.CheckRPCCall(resp, err) + if err != nil { + return err + } + has = resp.GetValue() + return nil + }) + return has, err +} + +func (c *Client) ListPartitions(ctx context.Context, opt ListPartitionsOption, callOptions ...grpc.CallOption) (partitionNames []string, err error) { + req := opt.Request() + + err = c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.ShowPartitions(ctx, req, callOptions...) + err = merr.CheckRPCCall(resp, err) + if err != nil { + return err + } + partitionNames = resp.GetPartitionNames() + return nil + }) + return partitionNames, err +} diff --git a/client/partition_options.go b/client/partition_options.go new file mode 100644 index 0000000000000..c0c8e0c298fde --- /dev/null +++ b/client/partition_options.go @@ -0,0 +1,119 @@ +// 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 client + +import "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + +// CreatePartitionOption is the interface builds Create Partition request. +type CreatePartitionOption interface { + // Request is the method returns the composed request. + Request() *milvuspb.CreatePartitionRequest +} + +type createPartitionOpt struct { + collectionName string + partitionName string +} + +func (opt *createPartitionOpt) Request() *milvuspb.CreatePartitionRequest { + return &milvuspb.CreatePartitionRequest{ + CollectionName: opt.collectionName, + PartitionName: opt.partitionName, + } +} + +func NewCreatePartitionOption(collectionName string, partitionName string) *createPartitionOpt { + return &createPartitionOpt{ + collectionName: collectionName, + partitionName: partitionName, + } +} + +// DropPartitionOption is the interface that builds Drop Partition request. +type DropPartitionOption interface { + // Request is the method returns the composed request. + Request() *milvuspb.DropPartitionRequest +} + +type dropPartitionOpt struct { + collectionName string + partitionName string +} + +func (opt *dropPartitionOpt) Request() *milvuspb.DropPartitionRequest { + return &milvuspb.DropPartitionRequest{ + CollectionName: opt.collectionName, + PartitionName: opt.partitionName, + } +} + +func NewDropPartitionOption(collectionName string, partitionName string) *dropPartitionOpt { + return &dropPartitionOpt{ + collectionName: collectionName, + partitionName: partitionName, + } +} + +// HasPartitionOption is the interface builds HasPartition request. +type HasPartitionOption interface { + // Request is the method returns the composed request. + Request() *milvuspb.HasPartitionRequest +} + +var _ HasPartitionOption = (*hasPartitionOpt)(nil) + +type hasPartitionOpt struct { + collectionName string + partitionName string +} + +func (opt *hasPartitionOpt) Request() *milvuspb.HasPartitionRequest { + return &milvuspb.HasPartitionRequest{ + CollectionName: opt.collectionName, + PartitionName: opt.partitionName, + } +} + +func NewHasPartitionOption(collectionName string, partitionName string) *hasPartitionOpt { + return &hasPartitionOpt{ + collectionName: collectionName, + partitionName: partitionName, + } +} + +// ListPartitionsOption is the interface builds List Partition request. +type ListPartitionsOption interface { + // Request is the method returns the composed request. + Request() *milvuspb.ShowPartitionsRequest +} + +type listPartitionsOpt struct { + collectionName string +} + +func (opt *listPartitionsOpt) Request() *milvuspb.ShowPartitionsRequest { + return &milvuspb.ShowPartitionsRequest{ + CollectionName: opt.collectionName, + Type: milvuspb.ShowType_All, + } +} + +func NewListPartitionOption(collectionName string) *listPartitionsOpt { + return &listPartitionsOpt{ + collectionName: collectionName, + } +} diff --git a/client/partition_test.go b/client/partition_test.go new file mode 100644 index 0000000000000..2c6c4e2ed82c4 --- /dev/null +++ b/client/partition_test.go @@ -0,0 +1,166 @@ +// 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 client + +import ( + "context" + "fmt" + "testing" + + "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus/pkg/util/merr" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/suite" +) + +type PartitionSuite struct { + MockSuiteBase +} + +func (s *PartitionSuite) TestListPartitions() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + s.Run("success", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + + s.mock.EXPECT().ShowPartitions(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, spr *milvuspb.ShowPartitionsRequest) (*milvuspb.ShowPartitionsResponse, error) { + s.Equal(collectionName, spr.GetCollectionName()) + return &milvuspb.ShowPartitionsResponse{ + Status: merr.Success(), + PartitionNames: []string{"_default", "part_1"}, + PartitionIDs: []int64{100, 101}, + }, nil + }).Once() + + names, err := s.client.ListPartitions(ctx, NewListPartitionOption(collectionName)) + s.NoError(err) + s.ElementsMatch([]string{"_default", "part_1"}, names) + }) + + s.Run("failure", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + + s.mock.EXPECT().ShowPartitions(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + _, err := s.client.ListPartitions(ctx, NewListPartitionOption(collectionName)) + s.Error(err) + }) +} + +func (s *PartitionSuite) TestCreatePartition() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + s.Run("success", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + partitionName := fmt.Sprintf("part_%s", s.randString(6)) + + s.mock.EXPECT().CreatePartition(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, cpr *milvuspb.CreatePartitionRequest) (*commonpb.Status, error) { + s.Equal(collectionName, cpr.GetCollectionName()) + s.Equal(partitionName, cpr.GetPartitionName()) + return merr.Success(), nil + }).Once() + + err := s.client.CreatePartition(ctx, NewCreatePartitionOption(collectionName, partitionName)) + s.NoError(err) + }) + + s.Run("success", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + partitionName := fmt.Sprintf("part_%s", s.randString(6)) + + s.mock.EXPECT().CreatePartition(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + err := s.client.CreatePartition(ctx, NewCreatePartitionOption(collectionName, partitionName)) + s.Error(err) + }) +} + +func (s *PartitionSuite) TestHasPartition() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + s.Run("success", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + partitionName := fmt.Sprintf("part_%s", s.randString(6)) + + s.mock.EXPECT().HasPartition(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, hpr *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error) { + s.Equal(collectionName, hpr.GetCollectionName()) + s.Equal(partitionName, hpr.GetPartitionName()) + return &milvuspb.BoolResponse{Status: merr.Success()}, nil + }).Once() + + has, err := s.client.HasPartition(ctx, NewHasPartitionOption(collectionName, partitionName)) + s.NoError(err) + s.False(has) + + s.mock.EXPECT().HasPartition(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, hpr *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error) { + s.Equal(collectionName, hpr.GetCollectionName()) + s.Equal(partitionName, hpr.GetPartitionName()) + return &milvuspb.BoolResponse{ + Status: merr.Success(), + Value: true, + }, nil + }).Once() + + has, err = s.client.HasPartition(ctx, NewHasPartitionOption(collectionName, partitionName)) + s.NoError(err) + s.True(has) + }) + + s.Run("failure", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + partitionName := fmt.Sprintf("part_%s", s.randString(6)) + s.mock.EXPECT().HasPartition(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + _, err := s.client.HasPartition(ctx, NewHasPartitionOption(collectionName, partitionName)) + s.Error(err) + }) +} + +func (s *PartitionSuite) TestDropPartition() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + s.Run("success", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + partitionName := fmt.Sprintf("part_%s", s.randString(6)) + s.mock.EXPECT().DropPartition(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, dpr *milvuspb.DropPartitionRequest) (*commonpb.Status, error) { + s.Equal(collectionName, dpr.GetCollectionName()) + s.Equal(partitionName, dpr.GetPartitionName()) + return merr.Success(), nil + }).Once() + + err := s.client.DropPartition(ctx, NewDropPartitionOption(collectionName, partitionName)) + s.NoError(err) + }) + + s.Run("failure", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + partitionName := fmt.Sprintf("part_%s", s.randString(6)) + s.mock.EXPECT().DropPartition(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + err := s.client.DropPartition(ctx, NewDropPartitionOption(collectionName, partitionName)) + s.Error(err) + }) +} + +func TestPartition(t *testing.T) { + suite.Run(t, new(PartitionSuite)) +} diff --git a/client/read.go b/client/read.go new file mode 100644 index 0000000000000..1d4a1e489f52a --- /dev/null +++ b/client/read.go @@ -0,0 +1,220 @@ +// 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 client + +import ( + "context" + + "google.golang.org/grpc" + + "github.com/cockroachdb/errors" + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/client/v2/column" + "github.com/milvus-io/milvus/client/v2/entity" + "github.com/milvus-io/milvus/pkg/util/merr" +) + +type ResultSets struct{} + +type ResultSet struct { + ResultCount int // the returning entry count + GroupByValue any + IDs column.Column // auto generated id, can be mapped to the columns from `Insert` API + Fields DataSet // output field data + Scores []float32 // distance to the target vector + Err error // search error if any +} + +// DataSet is an alias type for column slice. +type DataSet []column.Column + +func (c *Client) Search(ctx context.Context, option SearchOption, callOptions ...grpc.CallOption) ([]ResultSet, error) { + req := option.Request() + collection, err := c.getCollection(ctx, req.GetCollectionName()) + if err != nil { + return nil, err + } + + var resultSets []ResultSet + + err = c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.Search(ctx, req, callOptions...) + err = merr.CheckRPCCall(resp, err) + if err != nil { + return err + } + resultSets, err = c.handleSearchResult(collection.Schema, req.GetOutputFields(), int(req.GetNq()), resp) + + return err + }) + + return resultSets, err +} + +func (c *Client) handleSearchResult(schema *entity.Schema, outputFields []string, nq int, resp *milvuspb.SearchResults) ([]ResultSet, error) { + var err error + sr := make([]ResultSet, 0, nq) + results := resp.GetResults() + offset := 0 + fieldDataList := results.GetFieldsData() + gb := results.GetGroupByFieldValue() + var gbc column.Column + if gb != nil { + gbc, err = column.FieldDataColumn(gb, 0, -1) + if err != nil { + return nil, err + } + } + for i := 0; i < int(results.GetNumQueries()); i++ { + rc := int(results.GetTopks()[i]) // result entry count for current query + entry := ResultSet{ + ResultCount: rc, + Scores: results.GetScores()[offset : offset+rc], + } + if gbc != nil { + entry.GroupByValue, _ = gbc.Get(i) + } + // parse result set if current nq is not empty + if rc > 0 { + entry.IDs, entry.Err = column.IDColumns(results.GetIds(), offset, offset+rc) + if entry.Err != nil { + offset += rc + continue + } + entry.Fields, entry.Err = c.parseSearchResult(schema, outputFields, fieldDataList, i, offset, offset+rc) + sr = append(sr, entry) + } + + offset += rc + } + return sr, nil +} + +func (c *Client) parseSearchResult(sch *entity.Schema, outputFields []string, fieldDataList []*schemapb.FieldData, _, from, to int) ([]column.Column, error) { + var wildcard bool + outputFields, wildcard = expandWildcard(sch, outputFields) + // duplicated name will have only one column now + outputSet := make(map[string]struct{}) + for _, output := range outputFields { + outputSet[output] = struct{}{} + } + // fields := make(map[string]*schemapb.FieldData) + columns := make([]column.Column, 0, len(outputFields)) + var dynamicColumn *column.ColumnJSONBytes + for _, fieldData := range fieldDataList { + col, err := column.FieldDataColumn(fieldData, from, to) + if err != nil { + return nil, err + } + if fieldData.GetIsDynamic() { + var ok bool + dynamicColumn, ok = col.(*column.ColumnJSONBytes) + if !ok { + return nil, errors.New("dynamic field not json") + } + + // return json column only explicitly specified in output fields and not in wildcard mode + if _, ok := outputSet[fieldData.GetFieldName()]; !ok && !wildcard { + continue + } + } + + // remove processed field + delete(outputSet, fieldData.GetFieldName()) + + columns = append(columns, col) + } + + if len(outputSet) > 0 && dynamicColumn == nil { + var extraFields []string + for output := range outputSet { + extraFields = append(extraFields, output) + } + return nil, errors.Newf("extra output fields %v found and result does not dynamic field", extraFields) + } + // add dynamic column for extra fields + for outputField := range outputSet { + column := column.NewColumnDynamic(dynamicColumn, outputField) + columns = append(columns, column) + } + + return columns, nil +} + +func (c *Client) Query(ctx context.Context, option QueryOption, callOptions ...grpc.CallOption) (ResultSet, error) { + req := option.Request() + var resultSet ResultSet + + collection, err := c.getCollection(ctx, req.GetCollectionName()) + if err != nil { + return resultSet, err + } + + err = c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.Query(ctx, req, callOptions...) + err = merr.CheckRPCCall(resp, err) + if err != nil { + return err + } + + columns, err := c.parseSearchResult(collection.Schema, resp.GetOutputFields(), resp.GetFieldsData(), 0, 0, -1) + if err != nil { + return err + } + resultSet = ResultSet{ + Fields: columns, + } + if len(columns) > 0 { + resultSet.ResultCount = columns[0].Len() + } + + return nil + }) + return resultSet, err +} + +func expandWildcard(schema *entity.Schema, outputFields []string) ([]string, bool) { + wildcard := false + for _, outputField := range outputFields { + if outputField == "*" { + wildcard = true + } + } + if !wildcard { + return outputFields, false + } + + set := make(map[string]struct{}) + result := make([]string, 0, len(schema.Fields)) + for _, field := range schema.Fields { + result = append(result, field.Name) + set[field.Name] = struct{}{} + } + + // add dynamic fields output + for _, output := range outputFields { + if output == "*" { + continue + } + _, ok := set[output] + if !ok { + result = append(result, output) + } + } + return result, true +} diff --git a/client/read_options.go b/client/read_options.go new file mode 100644 index 0000000000000..90da8c21206a5 --- /dev/null +++ b/client/read_options.go @@ -0,0 +1,250 @@ +// 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 client + +import ( + "encoding/json" + "strconv" + + "github.com/golang/protobuf/proto" + "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus/client/v2/entity" +) + +const ( + spAnnsField = `anns_field` + spTopK = `topk` + spOffset = `offset` + spParams = `params` + spMetricsType = `metric_type` + spRoundDecimal = `round_decimal` + spIgnoreGrowing = `ignore_growing` + spGroupBy = `group_by_field` +) + +type SearchOption interface { + Request() *milvuspb.SearchRequest +} + +var _ SearchOption = (*searchOption)(nil) + +type searchOption struct { + collectionName string + partitionNames []string + topK int + offset int + outputFields []string + consistencyLevel entity.ConsistencyLevel + useDefaultConsistencyLevel bool + ignoreGrowing bool + expr string + + // normal search request + request *annRequest + // TODO add sub request when support hybrid search +} + +type annRequest struct { + vectors []entity.Vector + + annField string + metricsType entity.MetricType + searchParam map[string]string + groupByField string +} + +func (opt *searchOption) Request() *milvuspb.SearchRequest { + // TODO check whether search is hybrid after logic merged + return opt.prepareSearchRequest(opt.request) +} + +func (opt *searchOption) prepareSearchRequest(annRequest *annRequest) *milvuspb.SearchRequest { + request := &milvuspb.SearchRequest{ + CollectionName: opt.collectionName, + PartitionNames: opt.partitionNames, + Dsl: opt.expr, + DslType: commonpb.DslType_BoolExprV1, + ConsistencyLevel: commonpb.ConsistencyLevel(opt.consistencyLevel), + } + if annRequest != nil { + // nq + request.Nq = int64(len(annRequest.vectors)) + + // search param + bs, _ := json.Marshal(annRequest.searchParam) + request.SearchParams = entity.MapKvPairs(map[string]string{ + spAnnsField: annRequest.annField, + spTopK: strconv.Itoa(opt.topK), + spOffset: strconv.Itoa(opt.offset), + spParams: string(bs), + spMetricsType: string(annRequest.metricsType), + spRoundDecimal: "-1", + spIgnoreGrowing: strconv.FormatBool(opt.ignoreGrowing), + spGroupBy: annRequest.groupByField, + }) + + // placeholder group + request.PlaceholderGroup = vector2PlaceholderGroupBytes(annRequest.vectors) + } + + return request +} + +func (opt *searchOption) WithFilter(expr string) *searchOption { + opt.expr = expr + return opt +} + +func (opt *searchOption) WithOffset(offset int) *searchOption { + opt.offset = offset + return opt +} + +func (opt *searchOption) WithOutputFields(fieldNames []string) *searchOption { + opt.outputFields = fieldNames + return opt +} + +func (opt *searchOption) WithConsistencyLevel(consistencyLevel entity.ConsistencyLevel) *searchOption { + opt.consistencyLevel = consistencyLevel + opt.useDefaultConsistencyLevel = false + return opt +} + +func (opt *searchOption) WithANNSField(annsField string) *searchOption { + opt.request.annField = annsField + return opt +} + +func (opt *searchOption) WithPartitions(partitionNames []string) *searchOption { + opt.partitionNames = partitionNames + return opt +} + +func NewSearchOption(collectionName string, limit int, vectors []entity.Vector) *searchOption { + return &searchOption{ + collectionName: collectionName, + topK: limit, + request: &annRequest{ + vectors: vectors, + }, + useDefaultConsistencyLevel: true, + consistencyLevel: entity.ClBounded, + } +} + +func vector2PlaceholderGroupBytes(vectors []entity.Vector) []byte { + phg := &commonpb.PlaceholderGroup{ + Placeholders: []*commonpb.PlaceholderValue{ + vector2Placeholder(vectors), + }, + } + + bs, _ := proto.Marshal(phg) + return bs +} + +func vector2Placeholder(vectors []entity.Vector) *commonpb.PlaceholderValue { + var placeHolderType commonpb.PlaceholderType + ph := &commonpb.PlaceholderValue{ + Tag: "$0", + Values: make([][]byte, 0, len(vectors)), + } + if len(vectors) == 0 { + return ph + } + switch vectors[0].(type) { + case entity.FloatVector: + placeHolderType = commonpb.PlaceholderType_FloatVector + case entity.BinaryVector: + placeHolderType = commonpb.PlaceholderType_BinaryVector + case entity.BFloat16Vector: + placeHolderType = commonpb.PlaceholderType_BFloat16Vector + case entity.Float16Vector: + placeHolderType = commonpb.PlaceholderType_Float16Vector + case entity.SparseEmbedding: + placeHolderType = commonpb.PlaceholderType_SparseFloatVector + } + ph.Type = placeHolderType + for _, vector := range vectors { + ph.Values = append(ph.Values, vector.Serialize()) + } + return ph +} + +type QueryOption interface { + Request() *milvuspb.QueryRequest +} + +type queryOption struct { + collectionName string + partitionNames []string + + limit int + offset int + outputFields []string + consistencyLevel entity.ConsistencyLevel + useDefaultConsistencyLevel bool + ignoreGrowing bool + expr string +} + +func (opt *queryOption) Request() *milvuspb.QueryRequest { + return &milvuspb.QueryRequest{ + CollectionName: opt.collectionName, + PartitionNames: opt.partitionNames, + OutputFields: opt.outputFields, + + Expr: opt.expr, + ConsistencyLevel: opt.consistencyLevel.CommonConsistencyLevel(), + } +} + +func (opt *queryOption) WithFilter(expr string) *queryOption { + opt.expr = expr + return opt +} + +func (opt *queryOption) WithOffset(offset int) *queryOption { + opt.offset = offset + return opt +} + +func (opt *queryOption) WithOutputFields(fieldNames []string) *queryOption { + opt.outputFields = fieldNames + return opt +} + +func (opt *queryOption) WithConsistencyLevel(consistencyLevel entity.ConsistencyLevel) *queryOption { + opt.consistencyLevel = consistencyLevel + opt.useDefaultConsistencyLevel = false + return opt +} + +func (opt *queryOption) WithPartitions(partitionNames []string) *queryOption { + opt.partitionNames = partitionNames + return opt +} + +func NewQueryOption(collectionName string) *queryOption { + return &queryOption{ + collectionName: collectionName, + useDefaultConsistencyLevel: true, + consistencyLevel: entity.ClBounded, + } +} diff --git a/client/read_test.go b/client/read_test.go new file mode 100644 index 0000000000000..6606226d1bb76 --- /dev/null +++ b/client/read_test.go @@ -0,0 +1,154 @@ +package client + +import ( + "context" + "fmt" + "math/rand" + "testing" + + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/client/v2/entity" + "github.com/milvus-io/milvus/pkg/util/merr" + "github.com/samber/lo" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/suite" +) + +type ReadSuite struct { + MockSuiteBase + + schema *entity.Schema + schemaDyn *entity.Schema +} + +func (s *ReadSuite) SetupSuite() { + s.MockSuiteBase.SetupSuite() + s.schema = entity.NewSchema(). + WithField(entity.NewField().WithName("ID").WithDataType(entity.FieldTypeInt64).WithIsPrimaryKey(true)). + WithField(entity.NewField().WithName("Vector").WithDataType(entity.FieldTypeFloatVector).WithDim(128)) + + s.schemaDyn = entity.NewSchema().WithDynamicFieldEnabled(true). + WithField(entity.NewField().WithName("ID").WithDataType(entity.FieldTypeInt64).WithIsPrimaryKey(true)). + WithField(entity.NewField().WithName("vector").WithDataType(entity.FieldTypeFloatVector).WithDim(128)) +} + +func (s *ReadSuite) TestSearch() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + s.Run("success", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + partitionName := fmt.Sprintf("part_%s", s.randString(6)) + s.setupCache(collectionName, s.schema) + s.mock.EXPECT().Search(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, sr *milvuspb.SearchRequest) (*milvuspb.SearchResults, error) { + s.Equal(collectionName, sr.GetCollectionName()) + s.ElementsMatch([]string{partitionName}, sr.GetPartitionNames()) + + return &milvuspb.SearchResults{ + Status: merr.Success(), + Results: &schemapb.SearchResultData{ + NumQueries: 1, + TopK: 10, + FieldsData: []*schemapb.FieldData{ + s.getInt64FieldData("ID", []int64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}), + }, + Ids: &schemapb.IDs{ + IdField: &schemapb.IDs_IntId{ + IntId: &schemapb.LongArray{ + Data: []int64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, + }, + }, + }, + Scores: make([]float32, 10), + Topks: []int64{10}, + }, + }, nil + }).Once() + + _, err := s.client.Search(ctx, NewSearchOption(collectionName, 10, []entity.Vector{ + entity.FloatVector(lo.RepeatBy(128, func(_ int) float32 { + return rand.Float32() + })), + }).WithPartitions([]string{partitionName})) + s.NoError(err) + }) + + s.Run("dynamic_schema", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + partitionName := fmt.Sprintf("part_%s", s.randString(6)) + s.setupCache(collectionName, s.schemaDyn) + s.mock.EXPECT().Search(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, sr *milvuspb.SearchRequest) (*milvuspb.SearchResults, error) { + return &milvuspb.SearchResults{ + Status: merr.Success(), + Results: &schemapb.SearchResultData{ + NumQueries: 1, + TopK: 2, + FieldsData: []*schemapb.FieldData{ + s.getInt64FieldData("ID", []int64{1, 2}), + s.getJSONBytesFieldData("$meta", [][]byte{ + []byte(`{"A": 123, "B": "456"}`), + []byte(`{"B": "abc", "A": 456}`), + }, true), + }, + Ids: &schemapb.IDs{ + IdField: &schemapb.IDs_IntId{ + IntId: &schemapb.LongArray{ + Data: []int64{1, 2}, + }, + }, + }, + Scores: make([]float32, 2), + Topks: []int64{2}, + }, + }, nil + }).Once() + + _, err := s.client.Search(ctx, NewSearchOption(collectionName, 10, []entity.Vector{ + entity.FloatVector(lo.RepeatBy(128, func(_ int) float32 { + return rand.Float32() + })), + }).WithPartitions([]string{partitionName})) + s.NoError(err) + }) + + s.Run("failure", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + s.setupCache(collectionName, s.schemaDyn) + + s.mock.EXPECT().Search(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, sr *milvuspb.SearchRequest) (*milvuspb.SearchResults, error) { + return nil, merr.WrapErrServiceInternal("mocked") + }).Once() + + _, err := s.client.Search(ctx, NewSearchOption(collectionName, 10, []entity.Vector{ + entity.FloatVector(lo.RepeatBy(128, func(_ int) float32 { + return rand.Float32() + })), + })) + s.Error(err) + }) +} + +func (s *ReadSuite) TestQuery() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + s.Run("success", func() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + partitionName := fmt.Sprintf("part_%s", s.randString(6)) + s.setupCache(collectionName, s.schema) + + s.mock.EXPECT().Query(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, qr *milvuspb.QueryRequest) (*milvuspb.QueryResults, error) { + s.Equal(collectionName, qr.GetCollectionName()) + + return &milvuspb.QueryResults{}, nil + }).Once() + + _, err := s.client.Query(ctx, NewQueryOption(collectionName).WithPartitions([]string{partitionName})) + s.NoError(err) + }) +} + +func TestRead(t *testing.T) { + suite.Run(t, new(ReadSuite)) +} diff --git a/client/write.go b/client/write.go new file mode 100644 index 0000000000000..0487c110d1b51 --- /dev/null +++ b/client/write.go @@ -0,0 +1,74 @@ +// 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 client + +import ( + "context" + + "google.golang.org/grpc" + + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus/pkg/util/merr" +) + +func (c *Client) Insert(ctx context.Context, option InsertOption, callOptions ...grpc.CallOption) error { + collection, err := c.getCollection(ctx, option.CollectionName()) + if err != nil { + return err + } + req, err := option.InsertRequest(collection) + if err != nil { + return err + } + err = c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.Insert(ctx, req, callOptions...) + + return merr.CheckRPCCall(resp, err) + }) + return err +} + +func (c *Client) Delete(ctx context.Context, option DeleteOption, callOptions ...grpc.CallOption) error { + req := option.Request() + + return c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.Delete(ctx, req, callOptions...) + if err = merr.CheckRPCCall(resp, err); err != nil { + return err + } + return nil + }) +} + +func (c *Client) Upsert(ctx context.Context, option UpsertOption, callOptions ...grpc.CallOption) error { + collection, err := c.getCollection(ctx, option.CollectionName()) + if err != nil { + return err + } + req, err := option.UpsertRequest(collection) + if err != nil { + return err + } + + return c.callService(func(milvusService milvuspb.MilvusServiceClient) error { + resp, err := milvusService.Upsert(ctx, req, callOptions...) + if err = merr.CheckRPCCall(resp, err); err != nil { + return err + } + return nil + }) +} diff --git a/client/write_option_test.go b/client/write_option_test.go new file mode 100644 index 0000000000000..8f3d954545d13 --- /dev/null +++ b/client/write_option_test.go @@ -0,0 +1,39 @@ +// 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 client + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/suite" +) + +type DeleteOptionSuite struct { + MockSuiteBase +} + +func (s *DeleteOptionSuite) TestBasic() { + collectionName := fmt.Sprintf("coll_%s", s.randString(6)) + opt := NewDeleteOption(collectionName) + + s.Equal(collectionName, opt.Request().GetCollectionName()) +} + +func TestDeleteOption(t *testing.T) { + suite.Run(t, new(DeleteOptionSuite)) +} diff --git a/client/write_options.go b/client/write_options.go new file mode 100644 index 0000000000000..54139ef0b21fa --- /dev/null +++ b/client/write_options.go @@ -0,0 +1,290 @@ +// 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 client + +import ( + "encoding/json" + "fmt" + "strings" + + "github.com/cockroachdb/errors" + "github.com/samber/lo" + + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/client/v2/column" + "github.com/milvus-io/milvus/client/v2/entity" +) + +type InsertOption interface { + InsertRequest(coll *entity.Collection) (*milvuspb.InsertRequest, error) + CollectionName() string +} + +type UpsertOption interface { + UpsertRequest(coll *entity.Collection) (*milvuspb.UpsertRequest, error) + CollectionName() string +} + +var ( + _ UpsertOption = (*columnBasedDataOption)(nil) + _ InsertOption = (*columnBasedDataOption)(nil) +) + +type columnBasedDataOption struct { + collName string + partitionName string + columns []column.Column +} + +func (opt *columnBasedDataOption) processInsertColumns(colSchema *entity.Schema, columns ...column.Column) ([]*schemapb.FieldData, int, error) { + // setup dynamic related var + isDynamic := colSchema.EnableDynamicField + + // check columns and field matches + var rowSize int + mNameField := make(map[string]*entity.Field) + for _, field := range colSchema.Fields { + mNameField[field.Name] = field + } + mNameColumn := make(map[string]column.Column) + var dynamicColumns []column.Column + for _, col := range columns { + _, dup := mNameColumn[col.Name()] + if dup { + return nil, 0, fmt.Errorf("duplicated column %s found", col.Name()) + } + l := col.Len() + if rowSize == 0 { + rowSize = l + } else { + if rowSize != l { + return nil, 0, errors.New("column size not match") + } + } + field, has := mNameField[col.Name()] + if !has { + if !isDynamic { + return nil, 0, fmt.Errorf("field %s does not exist in collection %s", col.Name(), colSchema.CollectionName) + } + // add to dynamic column list for further processing + dynamicColumns = append(dynamicColumns, col) + continue + } + + mNameColumn[col.Name()] = col + if col.Type() != field.DataType { + return nil, 0, fmt.Errorf("param column %s has type %v but collection field definition is %v", col.Name(), col.FieldData(), field.DataType) + } + if field.DataType == entity.FieldTypeFloatVector || field.DataType == entity.FieldTypeBinaryVector { + dim := 0 + switch column := col.(type) { + case *column.ColumnFloatVector: + dim = column.Dim() + case *column.ColumnBinaryVector: + dim = column.Dim() + } + if fmt.Sprintf("%d", dim) != field.TypeParams[entity.TypeParamDim] { + return nil, 0, fmt.Errorf("params column %s vector dim %d not match collection definition, which has dim of %s", field.Name, dim, field.TypeParams[entity.TypeParamDim]) + } + } + } + + // check all fixed field pass value + for _, field := range colSchema.Fields { + _, has := mNameColumn[field.Name] + if !has && + !field.AutoID && !field.IsDynamic { + return nil, 0, fmt.Errorf("field %s not passed", field.Name) + } + } + + fieldsData := make([]*schemapb.FieldData, 0, len(mNameColumn)+1) + for _, fixedColumn := range mNameColumn { + fieldsData = append(fieldsData, fixedColumn.FieldData()) + } + if len(dynamicColumns) > 0 { + // use empty column name here + col, err := opt.mergeDynamicColumns("", rowSize, dynamicColumns) + if err != nil { + return nil, 0, err + } + fieldsData = append(fieldsData, col) + } + + return fieldsData, rowSize, nil +} + +func (opt *columnBasedDataOption) mergeDynamicColumns(dynamicName string, rowSize int, columns []column.Column) (*schemapb.FieldData, error) { + values := make([][]byte, 0, rowSize) + for i := 0; i < rowSize; i++ { + m := make(map[string]interface{}) + for _, column := range columns { + // range guaranteed + m[column.Name()], _ = column.Get(i) + } + bs, err := json.Marshal(m) + if err != nil { + return nil, err + } + values = append(values, bs) + } + return &schemapb.FieldData{ + Type: schemapb.DataType_JSON, + FieldName: dynamicName, + Field: &schemapb.FieldData_Scalars{ + Scalars: &schemapb.ScalarField{ + Data: &schemapb.ScalarField_JsonData{ + JsonData: &schemapb.JSONArray{ + Data: values, + }, + }, + }, + }, + IsDynamic: true, + }, nil +} + +func (opt *columnBasedDataOption) WithColumns(columns ...column.Column) *columnBasedDataOption { + opt.columns = append(opt.columns, columns...) + return opt +} + +func (opt *columnBasedDataOption) WithBoolColumn(colName string, data []bool) *columnBasedDataOption { + column := column.NewColumnBool(colName, data) + return opt.WithColumns(column) +} + +func (opt *columnBasedDataOption) WithInt8Column(colName string, data []int8) *columnBasedDataOption { + column := column.NewColumnInt8(colName, data) + return opt.WithColumns(column) +} + +func (opt *columnBasedDataOption) WithInt16Column(colName string, data []int16) *columnBasedDataOption { + column := column.NewColumnInt16(colName, data) + return opt.WithColumns(column) +} + +func (opt *columnBasedDataOption) WithInt32Column(colName string, data []int32) *columnBasedDataOption { + column := column.NewColumnInt32(colName, data) + return opt.WithColumns(column) +} + +func (opt *columnBasedDataOption) WithInt64Column(colName string, data []int64) *columnBasedDataOption { + column := column.NewColumnInt64(colName, data) + return opt.WithColumns(column) +} + +func (opt *columnBasedDataOption) WithVarcharColumn(colName string, data []string) *columnBasedDataOption { + column := column.NewColumnVarChar(colName, data) + return opt.WithColumns(column) +} + +func (opt *columnBasedDataOption) WithFloatVectorColumn(colName string, dim int, data [][]float32) *columnBasedDataOption { + column := column.NewColumnFloatVector(colName, dim, data) + return opt.WithColumns(column) +} + +func (opt *columnBasedDataOption) WithBinaryVectorColumn(colName string, dim int, data [][]byte) *columnBasedDataOption { + column := column.NewColumnBinaryVector(colName, dim, data) + return opt.WithColumns(column) +} + +func (opt *columnBasedDataOption) WithPartition(partitionName string) *columnBasedDataOption { + opt.partitionName = partitionName + return opt +} + +func (opt *columnBasedDataOption) CollectionName() string { + return opt.collName +} + +func (opt *columnBasedDataOption) InsertRequest(coll *entity.Collection) (*milvuspb.InsertRequest, error) { + fieldsData, rowNum, err := opt.processInsertColumns(coll.Schema, opt.columns...) + if err != nil { + return nil, err + } + return &milvuspb.InsertRequest{ + CollectionName: opt.collName, + PartitionName: opt.partitionName, + FieldsData: fieldsData, + NumRows: uint32(rowNum), + }, nil +} + +func (opt *columnBasedDataOption) UpsertRequest(coll *entity.Collection) (*milvuspb.UpsertRequest, error) { + fieldsData, rowNum, err := opt.processInsertColumns(coll.Schema, opt.columns...) + if err != nil { + return nil, err + } + return &milvuspb.UpsertRequest{ + CollectionName: opt.collName, + PartitionName: opt.partitionName, + FieldsData: fieldsData, + NumRows: uint32(rowNum), + }, nil +} + +func NewColumnBasedInsertOption(collName string, columns ...column.Column) *columnBasedDataOption { + return &columnBasedDataOption{ + columns: columns, + collName: collName, + // leave partition name empty, using default partition + } +} + +type DeleteOption interface { + Request() *milvuspb.DeleteRequest +} + +type deleteOption struct { + collectionName string + partitionName string + expr string +} + +func (opt *deleteOption) Request() *milvuspb.DeleteRequest { + return &milvuspb.DeleteRequest{ + CollectionName: opt.collectionName, + PartitionName: opt.partitionName, + Expr: opt.expr, + } +} + +func (opt *deleteOption) WithExpr(expr string) *deleteOption { + opt.expr = expr + return opt +} + +func (opt *deleteOption) WithInt64IDs(fieldName string, ids []int64) *deleteOption { + opt.expr = fmt.Sprintf("%s in %s", fieldName, strings.Join(strings.Fields(fmt.Sprint(ids)), ",")) + return opt +} + +func (opt *deleteOption) WithStringIDs(fieldName string, ids []string) *deleteOption { + opt.expr = fmt.Sprintf("%s in [%s]", fieldName, strings.Join(lo.Map(ids, func(id string, _ int) string { return fmt.Sprintf("\"%s\"", id) }), ",")) + return opt +} + +func (opt *deleteOption) WithPartition(partitionName string) *deleteOption { + opt.partitionName = partitionName + return opt +} + +func NewDeleteOption(collectionName string) *deleteOption { + return &deleteOption{collectionName: collectionName} +} diff --git a/client/write_test.go b/client/write_test.go new file mode 100644 index 0000000000000..4fa27ff7c43cc --- /dev/null +++ b/client/write_test.go @@ -0,0 +1,330 @@ +// 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 client + +import ( + "context" + "fmt" + "math/rand" + "testing" + + "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" + "github.com/milvus-io/milvus/client/v2/entity" + "github.com/milvus-io/milvus/pkg/util/merr" + "github.com/samber/lo" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/suite" +) + +type WriteSuite struct { + MockSuiteBase + + schema *entity.Schema + schemaDyn *entity.Schema +} + +func (s *WriteSuite) SetupSuite() { + s.MockSuiteBase.SetupSuite() + s.schema = entity.NewSchema(). + WithField(entity.NewField().WithName("id").WithDataType(entity.FieldTypeInt64).WithIsPrimaryKey(true)). + WithField(entity.NewField().WithName("vector").WithDataType(entity.FieldTypeFloatVector).WithDim(128)) + + s.schemaDyn = entity.NewSchema().WithDynamicFieldEnabled(true). + WithField(entity.NewField().WithName("id").WithDataType(entity.FieldTypeInt64).WithIsPrimaryKey(true)). + WithField(entity.NewField().WithName("vector").WithDataType(entity.FieldTypeFloatVector).WithDim(128)) +} + +func (s *WriteSuite) TestInsert() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + s.Run("success", func() { + collName := fmt.Sprintf("coll_%s", s.randString(6)) + partName := fmt.Sprintf("part_%s", s.randString(6)) + s.setupCache(collName, s.schema) + + s.mock.EXPECT().Insert(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, ir *milvuspb.InsertRequest) (*milvuspb.MutationResult, error) { + s.Equal(collName, ir.GetCollectionName()) + s.Equal(partName, ir.GetPartitionName()) + s.Require().Len(ir.GetFieldsData(), 2) + s.EqualValues(3, ir.GetNumRows()) + return &milvuspb.MutationResult{ + Status: merr.Success(), + }, nil + }).Once() + + err := s.client.Insert(ctx, NewColumnBasedInsertOption(collName). + WithFloatVectorColumn("vector", 128, lo.RepeatBy(3, func(i int) []float32 { + return lo.RepeatBy(128, func(i int) float32 { return rand.Float32() }) + })). + WithInt64Column("id", []int64{1, 2, 3}).WithPartition(partName)) + s.NoError(err) + }) + + s.Run("dynamic_schema", func() { + collName := fmt.Sprintf("coll_%s", s.randString(6)) + partName := fmt.Sprintf("part_%s", s.randString(6)) + s.setupCache(collName, s.schemaDyn) + + s.mock.EXPECT().Insert(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, ir *milvuspb.InsertRequest) (*milvuspb.MutationResult, error) { + s.Equal(collName, ir.GetCollectionName()) + s.Equal(partName, ir.GetPartitionName()) + s.Require().Len(ir.GetFieldsData(), 3) + s.EqualValues(3, ir.GetNumRows()) + return &milvuspb.MutationResult{ + Status: merr.Success(), + }, nil + }).Once() + + err := s.client.Insert(ctx, NewColumnBasedInsertOption(collName). + WithFloatVectorColumn("vector", 128, lo.RepeatBy(3, func(i int) []float32 { + return lo.RepeatBy(128, func(i int) float32 { return rand.Float32() }) + })). + WithVarcharColumn("extra", []string{"a", "b", "c"}). + WithInt64Column("id", []int64{1, 2, 3}).WithPartition(partName)) + s.NoError(err) + }) + + s.Run("bad_input", func() { + collName := fmt.Sprintf("coll_%s", s.randString(6)) + s.setupCache(collName, s.schema) + + type badCase struct { + tag string + input InsertOption + } + + cases := []badCase{ + { + tag: "missing_column", + input: NewColumnBasedInsertOption(collName).WithInt64Column("id", []int64{1}), + }, + { + tag: "row_count_not_match", + input: NewColumnBasedInsertOption(collName).WithInt64Column("id", []int64{1}). + WithFloatVectorColumn("vector", 128, lo.RepeatBy(3, func(i int) []float32 { + return lo.RepeatBy(128, func(i int) float32 { return rand.Float32() }) + })), + }, + { + tag: "duplicated_columns", + input: NewColumnBasedInsertOption(collName). + WithInt64Column("id", []int64{1}). + WithInt64Column("id", []int64{2}). + WithFloatVectorColumn("vector", 128, lo.RepeatBy(1, func(i int) []float32 { + return lo.RepeatBy(128, func(i int) float32 { return rand.Float32() }) + })), + }, + { + tag: "different_data_type", + input: NewColumnBasedInsertOption(collName). + WithVarcharColumn("id", []string{"1"}). + WithFloatVectorColumn("vector", 128, lo.RepeatBy(1, func(i int) []float32 { + return lo.RepeatBy(128, func(i int) float32 { return rand.Float32() }) + })), + }, + } + + for _, tc := range cases { + s.Run(tc.tag, func() { + err := s.client.Insert(ctx, tc.input) + s.Error(err) + }) + } + }) + + s.Run("failure", func() { + collName := fmt.Sprintf("coll_%s", s.randString(6)) + s.setupCache(collName, s.schema) + + s.mock.EXPECT().Insert(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + err := s.client.Insert(ctx, NewColumnBasedInsertOption(collName). + WithFloatVectorColumn("vector", 128, lo.RepeatBy(3, func(i int) []float32 { + return lo.RepeatBy(128, func(i int) float32 { return rand.Float32() }) + })). + WithInt64Column("id", []int64{1, 2, 3})) + s.Error(err) + }) +} + +func (s *WriteSuite) TestUpsert() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + s.Run("success", func() { + collName := fmt.Sprintf("coll_%s", s.randString(6)) + partName := fmt.Sprintf("part_%s", s.randString(6)) + s.setupCache(collName, s.schema) + + s.mock.EXPECT().Upsert(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, ur *milvuspb.UpsertRequest) (*milvuspb.MutationResult, error) { + s.Equal(collName, ur.GetCollectionName()) + s.Equal(partName, ur.GetPartitionName()) + s.Require().Len(ur.GetFieldsData(), 2) + s.EqualValues(3, ur.GetNumRows()) + return &milvuspb.MutationResult{ + Status: merr.Success(), + }, nil + }).Once() + + err := s.client.Upsert(ctx, NewColumnBasedInsertOption(collName). + WithFloatVectorColumn("vector", 128, lo.RepeatBy(3, func(i int) []float32 { + return lo.RepeatBy(128, func(i int) float32 { return rand.Float32() }) + })). + WithInt64Column("id", []int64{1, 2, 3}).WithPartition(partName)) + s.NoError(err) + }) + + s.Run("dynamic_schema", func() { + collName := fmt.Sprintf("coll_%s", s.randString(6)) + partName := fmt.Sprintf("part_%s", s.randString(6)) + s.setupCache(collName, s.schemaDyn) + + s.mock.EXPECT().Upsert(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, ur *milvuspb.UpsertRequest) (*milvuspb.MutationResult, error) { + s.Equal(collName, ur.GetCollectionName()) + s.Equal(partName, ur.GetPartitionName()) + s.Require().Len(ur.GetFieldsData(), 3) + s.EqualValues(3, ur.GetNumRows()) + return &milvuspb.MutationResult{ + Status: merr.Success(), + }, nil + }).Once() + + err := s.client.Upsert(ctx, NewColumnBasedInsertOption(collName). + WithFloatVectorColumn("vector", 128, lo.RepeatBy(3, func(i int) []float32 { + return lo.RepeatBy(128, func(i int) float32 { return rand.Float32() }) + })). + WithVarcharColumn("extra", []string{"a", "b", "c"}). + WithInt64Column("id", []int64{1, 2, 3}).WithPartition(partName)) + s.NoError(err) + }) + + s.Run("bad_input", func() { + collName := fmt.Sprintf("coll_%s", s.randString(6)) + s.setupCache(collName, s.schema) + + type badCase struct { + tag string + input UpsertOption + } + + cases := []badCase{ + { + tag: "missing_column", + input: NewColumnBasedInsertOption(collName).WithInt64Column("id", []int64{1}), + }, + { + tag: "row_count_not_match", + input: NewColumnBasedInsertOption(collName).WithInt64Column("id", []int64{1}). + WithFloatVectorColumn("vector", 128, lo.RepeatBy(3, func(i int) []float32 { + return lo.RepeatBy(128, func(i int) float32 { return rand.Float32() }) + })), + }, + { + tag: "duplicated_columns", + input: NewColumnBasedInsertOption(collName). + WithInt64Column("id", []int64{1}). + WithInt64Column("id", []int64{2}). + WithFloatVectorColumn("vector", 128, lo.RepeatBy(1, func(i int) []float32 { + return lo.RepeatBy(128, func(i int) float32 { return rand.Float32() }) + })), + }, + { + tag: "different_data_type", + input: NewColumnBasedInsertOption(collName). + WithVarcharColumn("id", []string{"1"}). + WithFloatVectorColumn("vector", 128, lo.RepeatBy(1, func(i int) []float32 { + return lo.RepeatBy(128, func(i int) float32 { return rand.Float32() }) + })), + }, + } + + for _, tc := range cases { + s.Run(tc.tag, func() { + err := s.client.Upsert(ctx, tc.input) + s.Error(err) + }) + } + }) + + s.Run("failure", func() { + collName := fmt.Sprintf("coll_%s", s.randString(6)) + s.setupCache(collName, s.schema) + + s.mock.EXPECT().Upsert(mock.Anything, mock.Anything).Return(nil, merr.WrapErrServiceInternal("mocked")).Once() + + err := s.client.Upsert(ctx, NewColumnBasedInsertOption(collName). + WithFloatVectorColumn("vector", 128, lo.RepeatBy(3, func(i int) []float32 { + return lo.RepeatBy(128, func(i int) float32 { return rand.Float32() }) + })). + WithInt64Column("id", []int64{1, 2, 3})) + s.Error(err) + }) +} + +func (s *WriteSuite) TestDelete() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + s.Run("success", func() { + collName := fmt.Sprintf("coll_%s", s.randString(6)) + partName := fmt.Sprintf("part_%s", s.randString(6)) + + type testCase struct { + tag string + input DeleteOption + expectExpr string + } + + cases := []testCase{ + { + tag: "raw_expr", + input: NewDeleteOption(collName).WithPartition(partName).WithExpr("id > 100"), + expectExpr: "id > 100", + }, + { + tag: "int_ids", + input: NewDeleteOption(collName).WithPartition(partName).WithInt64IDs("id", []int64{1, 2, 3}), + expectExpr: "id in [1,2,3]", + }, + { + tag: "str_ids", + input: NewDeleteOption(collName).WithPartition(partName).WithStringIDs("id", []string{"a", "b", "c"}), + expectExpr: `id in ["a","b","c"]`, + }, + } + + for _, tc := range cases { + s.Run(tc.tag, func() { + s.mock.EXPECT().Delete(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, dr *milvuspb.DeleteRequest) (*milvuspb.MutationResult, error) { + s.Equal(collName, dr.GetCollectionName()) + s.Equal(partName, dr.GetPartitionName()) + s.Equal(tc.expectExpr, dr.GetExpr()) + return &milvuspb.MutationResult{ + Status: merr.Success(), + }, nil + }).Once() + err := s.client.Delete(ctx, tc.input) + s.NoError(err) + }) + } + }) +} + +func TestWrite(t *testing.T) { + suite.Run(t, new(WriteSuite)) +} diff --git a/scripts/run_go_codecov.sh b/scripts/run_go_codecov.sh index 5904a76100a16..177894ed8c52e 100755 --- a/scripts/run_go_codecov.sh +++ b/scripts/run_go_codecov.sh @@ -58,6 +58,16 @@ for d in $(go list ./... | grep -v -e vendor -e kafka -e planparserv2/generated fi done popd +# milvusclient +pushd client +for d in $(go list ./... | grep -v -e vendor -e kafka -e planparserv2/generated -e mocks); do + $TEST_CMD -race -tags dynamic -v -coverpkg=./... -coverprofile=profile.out -covermode=atomic "$d" + if [ -f profile.out ]; then + grep -v kafka profile.out | grep -v planparserv2/generated | grep -v mocks | sed '1d' >> ../${FILE_COVERAGE_INFO} + rm profile.out + fi +done +popd endTime=`date +%s` echo "Total time for go unittest:" $(($endTime-$beginTime)) "s"