Documentation ¶
Overview ¶
Package client provides milvus client functions
Index ¶
- Constants
- Variables
- func AuthenticationInterceptor(ctx context.Context, username, password string) context.Context
- func BadRequestStatus() (*common.Status, error)
- func BadStatus() (*common.Status, error)
- func CreateAuthenticationStreamInterceptor(username, password string) grpc.StreamClientInterceptor
- func CreateAuthenticationUnaryInterceptor(username, password string) grpc.UnaryClientInterceptor
- func PKs2Expr(backName string, ids entity.Column) string
- func RetryOnRateLimitInterceptor(maxRetry uint, backoffFunc grpc_retry.BackoffFuncContext) grpc.UnaryClientInterceptor
- func SetFieldValue(field *entity.Field, f reflect.Value, fieldData *schema.FieldData, idx int) error
- func SuccessStatus() (*common.Status, error)
- func WithClientRequestID(ctx context.Context, reqID string) context.Context
- func WithDebugLogLevel(ctx context.Context) context.Context
- func WithErrorLogLevel(ctx context.Context) context.Context
- func WithInfoLogLevel(ctx context.Context) context.Context
- func WithWarnLogLevel(ctx context.Context) context.Context
- type BulkInsertOption
- type Client
- func NewDefaultGrpcClient(ctx context.Context, addr string) (Client, error)
- func NewDefaultGrpcClientWithAuth(ctx context.Context, addr, username, password string) (Client, error)
- func NewDefaultGrpcClientWithTLSAuth(ctx context.Context, addr, username, password string) (Client, error)
- func NewDefaultGrpcClientWithURI(ctx context.Context, uri, username, password string) (Client, error)
- func NewGrpcClient(ctx context.Context, addr string, dialOptions ...grpc.DialOption) (Client, error)
- type CreateCollectionOption
- type ErrCollectionNotExists
- type ErrPartitionNotExists
- type ErrServiceFailed
- type GrpcClient
- func (c *GrpcClient) AddUserRole(ctx context.Context, username string, role string) error
- func (c *GrpcClient) AlterAlias(ctx context.Context, collName string, alias string) error
- func (c *GrpcClient) BulkInsert(ctx context.Context, collName string, partitionName string, files []string, ...) (int64, error)
- func (c *GrpcClient) CalcDistance(ctx context.Context, collName string, partitions []string, ...) (entity.Column, error)
- func (c *GrpcClient) Close() error
- func (c *GrpcClient) CreateAlias(ctx context.Context, collName string, alias string) error
- func (c *GrpcClient) CreateCollection(ctx context.Context, collSchema *entity.Schema, shardNum int32, ...) error
- func (c *GrpcClient) CreateCollectionByRow(ctx context.Context, row entity.Row, shardNum int32) error
- func (c *GrpcClient) CreateCredential(ctx context.Context, username string, password string) error
- func (c *GrpcClient) CreateIndex(ctx context.Context, collName string, fieldName string, idx entity.Index, ...) error
- func (c *GrpcClient) CreatePartition(ctx context.Context, collName string, partitionName string) error
- func (c *GrpcClient) CreateRole(ctx context.Context, name string) error
- func (c *GrpcClient) Delete(ctx context.Context, collName string, partitionName string, expr string) error
- func (c *GrpcClient) DeleteByPks(ctx context.Context, collName string, partitionName string, ids entity.Column) error
- func (c *GrpcClient) DeleteCredential(ctx context.Context, username string) error
- func (c *GrpcClient) DescribeCollection(ctx context.Context, collName string) (*entity.Collection, error)
- func (c *GrpcClient) DescribeIndex(ctx context.Context, collName string, fieldName string, opts ...IndexOption) ([]entity.Index, error)
- func (c *GrpcClient) DropAlias(ctx context.Context, alias string) error
- func (c *GrpcClient) DropCollection(ctx context.Context, collName string) error
- func (c *GrpcClient) DropIndex(ctx context.Context, collName string, fieldName string, opts ...IndexOption) error
- func (c *GrpcClient) DropPartition(ctx context.Context, collName string, partitionName string) error
- func (c *GrpcClient) DropRole(ctx context.Context, name string) error
- func (c *GrpcClient) Flush(ctx context.Context, collName string, async bool) error
- func (c *GrpcClient) GetBulkInsertState(ctx context.Context, taskID int64) (*entity.BulkInsertTaskState, error)
- func (c *GrpcClient) GetCollectionStatistics(ctx context.Context, collName string) (map[string]string, error)
- func (c *GrpcClient) GetCompactionState(ctx context.Context, id int64) (entity.CompactionState, error)
- func (c *GrpcClient) GetCompactionStateWithPlans(ctx context.Context, id int64) (entity.CompactionState, []entity.CompactionPlan, error)
- func (c *GrpcClient) GetIndexBuildProgress(ctx context.Context, collName string, fieldName string, opts ...IndexOption) (total, indexed int64, err error)
- func (c *GrpcClient) GetIndexState(ctx context.Context, collName string, fieldName string, opts ...IndexOption) (entity.IndexState, error)
- func (c *GrpcClient) GetLoadState(ctx context.Context, collName string, partitionNames []string) (entity.LoadState, error)
- func (c *GrpcClient) GetLoadingProgress(ctx context.Context, collName string, partitionNames []string) (int64, error)
- func (c *GrpcClient) GetPersistentSegmentInfo(ctx context.Context, collName string) ([]*entity.Segment, error)
- func (c *GrpcClient) GetQuerySegmentInfo(ctx context.Context, collName string) ([]*entity.Segment, error)
- func (c *GrpcClient) GetReplicas(ctx context.Context, collName string) ([]*entity.ReplicaGroup, error)
- func (c *GrpcClient) GetVersion(ctx context.Context) (string, error)
- func (c *GrpcClient) Grant(ctx context.Context, role string, objectType entity.PriviledgeObjectType, ...) error
- func (c *GrpcClient) HasCollection(ctx context.Context, collName string) (bool, error)
- func (c *GrpcClient) HasPartition(ctx context.Context, collName string, partitionName string) (bool, error)
- func (c *GrpcClient) Insert(ctx context.Context, collName string, partitionName string, ...) (entity.Column, error)
- func (c *GrpcClient) InsertByRows(ctx context.Context, collName string, partitionName string, rows []entity.Row) (entity.Column, error)
- func (c *GrpcClient) ListBulkInsertTasks(ctx context.Context, collName string, limit int64) ([]*entity.BulkInsertTaskState, error)
- func (c *GrpcClient) ListCollections(ctx context.Context) ([]*entity.Collection, error)
- func (c *GrpcClient) ListCredUsers(ctx context.Context) ([]string, error)
- func (c *GrpcClient) ListRoles(ctx context.Context) ([]entity.Role, error)
- func (c *GrpcClient) ListUsers(ctx context.Context) ([]entity.User, error)
- func (c *GrpcClient) LoadCollection(ctx context.Context, collName string, async bool, opts ...LoadCollectionOption) error
- func (c *GrpcClient) LoadPartitions(ctx context.Context, collName string, partitionNames []string, async bool) error
- func (c *GrpcClient) ManualCompaction(ctx context.Context, collName string, toleranceDuration time.Duration) (int64, error)
- func (c *GrpcClient) Query(ctx context.Context, collectionName string, partitionNames []string, ...) ([]entity.Column, error)
- func (c *GrpcClient) QueryByPks(ctx context.Context, collectionName string, partitionNames []string, ...) ([]entity.Column, error)
- func (c *GrpcClient) ReleaseCollection(ctx context.Context, collName string) error
- func (c *GrpcClient) ReleasePartitions(ctx context.Context, collName string, partitionNames []string) error
- func (c *GrpcClient) RemoveUserRole(ctx context.Context, username string, role string) error
- func (c *GrpcClient) Revoke(ctx context.Context, role string, objectType entity.PriviledgeObjectType, ...) error
- func (c *GrpcClient) Search(ctx context.Context, collName string, partitions []string, expr string, ...) ([]SearchResult, error)
- func (c *GrpcClient) ShowCollection(ctx context.Context, collName string) (*entity.Collection, error)
- func (c *GrpcClient) ShowPartitions(ctx context.Context, collName string) ([]*entity.Partition, error)
- func (c *GrpcClient) UpdateCredential(ctx context.Context, username string, oldPassword string, newPassword string) error
- type IndexOption
- type LoadCollectionOption
- type MockServer
- func (m *MockServer) AlterAlias(ctx context.Context, req *server.AlterAliasRequest) (*common.Status, error)
- func (m *MockServer) AlterCollection(ctx context.Context, req *server.AlterCollectionRequest) (*common.Status, error)
- func (m *MockServer) CalcDistance(ctx context.Context, req *server.CalcDistanceRequest) (*server.CalcDistanceResults, error)
- func (m *MockServer) CheckHealth(ctx context.Context, req *server.CheckHealthRequest) (*server.CheckHealthResponse, error)
- func (m *MockServer) CreateAlias(ctx context.Context, req *server.CreateAliasRequest) (*common.Status, error)
- func (m *MockServer) CreateCollection(ctx context.Context, req *server.CreateCollectionRequest) (*common.Status, error)
- func (m *MockServer) CreateCredential(ctx context.Context, req *server.CreateCredentialRequest) (*common.Status, error)
- func (m *MockServer) CreateIndex(ctx context.Context, req *server.CreateIndexRequest) (*common.Status, error)
- func (m *MockServer) CreatePartition(ctx context.Context, req *server.CreatePartitionRequest) (*common.Status, error)
- func (m *MockServer) CreateRole(_ context.Context, _ *server.CreateRoleRequest) (*common.Status, error)
- func (m *MockServer) DelInjection(n ServiceMethod)
- func (m *MockServer) Delete(ctx context.Context, req *server.DeleteRequest) (*server.MutationResult, error)
- func (m *MockServer) DeleteCredential(ctx context.Context, req *server.DeleteCredentialRequest) (*common.Status, error)
- func (m *MockServer) DescribeCollection(ctx context.Context, req *server.DescribeCollectionRequest) (*server.DescribeCollectionResponse, error)
- func (m *MockServer) DescribeIndex(ctx context.Context, req *server.DescribeIndexRequest) (*server.DescribeIndexResponse, error)
- func (m *MockServer) DropAlias(ctx context.Context, req *server.DropAliasRequest) (*common.Status, error)
- func (m *MockServer) DropCollection(ctx context.Context, req *server.DropCollectionRequest) (*common.Status, error)
- func (m *MockServer) DropIndex(ctx context.Context, req *server.DropIndexRequest) (*common.Status, error)
- func (m *MockServer) DropPartition(ctx context.Context, req *server.DropPartitionRequest) (*common.Status, error)
- func (m *MockServer) DropRole(_ context.Context, _ *server.DropRoleRequest) (*common.Status, error)
- func (m *MockServer) Dummy(_ context.Context, _ *server.DummyRequest) (*server.DummyResponse, error)
- func (m *MockServer) Flush(ctx context.Context, req *server.FlushRequest) (*server.FlushResponse, error)
- func (m *MockServer) GetCollectionStatistics(ctx context.Context, req *server.GetCollectionStatisticsRequest) (*server.GetCollectionStatisticsResponse, error)
- func (m *MockServer) GetCompactionState(ctx context.Context, req *server.GetCompactionStateRequest) (*server.GetCompactionStateResponse, error)
- func (m *MockServer) GetCompactionStateWithPlans(ctx context.Context, req *server.GetCompactionPlansRequest) (*server.GetCompactionPlansResponse, error)
- func (m *MockServer) GetComponentStates(ctx context.Context, req *server.GetComponentStatesRequest) (*server.ComponentStates, error)
- func (m *MockServer) GetFlushState(ctx context.Context, req *server.GetFlushStateRequest) (*server.GetFlushStateResponse, error)
- func (m *MockServer) GetImportState(_ context.Context, _ *server.GetImportStateRequest) (*server.GetImportStateResponse, error)
- func (m *MockServer) GetIndexBuildProgress(ctx context.Context, req *server.GetIndexBuildProgressRequest) (*server.GetIndexBuildProgressResponse, error)
- func (m *MockServer) GetIndexState(ctx context.Context, req *server.GetIndexStateRequest) (*server.GetIndexStateResponse, error)
- func (m *MockServer) GetInjection(n ServiceMethod) TestInjection
- func (m *MockServer) GetLoadState(ctx context.Context, req *server.GetLoadStateRequest) (*server.GetLoadStateResponse, error)
- func (m *MockServer) GetLoadingProgress(ctx context.Context, req *server.GetLoadingProgressRequest) (*server.GetLoadingProgressResponse, error)
- func (m *MockServer) GetMetrics(_ context.Context, _ *server.GetMetricsRequest) (*server.GetMetricsResponse, error)
- func (m *MockServer) GetPartitionStatistics(_ context.Context, _ *server.GetPartitionStatisticsRequest) (*server.GetPartitionStatisticsResponse, error)
- func (m *MockServer) GetPersistentSegmentInfo(ctx context.Context, req *server.GetPersistentSegmentInfoRequest) (*server.GetPersistentSegmentInfoResponse, error)
- func (m *MockServer) GetQuerySegmentInfo(ctx context.Context, req *server.GetQuerySegmentInfoRequest) (*server.GetQuerySegmentInfoResponse, error)
- func (m *MockServer) GetReplicas(ctx context.Context, req *server.GetReplicasRequest) (*server.GetReplicasResponse, error)
- func (m *MockServer) GetVersion(ctx context.Context, req *server.GetVersionRequest) (*server.GetVersionResponse, error)
- func (m *MockServer) HasCollection(ctx context.Context, req *server.HasCollectionRequest) (*server.BoolResponse, error)
- func (m *MockServer) HasPartition(ctx context.Context, req *server.HasPartitionRequest) (*server.BoolResponse, error)
- func (m *MockServer) Import(_ context.Context, _ *server.ImportRequest) (*server.ImportResponse, error)
- func (m *MockServer) Insert(ctx context.Context, req *server.InsertRequest) (*server.MutationResult, error)
- func (m *MockServer) ListCredUsers(ctx context.Context, req *server.ListCredUsersRequest) (*server.ListCredUsersResponse, error)
- func (m *MockServer) ListImportTasks(_ context.Context, _ *server.ListImportTasksRequest) (*server.ListImportTasksResponse, error)
- func (m *MockServer) LoadBalance(_ context.Context, _ *server.LoadBalanceRequest) (*common.Status, error)
- func (m *MockServer) LoadCollection(ctx context.Context, req *server.LoadCollectionRequest) (*common.Status, error)
- func (m *MockServer) LoadPartitions(ctx context.Context, req *server.LoadPartitionsRequest) (*common.Status, error)
- func (m *MockServer) ManualCompaction(ctx context.Context, req *server.ManualCompactionRequest) (*server.ManualCompactionResponse, error)
- func (m *MockServer) OperatePrivilege(_ context.Context, _ *server.OperatePrivilegeRequest) (*common.Status, error)
- func (m *MockServer) OperateUserRole(_ context.Context, _ *server.OperateUserRoleRequest) (*common.Status, error)
- func (m *MockServer) Query(ctx context.Context, req *server.QueryRequest) (*server.QueryResults, error)
- func (m *MockServer) RegisterLink(_ context.Context, _ *server.RegisterLinkRequest) (*server.RegisterLinkResponse, error)
- func (m *MockServer) ReleaseCollection(ctx context.Context, req *server.ReleaseCollectionRequest) (*common.Status, error)
- func (m *MockServer) ReleasePartitions(ctx context.Context, req *server.ReleasePartitionsRequest) (*common.Status, error)
- func (m *MockServer) Search(ctx context.Context, req *server.SearchRequest) (*server.SearchResults, error)
- func (m *MockServer) SelectGrant(_ context.Context, _ *server.SelectGrantRequest) (*server.SelectGrantResponse, error)
- func (m *MockServer) SelectRole(_ context.Context, _ *server.SelectRoleRequest) (*server.SelectRoleResponse, error)
- func (m *MockServer) SelectUser(_ context.Context, _ *server.SelectUserRequest) (*server.SelectUserResponse, error)
- func (m *MockServer) SetInjection(n ServiceMethod, f TestInjection)
- func (m *MockServer) ShowCollections(ctx context.Context, req *server.ShowCollectionsRequest) (*server.ShowCollectionsResponse, error)
- func (m *MockServer) ShowPartitions(ctx context.Context, req *server.ShowPartitionsRequest) (*server.ShowPartitionsResponse, error)
- func (m *MockServer) UpdateCredential(ctx context.Context, req *server.UpdateCredentialRequest) (*common.Status, error)
- func (m *MockServer) Upsert(ctx context.Context, req *server.UpsertRequest) (*server.MutationResult, error)
- type SearchQueryOption
- type SearchQueryOptionFunc
- func WithGuaranteeTimestamp(gt uint64) SearchQueryOptionFunc
- func WithLimit(limit int64) SearchQueryOptionFunc
- func WithOffset(offset int64) SearchQueryOptionFunc
- func WithSearchQueryConsistencyLevel(cl entity.ConsistencyLevel) SearchQueryOptionFunc
- func WithTravelTimestamp(tt uint64) SearchQueryOptionFunc
- type SearchResult
- type SearchResultByRows
- type ServiceMethod
- type TestInjection
Constants ¶
const ( StrongTimestamp uint64 = 0 EventuallyTimestamp uint64 = 1 BoundedTimestamp uint64 = 2 )
Magical timestamps for communicating with server
const (
RetryOnRateLimit ctxKey = iota
)
Variables ¶
var ( //ErrClientNotReady error indicates client not ready ErrClientNotReady = errors.New("client not ready") //ErrStatusNil error indicates response has nil status ErrStatusNil = errors.New("response status is nil") )
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, }), }
var ( // ErrFieldTypeNotMatch error for field type not match ErrFieldTypeNotMatch = errors.New("field type not matched") )
var MaxBackOff = 60 * time.Second
var MetaCache = metaCache{ // contains filtered or unexported fields }
Functions ¶
func AuthenticationInterceptor ¶
AuthenticationInterceptor appends credential into context metadata
func BadRequestStatus ¶
func CreateAuthenticationStreamInterceptor ¶
func CreateAuthenticationStreamInterceptor(username, password string) grpc.StreamClientInterceptor
CreateAuthenticationStreamInterceptor creates a stream interceptor for authentication
func CreateAuthenticationUnaryInterceptor ¶
func CreateAuthenticationUnaryInterceptor(username, password string) grpc.UnaryClientInterceptor
CreateAuthenticationUnaryInterceptor creates a unary interceptor for authentication
func RetryOnRateLimitInterceptor ¶
func RetryOnRateLimitInterceptor(maxRetry uint, backoffFunc grpc_retry.BackoffFuncContext) grpc.UnaryClientInterceptor
RetryOnRateLimitInterceptor returns a new retrying unary client interceptor.
func SetFieldValue ¶
func SetFieldValue(field *entity.Field, f reflect.Value, fieldData *schema.FieldData, idx int) error
SetFieldValue set row field value with reflection
func SuccessStatus ¶
func WithClientRequestID ¶
Types ¶
type BulkInsertOption ¶
type BulkInsertOption func(request *server.ImportRequest)
BulkInsertOption is an option that is used to modify ImportRequest
func WithStartTs ¶
func WithStartTs(startTs int64) BulkInsertOption
WithStartTs specifies a specific startTs
type Client ¶
type Client interface { // Close close the remaining connection resources Close() error // ListCollections list collections from connection ListCollections(ctx context.Context) ([]*entity.Collection, error) // CreateCollection create collection using provided schema CreateCollection(ctx context.Context, schema *entity.Schema, shardsNum int32, opts ...CreateCollectionOption) error // DescribeCollection describe collection meta DescribeCollection(ctx context.Context, collName string) (*entity.Collection, error) // DropCollection drop the specified collection DropCollection(ctx context.Context, collName string) error // GetCollectionStatistics get collection statistics GetCollectionStatistics(ctx context.Context, collName string) (map[string]string, error) // LoadCollection load collection into memory LoadCollection(ctx context.Context, collName string, async bool, opts ...LoadCollectionOption) error // ReleaseCollection release loaded collection ReleaseCollection(ctx context.Context, collName string) error // HasCollection check whether collection exists HasCollection(ctx context.Context, collName string) (bool, error) // CreateAlias creates an alias for collection CreateAlias(ctx context.Context, collName string, alias string) error // DropAlias drops the specified Alias DropAlias(ctx context.Context, alias string) error // AlterAlias changes collection alias to provided alias AlterAlias(ctx context.Context, collName string, alias string) error // GetReplicas gets the replica groups as well as their querynodes and shards information GetReplicas(ctx context.Context, collName string) ([]*entity.ReplicaGroup, error) // CreateCredential create new user and password CreateCredential(ctx context.Context, username string, password string) error // UpdateCredential update password for a user UpdateCredential(ctx context.Context, username string, oldPassword string, newPassword string) error // DeleteCredential delete a user DeleteCredential(ctx context.Context, username string) error // ListCredUsers list all usernames ListCredUsers(ctx context.Context) ([]string, error) // CreatePartition create partition for collection CreatePartition(ctx context.Context, collName string, partitionName string) error // DropPartition drop partition from collection DropPartition(ctx context.Context, collName string, partitionName string) error // ShowPartitions list all partitions from collection ShowPartitions(ctx context.Context, collName string) ([]*entity.Partition, error) // HasPartition check whether partition exists in collection HasPartition(ctx context.Context, collName string, partitionName string) (bool, error) // LoadPartitions load partitions into memory LoadPartitions(ctx context.Context, collName string, partitionNames []string, async bool) error // ReleasePartitions release partitions ReleasePartitions(ctx context.Context, collName string, partitionNames []string) error // -- segment -- GetPersistentSegmentInfo(ctx context.Context, collName string) ([]*entity.Segment, error) // CreateIndex create index for field of specified collection // currently index naming is not supported, so only one index on vector field is supported CreateIndex(ctx context.Context, collName string, fieldName string, idx entity.Index, async bool, opts ...IndexOption) error // DescribeIndex describe index on collection // currently index naming is not supported, so only one index on vector field is supported DescribeIndex(ctx context.Context, collName string, fieldName string, opts ...IndexOption) ([]entity.Index, error) // DropIndex drop index from collection with specified field name DropIndex(ctx context.Context, collName string, fieldName string, opts ...IndexOption) error // GetIndexState get index state with specified collection and field name // index naming is not supported yet GetIndexState(ctx context.Context, collName string, fieldName string, opts ...IndexOption) (entity.IndexState, error) // Insert column-based data into collection, returns id column values Insert(ctx context.Context, collName string, partitionName string, columns ...entity.Column) (entity.Column, error) // Flush flush collection, specified Flush(ctx context.Context, collName string, async bool) error // Delete deletes entries with bool expression Delete(ctx context.Context, collName string, partitionName string, expr string) error // DeleteByPks deletes entries related to provided primary keys DeleteByPks(ctx context.Context, collName string, partitionName string, ids entity.Column) error // Search search with bool expression Search(ctx context.Context, collName string, partitions []string, expr string, outputFields []string, vectors []entity.Vector, vectorField string, metricType entity.MetricType, topK int, sp entity.SearchParam, opts ...SearchQueryOptionFunc) ([]SearchResult, error) // QueryByPks query record by specified primary key(s). QueryByPks(ctx context.Context, collectionName string, partitionNames []string, ids entity.Column, outputFields []string, opts ...SearchQueryOptionFunc) ([]entity.Column, error) // Query performs query records with boolean expression. Query(ctx context.Context, collectionName string, partitionNames []string, expr string, outputFields []string, opts ...SearchQueryOptionFunc) ([]entity.Column, error) // CalcDistance calculate the distance between vectors specified by ids or provided CalcDistance(ctx context.Context, collName string, partitions []string, metricType entity.MetricType, opLeft, opRight entity.Column) (entity.Column, error) // CreateCollectionByRow create collection by row CreateCollectionByRow(ctx context.Context, row entity.Row, shardNum int32) error // InsertByRows insert by rows InsertByRows(ctx context.Context, collName string, paritionName string, rows []entity.Row) (entity.Column, error) // ManualCompaction triggers a compaction on provided collection ManualCompaction(ctx context.Context, collName string, toleranceDuration time.Duration) (int64, error) // GetCompactionState get compaction state of provided compaction id GetCompactionState(ctx context.Context, id int64) (entity.CompactionState, error) // GetCompactionStateWithPlans get compaction state with plans of provided compaction id GetCompactionStateWithPlans(ctx context.Context, id int64) (entity.CompactionState, []entity.CompactionPlan, error) // BulkInsert import data files(json, numpy, etc.) on MinIO/S3 storage, read and parse them into sealed segments BulkInsert(ctx context.Context, collName string, partitionName string, files []string, opts ...BulkInsertOption) (int64, error) // GetBulkInsertState checks import task state GetBulkInsertState(ctx context.Context, taskID int64) (*entity.BulkInsertTaskState, error) // ListBulkInsertTasks list state of all import tasks ListBulkInsertTasks(ctx context.Context, collName string, limit int64) ([]*entity.BulkInsertTaskState, error) // CreateRole creates a role entity in Milvus. CreateRole(ctx context.Context, name string) error // DropRole drops a role entity in Milvus. DropRole(ctx context.Context, name string) error // AddUserRole adds one role for user. AddUserRole(ctx context.Context, username string, role string) error // RemoveUserRole removes one role from user. RemoveUserRole(ctx context.Context, username string, role string) error // ListRoles lists the role objects in system. ListRoles(ctx context.Context) ([]entity.Role, error) // ListUsers lists the user objects in system. ListUsers(ctx context.Context) ([]entity.User, error) // Grant adds object privileged for role. Grant(ctx context.Context, role string, objectType entity.PriviledgeObjectType, object string) error // Revoke removes privilege from role. Revoke(ctx context.Context, role string, objectType entity.PriviledgeObjectType, object string) error // GetLoadingProgress get the collection or partitions loading progress GetLoadingProgress(ctx context.Context, collectionName string, partitionNames []string) (int64, error) // GetLoadState get the collection or partitions load state GetLoadState(ctx context.Context, collectionName string, partitionNames []string) (entity.LoadState, error) // GetVersion get milvus version GetVersion(ctx context.Context) (string, error) }
Client is the interface used to communicate with Milvus
func NewDefaultGrpcClient ¶
func NewDefaultGrpcClientWithAuth ¶
func NewDefaultGrpcClientWithAuth(ctx context.Context, addr, username, password string) (Client, error)
NewDefaultGrpcClientWithAuth disable transport security
func NewDefaultGrpcClientWithTLSAuth ¶
func NewDefaultGrpcClientWithTLSAuth(ctx context.Context, addr, username, password string) (Client, error)
NewDefaultGrpcClientWithTLSAuth enable transport security
func NewGrpcClient ¶
func NewGrpcClient(ctx context.Context, addr string, dialOptions ...grpc.DialOption) (Client, error)
NewGrpcClient create client with grpc addr the `Connect` API will be called for you dialOptions contains the dial option(s) that control the grpc dialing process
type CreateCollectionOption ¶
type CreateCollectionOption func(*server.CreateCollectionRequest)
CreateCollectionOption is an option that is used to modify CreateCollectionRequest
func WithCollectionProperty ¶
func WithCollectionProperty(key string, value string) CreateCollectionOption
func WithConsistencyLevel ¶
func WithConsistencyLevel(cl entity.ConsistencyLevel) CreateCollectionOption
WithConsistencyLevel specifies a specific ConsistencyLevel, rather than using the default ReaderProperties.
type ErrCollectionNotExists ¶
type ErrCollectionNotExists struct {
// contains filtered or unexported fields
}
ErrCollectionNotExists indicates the collection with specified collection name does not exist
func (ErrCollectionNotExists) Error ¶
func (e ErrCollectionNotExists) Error() string
Error implement error
type ErrPartitionNotExists ¶
type ErrPartitionNotExists struct {
// contains filtered or unexported fields
}
ErrPartitionNotExists indicates the partition of collection does not exist
func (ErrPartitionNotExists) Error ¶
func (e ErrPartitionNotExists) Error() string
Error implement error
type ErrServiceFailed ¶
type ErrServiceFailed error
ErrServiceFailed indicates error returns from milvus Service
type GrpcClient ¶
type GrpcClient struct { Conn *grpc.ClientConn // grpc connection instance Service server.MilvusServiceClient // Service client stub }
GrpcClient, uses default grpc Service definition to connect with Milvus2.0
func (*GrpcClient) AddUserRole ¶
AddUserRole adds one role for user.
func (*GrpcClient) AlterAlias ¶
AlterAlias changes collection alias to provided alias
func (*GrpcClient) BulkInsert ¶
func (c *GrpcClient) BulkInsert(ctx context.Context, collName string, partitionName string, files []string, opts ...BulkInsertOption) (int64, error)
BulkInsert data files(json, numpy, etc.) on MinIO/S3 storage, read and parse them into sealed segments
func (*GrpcClient) CalcDistance ¶
func (*GrpcClient) CreateAlias ¶
CreateAlias creates an alias for collection
func (*GrpcClient) CreateCollection ¶
func (c *GrpcClient) CreateCollection(ctx context.Context, collSchema *entity.Schema, shardNum int32, opts ...CreateCollectionOption) error
CreateCollection create collection with specified schema
func (*GrpcClient) CreateCollectionByRow ¶
func (c *GrpcClient) CreateCollectionByRow(ctx context.Context, row entity.Row, shardNum int32) error
CreateCollectionByRow create collection by row
func (*GrpcClient) CreateCredential ¶
CreateCredential create new user and password
func (*GrpcClient) CreateIndex ¶
func (c *GrpcClient) CreateIndex(ctx context.Context, collName string, fieldName string, idx entity.Index, async bool, opts ...IndexOption) error
CreateIndex create index for collection Deprecated please use CreateIndexV2 instead.
func (*GrpcClient) CreatePartition ¶
func (c *GrpcClient) CreatePartition(ctx context.Context, collName string, partitionName string) error
CreatePartition create partition for collection
func (*GrpcClient) CreateRole ¶
func (c *GrpcClient) CreateRole(ctx context.Context, name string) error
CreateRole creates a role entity in Milvus.
func (*GrpcClient) Delete ¶
func (c *GrpcClient) Delete(ctx context.Context, collName string, partitionName string, expr string) error
Delete deletes entries with bool expression
func (*GrpcClient) DeleteByPks ¶
func (c *GrpcClient) DeleteByPks(ctx context.Context, collName string, partitionName string, ids entity.Column) error
DeleteByPks deletes entries related to provided primary keys
func (*GrpcClient) DeleteCredential ¶
func (c *GrpcClient) DeleteCredential(ctx context.Context, username string) error
DeleteCredential delete a user
func (*GrpcClient) DescribeCollection ¶
func (c *GrpcClient) DescribeCollection(ctx context.Context, collName string) (*entity.Collection, error)
DescribeCollection describe the collection by name
func (*GrpcClient) DescribeIndex ¶
func (c *GrpcClient) DescribeIndex(ctx context.Context, collName string, fieldName string, opts ...IndexOption) ([]entity.Index, error)
DescribeIndex describe index Deprecate please use DescribeIndexV2 instead.
func (*GrpcClient) DropAlias ¶
func (c *GrpcClient) DropAlias(ctx context.Context, alias string) error
DropAlias drops the specified Alias
func (*GrpcClient) DropCollection ¶
func (c *GrpcClient) DropCollection(ctx context.Context, collName string) error
DropCollection drop collection by name
func (*GrpcClient) DropIndex ¶
func (c *GrpcClient) DropIndex(ctx context.Context, collName string, fieldName string, opts ...IndexOption) error
DropIndex drop index from collection Deprecate please use DropIndexV2 instead.
func (*GrpcClient) DropPartition ¶
func (c *GrpcClient) DropPartition(ctx context.Context, collName string, partitionName string) error
DropPartition drop partition from collection
func (*GrpcClient) DropRole ¶
func (c *GrpcClient) DropRole(ctx context.Context, name string) error
DropRole drops a role entity in Milvus.
func (*GrpcClient) Flush ¶
Flush force collection to flush memory records into storage in sync mode, flush will wait all segments to be flushed
func (*GrpcClient) GetBulkInsertState ¶
func (c *GrpcClient) GetBulkInsertState(ctx context.Context, taskID int64) (*entity.BulkInsertTaskState, error)
GetBulkInsertState checks import task state
func (*GrpcClient) GetCollectionStatistics ¶
func (c *GrpcClient) GetCollectionStatistics(ctx context.Context, collName string) (map[string]string, error)
GetCollectionStatistcis show collection statistics
func (*GrpcClient) GetCompactionState ¶
func (c *GrpcClient) GetCompactionState(ctx context.Context, id int64) (entity.CompactionState, error)
GetCompactionState get compaction state of provided compaction id
func (*GrpcClient) GetCompactionStateWithPlans ¶
func (c *GrpcClient) GetCompactionStateWithPlans(ctx context.Context, id int64) (entity.CompactionState, []entity.CompactionPlan, error)
GetCompactionStateWithPlans get compaction state with plans of provided compaction id
func (*GrpcClient) GetIndexBuildProgress ¶
func (c *GrpcClient) GetIndexBuildProgress(ctx context.Context, collName string, fieldName string, opts ...IndexOption) (total, indexed int64, err error)
GetIndexBuildProgress get index building progress Deprecate please use DescribeIndexV2 instead.
func (*GrpcClient) GetIndexState ¶
func (c *GrpcClient) GetIndexState(ctx context.Context, collName string, fieldName string, opts ...IndexOption) (entity.IndexState, error)
GetIndexState get index state Deprecate please use DescribeIndexV2 instead.
func (*GrpcClient) GetLoadState ¶
func (c *GrpcClient) GetLoadState(ctx context.Context, collName string, partitionNames []string) (entity.LoadState, error)
GetLoadState get the collection or partitions load state
func (*GrpcClient) GetLoadingProgress ¶
func (c *GrpcClient) GetLoadingProgress(ctx context.Context, collName string, partitionNames []string) (int64, error)
GetLoadingProgress get the collection or partitions loading progress
func (*GrpcClient) GetPersistentSegmentInfo ¶
func (c *GrpcClient) GetPersistentSegmentInfo(ctx context.Context, collName string) ([]*entity.Segment, error)
GetPersistentSegmentInfo get persistent segment info
func (*GrpcClient) GetQuerySegmentInfo ¶
func (c *GrpcClient) GetQuerySegmentInfo(ctx context.Context, collName string) ([]*entity.Segment, error)
GetQuerySegmentInfo get query query cluster segment loaded info
func (*GrpcClient) GetReplicas ¶
func (c *GrpcClient) GetReplicas(ctx context.Context, collName string) ([]*entity.ReplicaGroup, error)
GetReplicas gets the replica groups as well as their querynodes and shards information
func (*GrpcClient) GetVersion ¶
func (c *GrpcClient) GetVersion(ctx context.Context) (string, error)
func (*GrpcClient) Grant ¶
func (c *GrpcClient) Grant(ctx context.Context, role string, objectType entity.PriviledgeObjectType, object string) error
Grant adds object privileged for role.
func (*GrpcClient) HasCollection ¶
HasCollection check whether collection name exists
func (*GrpcClient) HasPartition ¶
func (c *GrpcClient) HasPartition(ctx context.Context, collName string, partitionName string) (bool, error)
HasPartition check whether specified partition exists
func (*GrpcClient) Insert ¶
func (c *GrpcClient) Insert(ctx context.Context, collName string, partitionName string, columns ...entity.Column) (entity.Column, error)
Insert Index into collection with column-based format collName is the collection name partitionName is the partition to insert, if not specified(empty), default partition will be used columns are slice of the column-based data
func (*GrpcClient) InsertByRows ¶
func (c *GrpcClient) InsertByRows(ctx context.Context, collName string, partitionName string, rows []entity.Row) (entity.Column, error)
InsertByRows insert by rows
func (*GrpcClient) ListBulkInsertTasks ¶
func (c *GrpcClient) ListBulkInsertTasks(ctx context.Context, collName string, limit int64) ([]*entity.BulkInsertTaskState, error)
ListBulkInsertTasks list state of all import tasks
func (*GrpcClient) ListCollections ¶
func (c *GrpcClient) ListCollections(ctx context.Context) ([]*entity.Collection, error)
ListCollections list collections from connection Note that schema info are not provided in collection list
func (*GrpcClient) ListCredUsers ¶
func (c *GrpcClient) ListCredUsers(ctx context.Context) ([]string, error)
ListCredUsers list all usernames
func (*GrpcClient) LoadCollection ¶
func (c *GrpcClient) LoadCollection(ctx context.Context, collName string, async bool, opts ...LoadCollectionOption) error
LoadCollection load collection into memory
func (*GrpcClient) LoadPartitions ¶
func (c *GrpcClient) LoadPartitions(ctx context.Context, collName string, partitionNames []string, async bool) error
LoadPartitions load collection paritions into memory
func (*GrpcClient) ManualCompaction ¶
func (c *GrpcClient) ManualCompaction(ctx context.Context, collName string, toleranceDuration time.Duration) (int64, error)
ManualCompaction triggers a compaction on provided collection
func (*GrpcClient) Query ¶
func (c *GrpcClient) Query(ctx context.Context, collectionName string, partitionNames []string, expr string, outputFields []string, opts ...SearchQueryOptionFunc) ([]entity.Column, error)
Query performs query by expression.
func (*GrpcClient) QueryByPks ¶
func (c *GrpcClient) QueryByPks(ctx context.Context, collectionName string, partitionNames []string, ids entity.Column, outputFields []string, opts ...SearchQueryOptionFunc) ([]entity.Column, error)
QueryByPks query record by specified primary key(s)
func (*GrpcClient) ReleaseCollection ¶
func (c *GrpcClient) ReleaseCollection(ctx context.Context, collName string) error
ReleaseCollection release loaded collection
func (*GrpcClient) ReleasePartitions ¶
func (c *GrpcClient) ReleasePartitions(ctx context.Context, collName string, partitionNames []string) error
ReleasePartitions release partitions
func (*GrpcClient) RemoveUserRole ¶
RemoveUserRole removes one role from user.
func (*GrpcClient) Revoke ¶
func (c *GrpcClient) Revoke(ctx context.Context, role string, objectType entity.PriviledgeObjectType, object string) error
Revoke removes privilege from role.
func (*GrpcClient) Search ¶
func (c *GrpcClient) Search(ctx context.Context, collName string, partitions []string, expr string, outputFields []string, vectors []entity.Vector, vectorField string, metricType entity.MetricType, topK int, sp entity.SearchParam, opts ...SearchQueryOptionFunc) ([]SearchResult, error)
Search with bool expression
func (*GrpcClient) ShowCollection ¶
func (c *GrpcClient) ShowCollection(ctx context.Context, collName string) (*entity.Collection, error)
ShowCollection show collection status, used to check whether it is loaded or not
func (*GrpcClient) ShowPartitions ¶
func (c *GrpcClient) ShowPartitions(ctx context.Context, collName string) ([]*entity.Partition, error)
ShowPartitions list all partitions from collection
func (*GrpcClient) UpdateCredential ¶
func (c *GrpcClient) UpdateCredential(ctx context.Context, username string, oldPassword string, newPassword string) error
UpdateCredential update password for a user
type IndexOption ¶
type IndexOption func(*indexDef)
IndexOption is the predefined function to alter index def. shared among create, describe, drop indexes operations.
func WithIndexName ¶
func WithIndexName(name string) IndexOption
WithIndexName returns an IndexOption with customized index name.
type LoadCollectionOption ¶
type LoadCollectionOption func(*server.LoadCollectionRequest)
LoadCollectionOption is an option that is used to modify LoadCollectionRequest
func WithReplicaNumber ¶
func WithReplicaNumber(rn int32) LoadCollectionOption
WithReplicaNumber specifies a specific ReplicaNumber, rather than using the default ReplicaNumber.
type MockServer ¶
type MockServer struct { sync.RWMutex Injections map[ServiceMethod]TestInjection }
mock Milvus Server
func (*MockServer) AlterAlias ¶
func (m *MockServer) AlterAlias(ctx context.Context, req *server.AlterAliasRequest) (*common.Status, error)
func (*MockServer) AlterCollection ¶
func (m *MockServer) AlterCollection(ctx context.Context, req *server.AlterCollectionRequest) (*common.Status, error)
func (*MockServer) CalcDistance ¶
func (m *MockServer) CalcDistance(ctx context.Context, req *server.CalcDistanceRequest) (*server.CalcDistanceResults, error)
func (*MockServer) CheckHealth ¶
func (m *MockServer) CheckHealth(ctx context.Context, req *server.CheckHealthRequest) (*server.CheckHealthResponse, error)
func (*MockServer) CreateAlias ¶
func (m *MockServer) CreateAlias(ctx context.Context, req *server.CreateAliasRequest) (*common.Status, error)
func (*MockServer) CreateCollection ¶
func (m *MockServer) CreateCollection(ctx context.Context, req *server.CreateCollectionRequest) (*common.Status, error)
func (*MockServer) CreateCredential ¶
func (m *MockServer) CreateCredential(ctx context.Context, req *server.CreateCredentialRequest) (*common.Status, error)
https://wiki.lfaidata.foundation/display/MIL/MEP+27+--+Support+Basic+Authentication
func (*MockServer) CreateIndex ¶
func (m *MockServer) CreateIndex(ctx context.Context, req *server.CreateIndexRequest) (*common.Status, error)
func (*MockServer) CreatePartition ¶
func (m *MockServer) CreatePartition(ctx context.Context, req *server.CreatePartitionRequest) (*common.Status, error)
func (*MockServer) CreateRole ¶
func (m *MockServer) CreateRole(_ context.Context, _ *server.CreateRoleRequest) (*common.Status, error)
https://wiki.lfaidata.foundation/display/MIL/MEP+29+--+Support+Role-Based+Access+Control
func (*MockServer) DelInjection ¶
func (m *MockServer) DelInjection(n ServiceMethod)
func (*MockServer) Delete ¶
func (m *MockServer) Delete(ctx context.Context, req *server.DeleteRequest) (*server.MutationResult, error)
func (*MockServer) DeleteCredential ¶
func (m *MockServer) DeleteCredential(ctx context.Context, req *server.DeleteCredentialRequest) (*common.Status, error)
func (*MockServer) DescribeCollection ¶
func (m *MockServer) DescribeCollection(ctx context.Context, req *server.DescribeCollectionRequest) (*server.DescribeCollectionResponse, error)
func (*MockServer) DescribeIndex ¶
func (m *MockServer) DescribeIndex(ctx context.Context, req *server.DescribeIndexRequest) (*server.DescribeIndexResponse, error)
func (*MockServer) DropAlias ¶
func (m *MockServer) DropAlias(ctx context.Context, req *server.DropAliasRequest) (*common.Status, error)
func (*MockServer) DropCollection ¶
func (m *MockServer) DropCollection(ctx context.Context, req *server.DropCollectionRequest) (*common.Status, error)
func (*MockServer) DropIndex ¶
func (m *MockServer) DropIndex(ctx context.Context, req *server.DropIndexRequest) (*common.Status, error)
func (*MockServer) DropPartition ¶
func (m *MockServer) DropPartition(ctx context.Context, req *server.DropPartitionRequest) (*common.Status, error)
func (*MockServer) DropRole ¶
func (m *MockServer) DropRole(_ context.Context, _ *server.DropRoleRequest) (*common.Status, error)
func (*MockServer) Dummy ¶
func (m *MockServer) Dummy(_ context.Context, _ *server.DummyRequest) (*server.DummyResponse, error)
func (*MockServer) Flush ¶
func (m *MockServer) Flush(ctx context.Context, req *server.FlushRequest) (*server.FlushResponse, error)
func (*MockServer) GetCollectionStatistics ¶
func (m *MockServer) GetCollectionStatistics(ctx context.Context, req *server.GetCollectionStatisticsRequest) (*server.GetCollectionStatisticsResponse, error)
func (*MockServer) GetCompactionState ¶
func (m *MockServer) GetCompactionState(ctx context.Context, req *server.GetCompactionStateRequest) (*server.GetCompactionStateResponse, error)
func (*MockServer) GetCompactionStateWithPlans ¶
func (m *MockServer) GetCompactionStateWithPlans(ctx context.Context, req *server.GetCompactionPlansRequest) (*server.GetCompactionPlansResponse, error)
func (*MockServer) GetComponentStates ¶
func (m *MockServer) GetComponentStates(ctx context.Context, req *server.GetComponentStatesRequest) (*server.ComponentStates, error)
func (*MockServer) GetFlushState ¶
func (m *MockServer) GetFlushState(ctx context.Context, req *server.GetFlushStateRequest) (*server.GetFlushStateResponse, error)
func (*MockServer) GetImportState ¶
func (m *MockServer) GetImportState(_ context.Context, _ *server.GetImportStateRequest) (*server.GetImportStateResponse, error)
func (*MockServer) GetIndexBuildProgress ¶
func (m *MockServer) GetIndexBuildProgress(ctx context.Context, req *server.GetIndexBuildProgressRequest) (*server.GetIndexBuildProgressResponse, error)
func (*MockServer) GetIndexState ¶
func (m *MockServer) GetIndexState(ctx context.Context, req *server.GetIndexStateRequest) (*server.GetIndexStateResponse, error)
func (*MockServer) GetInjection ¶
func (m *MockServer) GetInjection(n ServiceMethod) TestInjection
func (*MockServer) GetLoadState ¶
func (m *MockServer) GetLoadState(ctx context.Context, req *server.GetLoadStateRequest) (*server.GetLoadStateResponse, error)
func (*MockServer) GetLoadingProgress ¶
func (m *MockServer) GetLoadingProgress(ctx context.Context, req *server.GetLoadingProgressRequest) (*server.GetLoadingProgressResponse, error)
func (*MockServer) GetMetrics ¶
func (m *MockServer) GetMetrics(_ context.Context, _ *server.GetMetricsRequest) (*server.GetMetricsResponse, error)
https://wiki.lfaidata.foundation/display/MIL/MEP+8+--+Add+metrics+for+proxy
func (*MockServer) GetPartitionStatistics ¶
func (m *MockServer) GetPartitionStatistics(_ context.Context, _ *server.GetPartitionStatisticsRequest) (*server.GetPartitionStatisticsResponse, error)
func (*MockServer) GetPersistentSegmentInfo ¶
func (m *MockServer) GetPersistentSegmentInfo(ctx context.Context, req *server.GetPersistentSegmentInfoRequest) (*server.GetPersistentSegmentInfoResponse, error)
func (*MockServer) GetQuerySegmentInfo ¶
func (m *MockServer) GetQuerySegmentInfo(ctx context.Context, req *server.GetQuerySegmentInfoRequest) (*server.GetQuerySegmentInfoResponse, error)
func (*MockServer) GetReplicas ¶
func (m *MockServer) GetReplicas(ctx context.Context, req *server.GetReplicasRequest) (*server.GetReplicasResponse, error)
func (*MockServer) GetVersion ¶
func (m *MockServer) GetVersion(ctx context.Context, req *server.GetVersionRequest) (*server.GetVersionResponse, error)
func (*MockServer) HasCollection ¶
func (m *MockServer) HasCollection(ctx context.Context, req *server.HasCollectionRequest) (*server.BoolResponse, error)
func (*MockServer) HasPartition ¶
func (m *MockServer) HasPartition(ctx context.Context, req *server.HasPartitionRequest) (*server.BoolResponse, error)
func (*MockServer) Import ¶
func (m *MockServer) Import(_ context.Context, _ *server.ImportRequest) (*server.ImportResponse, error)
https://wiki.lfaidata.foundation/display/MIL/MEP+24+--+Support+bulk+load
func (*MockServer) Insert ¶
func (m *MockServer) Insert(ctx context.Context, req *server.InsertRequest) (*server.MutationResult, error)
func (*MockServer) ListCredUsers ¶
func (m *MockServer) ListCredUsers(ctx context.Context, req *server.ListCredUsersRequest) (*server.ListCredUsersResponse, error)
func (*MockServer) ListImportTasks ¶
func (m *MockServer) ListImportTasks(_ context.Context, _ *server.ListImportTasksRequest) (*server.ListImportTasksResponse, error)
func (*MockServer) LoadBalance ¶
func (m *MockServer) LoadBalance(_ context.Context, _ *server.LoadBalanceRequest) (*common.Status, error)
func (*MockServer) LoadCollection ¶
func (m *MockServer) LoadCollection(ctx context.Context, req *server.LoadCollectionRequest) (*common.Status, error)
func (*MockServer) LoadPartitions ¶
func (m *MockServer) LoadPartitions(ctx context.Context, req *server.LoadPartitionsRequest) (*common.Status, error)
func (*MockServer) ManualCompaction ¶
func (m *MockServer) ManualCompaction(ctx context.Context, req *server.ManualCompactionRequest) (*server.ManualCompactionResponse, error)
func (*MockServer) OperatePrivilege ¶
func (m *MockServer) OperatePrivilege(_ context.Context, _ *server.OperatePrivilegeRequest) (*common.Status, error)
func (*MockServer) OperateUserRole ¶
func (m *MockServer) OperateUserRole(_ context.Context, _ *server.OperateUserRoleRequest) (*common.Status, error)
func (*MockServer) Query ¶
func (m *MockServer) Query(ctx context.Context, req *server.QueryRequest) (*server.QueryResults, error)
func (*MockServer) RegisterLink ¶
func (m *MockServer) RegisterLink(_ context.Context, _ *server.RegisterLinkRequest) (*server.RegisterLinkResponse, error)
TODO: remove
func (*MockServer) ReleaseCollection ¶
func (m *MockServer) ReleaseCollection(ctx context.Context, req *server.ReleaseCollectionRequest) (*common.Status, error)
func (*MockServer) ReleasePartitions ¶
func (m *MockServer) ReleasePartitions(ctx context.Context, req *server.ReleasePartitionsRequest) (*common.Status, error)
func (*MockServer) Search ¶
func (m *MockServer) Search(ctx context.Context, req *server.SearchRequest) (*server.SearchResults, error)
func (*MockServer) SelectGrant ¶
func (m *MockServer) SelectGrant(_ context.Context, _ *server.SelectGrantRequest) (*server.SelectGrantResponse, error)
func (*MockServer) SelectRole ¶
func (m *MockServer) SelectRole(_ context.Context, _ *server.SelectRoleRequest) (*server.SelectRoleResponse, error)
func (*MockServer) SelectUser ¶
func (m *MockServer) SelectUser(_ context.Context, _ *server.SelectUserRequest) (*server.SelectUserResponse, error)
func (*MockServer) SetInjection ¶
func (m *MockServer) SetInjection(n ServiceMethod, f TestInjection)
func (*MockServer) ShowCollections ¶
func (m *MockServer) ShowCollections(ctx context.Context, req *server.ShowCollectionsRequest) (*server.ShowCollectionsResponse, error)
func (*MockServer) ShowPartitions ¶
func (m *MockServer) ShowPartitions(ctx context.Context, req *server.ShowPartitionsRequest) (*server.ShowPartitionsResponse, error)
func (*MockServer) UpdateCredential ¶
func (m *MockServer) UpdateCredential(ctx context.Context, req *server.UpdateCredentialRequest) (*common.Status, error)
func (*MockServer) Upsert ¶
func (m *MockServer) Upsert(ctx context.Context, req *server.UpsertRequest) (*server.MutationResult, error)
type SearchQueryOption ¶
type SearchQueryOption struct { // Consistency Level & Time travel ConsistencyLevel entity.ConsistencyLevel GuaranteeTimestamp uint64 TravelTimestamp uint64 // Pagination Limit int64 Offset int64 }
SearchQueryOption is an option of search/query request
type SearchQueryOptionFunc ¶
type SearchQueryOptionFunc func(option *SearchQueryOption)
SearchQueryOptionFunc is a function which modifies SearchOption
func WithGuaranteeTimestamp ¶
func WithGuaranteeTimestamp(gt uint64) SearchQueryOptionFunc
WithGuaranteeTimestamp specifies guarantee timestamp
func WithLimit ¶
func WithLimit(limit int64) SearchQueryOptionFunc
WithLimit returns search/query option with limit.
func WithOffset ¶
func WithOffset(offset int64) SearchQueryOptionFunc
WithOffset returns search/query option with offset.
func WithSearchQueryConsistencyLevel ¶
func WithSearchQueryConsistencyLevel(cl entity.ConsistencyLevel) SearchQueryOptionFunc
WithSearchQueryConsistencyLevel specifies consistency level
func WithTravelTimestamp ¶
func WithTravelTimestamp(tt uint64) SearchQueryOptionFunc
WithTravelTimestamp specifies time travel timestamp
type SearchResult ¶
type SearchResult struct { ResultCount int // the returning entry count IDs entity.Column // auto generated id, can be mapped to the columns from `Insert` API Fields []entity.Column // output field data Scores []float32 // distance to the target vector Err error // search error if any }
SearchResult contains the result from Search api of client IDs is the auto generated id values for the entities Fields contains the data of `outputFieleds` specified or all columns if non Scores is actually the distance between the vector current record contains and the search target vector
type SearchResultByRows ¶
SearchResultByRows search result for row-based Search
func SearchResultToRows ¶
func SearchResultToRows(sch *entity.Schema, results *schema.SearchResultData, t reflect.Type, output map[string]struct{}) ([]SearchResultByRows, error)
SearchResultToRows converts search result proto to rows
type ServiceMethod ¶
type ServiceMethod int
type alias for Service method
const ( MCreateCollection ServiceMethod = 101 MDropCollection ServiceMethod = 102 MHasCollection ServiceMethod = 103 MLoadCollection ServiceMethod = 104 MReleaseCollection ServiceMethod = 105 MDescribeCollection ServiceMethod = 106 MListCollection ServiceMethod = 107 MGetCollectionStatistics ServiceMethod = 108 MAlterCollection ServiceMethod = 109 MGetLoadingProgress ServiceMethod = 110 MGetLoadState ServiceMethod = 111 MCreatePartition ServiceMethod = 201 MDropPartition ServiceMethod = 202 MHasPartition ServiceMethod = 203 MLoadPartitions ServiceMethod = 204 MReleasePartitions ServiceMethod = 205 MShowPartitions ServiceMethod = 206 MShowCollections ServiceMethod = 301 MCreateAlias ServiceMethod = 302 MDropAlias ServiceMethod = 303 MAlterAlias ServiceMethod = 304 MGetReplicas ServiceMethod = 305 MCreateIndex ServiceMethod = 401 MDropIndex ServiceMethod = 402 MDescribeIndex ServiceMethod = 403 MGetIndexState ServiceMethod = 404 MGetIndexBuildProgress ServiceMethod = 405 MCreateCredential ServiceMethod = 500 MUpdateCredential ServiceMethod = 501 MDeleteCredential ServiceMethod = 502 MListCredUsers ServiceMethod = 503 MInsert ServiceMethod = 600 MFlush ServiceMethod = 601 MSearch ServiceMethod = 602 MCalcDistance ServiceMethod = 603 MGetFlushState ServiceMethod = 604 MDelete ServiceMethod = 605 MQuery ServiceMethod = 606 MUpsert ServiceMethod = 607 MManualCompaction ServiceMethod = 700 MGetCompactionState ServiceMethod = 701 MGetCompactionStateWithPlans ServiceMethod = 702 MGetPersistentSegmentInfo ServiceMethod = 800 MGetQuerySegmentInfo ServiceMethod = 801 MGetComponentStates ServiceMethod = 900 MGetVersion ServiceMethod = 901 MCheckHealth ServiceMethod = 902 )
Source Files ¶
- client.go
- client_grpc_admin.go
- client_grpc_alias.go
- client_grpc_authentication.go
- client_grpc_collection.go
- client_grpc_control.go
- client_grpc_data.go
- client_grpc_index.go
- client_grpc_options.go
- client_grpc_partition.go
- client_grpc_rbac.go
- client_grpc_row.go
- client_mock.go
- ctx.go
- errors.go
- interceptor.go
- meta_cache.go
- rate_limit_interceptor.go