diff --git a/examples/MilvusClientExample.go b/examples/MilvusClientExample.go index b820b585..d449d463 100644 --- a/examples/MilvusClientExample.go +++ b/examples/MilvusClientExample.go @@ -25,7 +25,7 @@ import ( "time" ) -var tableName string = "test_go" +var collectionName string = "test_go" var dimension int64 = 128 var indexFileSize int64 = 1024 var metricType int64 = int64(milvus.L2) @@ -45,70 +45,95 @@ func example(address string, port string) { //test connect connectParam := milvus.ConnectParam{address, port} - status := client.Connect(connectParam) - if !status.Ok() { - println("client: connect failed: " + status.GetMessage()) + err := client.Connect(connectParam) + if err != nil { + println("client: connect failed: " + err.Error()) } if client.IsConnected() == false { - println("client: not connected: " + status.GetMessage()) + println("client: not connected: ") return } println("Server status: connected") //Get server version var version string - status, version = client.ServerVersion() + var status milvus.Status + version, status, err = client.ServerVersion() + if err != nil { + println("Cmd rpc failed: " + err.Error()) + } if !status.Ok() { println("Get server version failed: " + status.GetMessage()) return } println("Server version: " + version) - //test create table - tableSchema := milvus.TableSchema{tableName, dimension, indexFileSize, metricType} - var hasTable bool - status, hasTable = client.HasTable(tableName) - if hasTable == false { - status = client.CreateTable(tableSchema) + //test create collection + collectionParam := milvus.CollectionParam{collectionName, dimension, indexFileSize, metricType} + var hasCollection bool + hasCollection, status, err = client.HasCollection(collectionName) + if err != nil { + println("HasCollection rpc failed: " + err.Error()) + } + if hasCollection == false { + status, err = client.CreateCollection(collectionParam) + if err != nil { + println("CreateCollection rpc failed: " + err.Error()) + return + } if !status.Ok() { - println("Create table failed: " + status.GetMessage()) + println("Create collection failed: " + status.GetMessage()) return } - println("Create table " + tableName + " success") + println("Create collection " + collectionName + " success") } - status, hasTable = client.HasTable(tableName) - if hasTable == false { - println("Create table failed: " + status.GetMessage()) + hasCollection, status, err = client.HasCollection(collectionName) + if err != nil { + println("HasCollection rpc failed: " + err.Error()) + return + } + if hasCollection == false { + println("Create collection failed: " + status.GetMessage()) return } - println("Table: " + tableName + " exist") + println("Collection: " + collectionName + " exist") println("**************************************************") - //test show tables - var tables []string - status, tables = client.ShowTables() + //test show collections + var collections []string + collections, status, err = client.ShowCollections() + if err != nil { + println("ShowCollections rpc failed: " + err.Error()) + return + } if !status.Ok() { - println("Show tables failed: " + status.GetMessage()) + println("Show collections failed: " + status.GetMessage()) return } - println("ShowTables: ") - for i = 0; i < int64(len(tables)); i++ { - println(" - " + tables[i]) + println("ShowCollections: ") + for i = 0; i < int64(len(collections)); i++ { + println(" - " + collections[i]) } //test insert vectors + records := make([]milvus.Entity, nb) recordArray := make([][]float32, nb) for i = 0; i < nb; i++ { recordArray[i] = make([]float32, dimension) for j = 0; j < dimension; j++ { recordArray[i][j] = float32(i % (j + 1)) } + records[i].FloatData = recordArray[i] + } + insertParam := milvus.InsertParam{collectionName, "", records, nil} + status, err = client.Insert(&insertParam) + if err != nil { + println("Insert rpc failed: " + err.Error()) + return } - insertParam := milvus.InsertParam{tableName, "", recordArray, nil} - status = client.Insert(&insertParam) if !status.Ok() { println("Insert vector failed: " + status.GetMessage()) return @@ -117,30 +142,40 @@ func example(address string, port string) { time.Sleep(3 * time.Second) - //test describe table - status, tableSchema = client.DescribeTable(tableName) + //test describe collection + collectionParam, status, err = client.DescribeCollection(collectionName) + if err != nil { + println("DescribeCollection rpc failed: " + err.Error()) + return + } if !status.Ok() { println("Create index failed: " + status.GetMessage()) return } - println("TableName:" + tableSchema.TableName + "----Dimension:" + strconv.Itoa(int(tableSchema.Dimension)) + - "----IndexFileSize:" + strconv.Itoa(int(tableSchema.IndexFileSize))) + println("CollectionName:" + collectionParam.CollectionName + "----Dimension:" + strconv.Itoa(int(collectionParam.Dimension)) + + "----IndexFileSize:" + strconv.Itoa(int(collectionParam.IndexFileSize))) //Construct query vectors + queryRecords := make([]milvus.Entity, nq) queryVectors := make([][]float32, nq) for i = 0; i < nq; i++ { queryVectors[i] = make([]float32, dimension) for j = 0; j < dimension; j++ { queryVectors[i][j] = float32(i % (j + 1)) } + queryRecords[i].FloatData = queryVectors[i] } println("**************************************************") //Search without create index var topkQueryResult milvus.TopkQueryResult - searchParam := milvus.SearchParam{tableName, queryVectors, nil, topk, nprobe, nil} - status, topkQueryResult = client.Search(searchParam) + extraParams := "{\"nprobe\" : 32}" + searchParam := milvus.SearchParam{collectionName, queryRecords, topk, nil, extraParams} + topkQueryResult, status, err = client.Search(searchParam) + if err != nil { + println("Search rpc failed: " + err.Error()) + } println("Search without index results: ") for i = 0; i < 10; i++ { print(topkQueryResult.QueryResultList[i].Ids[0]) @@ -150,19 +185,28 @@ func example(address string, port string) { println("**************************************************") - //test CountTable - var tableCount int64 - status, tableCount = client.CountTable(tableName) + //test CountCollection + var collectionCount int64 + collectionCount, status, err = client.CountCollection(collectionName) + if err != nil { + println("CountCollection rpc failed: " + err.Error()) + return + } if !status.Ok() { - println("Get table count failed: " + status.GetMessage()) + println("Get collection count failed: " + status.GetMessage()) return } - println("Table count:" + strconv.Itoa(int(tableCount))) + println("Collection count:" + strconv.Itoa(int(collectionCount))) //Create index println("Start create index...") - indexParam := milvus.IndexParam{tableName, milvus.IVFSQ8, nlist} - status = client.CreateIndex(&indexParam) + extraParams = "{\"nlist\" : 16384}" + indexParam := milvus.IndexParam{collectionName, milvus.IVFFLAT, extraParams} + status, err = client.CreateIndex(&indexParam) + if err != nil { + println("CreateIndex rpc failed: " + err.Error()) + return + } if !status.Ok() { println("Create index failed: " + status.GetMessage()) return @@ -170,23 +214,37 @@ func example(address string, port string) { println("Create index success!") //Describe index - status, indexParam = client.DescribeIndex(tableName) + indexParam, status, err = client.DescribeIndex(collectionName) + if err != nil { + println("DescribeIndex rpc failed: " + err.Error()) + return + } if !status.Ok() { println("Describe index failed: " + status.GetMessage()) } - println(indexParam.TableName + "----index type:" + strconv.Itoa(int(indexParam.IndexType))) + println(indexParam.CollectionName + "----index type:" + strconv.Itoa(int(indexParam.IndexType))) - //Preload table - status = client.PreloadTable(tableName) + //Preload collection + status, err = client.PreloadCollection(collectionName) + if err != nil { + println("PreloadCollection rpc failed: " + err.Error()) + return + } if !status.Ok() { println(status.GetMessage()) } - println("Preload table success") + println("Preload collection success") println("**************************************************") //Search with IVFSQ8 index - status, topkQueryResult = client.Search(searchParam) + extraParams = "{\"nprobe\" : 32}" + searchParam = milvus.SearchParam{collectionName, queryRecords, topk, nil, extraParams} + topkQueryResult, status, err = client.Search(searchParam) + if err != nil { + println("Search rpc failed: " + err.Error()) + return + } if !status.Ok() { println("Search vectors failed: " + status.GetMessage()) } @@ -200,23 +258,27 @@ func example(address string, port string) { println("**************************************************") //Drop index - status = client.DropIndex(tableName) + status, err = client.DropIndex(collectionName) + if err != nil { + println("DropIndex rpc failed: " + err.Error()) + return + } if !status.Ok() { println("Drop index failed: " + status.GetMessage()) } - //Drop table - status = client.DropTable(tableName) - status1, hasTable := client.HasTable(tableName) - if !status.Ok() || !status1.Ok() || hasTable == true { - println("Drop table failed: " + status.GetMessage()) + //Drop collection + status, err = client.DropCollection(collectionName) + hasCollection, status1, err := client.HasCollection(collectionName) + if !status.Ok() || !status1.Ok() || hasCollection == true { + println("Drop collection failed: " + status.GetMessage()) return } - println("Drop table " + tableName + "success!") + println("Drop collection " + collectionName + "success!") //GetConfig var configInfo string - status, configInfo = client.GetConfig("*") + configInfo, status, err = client.GetConfig("*") if !status.Ok() { println("Get config failed: " + status.GetMessage()) } @@ -224,15 +286,16 @@ func example(address string, port string) { println(configInfo) //Disconnect - status = client.Disconnect() - if !status.Ok() { - println("Disconnect failed: " + status.GetMessage()) + err = client.Disconnect() + if err != nil { + println("Disconnect failed!") + return } println("Client disconnect server success!") //Server status var serverStatus string - status, serverStatus = client.ServerStatus() + serverStatus, status, err = client.ServerStatus() if !status.Ok() { println("Get server status failed: " + status.GetMessage()) } diff --git a/milvus/ClientProxy.go b/milvus/ClientProxy.go index 99bb4273..9556999a 100644 --- a/milvus/ClientProxy.go +++ b/milvus/ClientProxy.go @@ -17,13 +17,13 @@ * under the License. */ +// package milvus package milvus import ( "context" pb "github.com/milvus-io/milvus-sdk-go/milvus/grpc/gen" "google.golang.org/grpc" - "log" "time" ) @@ -40,7 +40,7 @@ func (client *Milvusclient) GetClientVersion() string { return clientVersion } -func (client *Milvusclient) Connect(connectParam ConnectParam) Status { +func (client *Milvusclient) Connect(connectParam ConnectParam) error { var opts []grpc.DialOption opts = append(opts, grpc.WithInsecure()) opts = append(opts, grpc.WithBlock()) @@ -51,7 +51,7 @@ func (client *Milvusclient) Connect(connectParam ConnectParam) Status { defer cancel() conn, err := grpc.DialContext(ctx, serverAddr, opts...) if err != nil { - log.Fatalf("fail to dial: %v", err) + return err } milvusclient := pb.NewMilvusServiceClient(conn) @@ -60,93 +60,126 @@ func (client *Milvusclient) Connect(connectParam ConnectParam) Status { client.Instance = milvusGrpcClient - return status{0, ""} + return nil } func (client *Milvusclient) IsConnected() bool { return client.Instance != nil } -func (client *Milvusclient) Disconnect() Status { +func (client *Milvusclient) Disconnect() error { client.Instance = nil - return status{0, ""} + return nil } -func (client *Milvusclient) CreateTable(tableSchema TableSchema) Status { - grpcTableSchema := pb.TableSchema{nil, tableSchema.TableName, tableSchema.Dimension, - tableSchema.IndexFileSize, int32(tableSchema.MetricType), struct{}{}, nil, 0} +func (client *Milvusclient) CreateCollection(collectionParam CollectionParam) (Status, error) { + grpcTableSchema := pb.TableSchema{nil, collectionParam.CollectionName, collectionParam.Dimension, + collectionParam.IndexFileSize, int32(collectionParam.MetricType), nil, struct{}{}, nil, 0} grpcStatus, err := client.Instance.CreateTable(grpcTableSchema) if err != nil { - return status{int64(RPCFailed), err.Error()} + return nil, err } errorCode := int64(grpcStatus.ErrorCode) - return status{errorCode, grpcStatus.Reason} + return status{errorCode, grpcStatus.Reason}, err } -func (client *Milvusclient) HasTable(tableName string) (Status, bool) { - grpcTableName := pb.TableName{tableName, struct{}{}, nil, 0} +func (client *Milvusclient) HasCollection(collectionName string) (bool, Status, error) { + grpcTableName := pb.TableName{collectionName, struct{}{}, nil, 0} boolReply, err := client.Instance.HasTable(grpcTableName) if err != nil { - return status{int64(RPCFailed), err.Error()}, boolReply.GetBoolReply() + return false, nil, err } - return status{int64(boolReply.GetStatus().GetErrorCode()), boolReply.GetStatus().GetReason()}, boolReply.GetBoolReply() + return boolReply.GetBoolReply(), status{int64(boolReply.GetStatus().GetErrorCode()), boolReply.GetStatus().GetReason()}, err } -func (client *Milvusclient) DropTable(tableName string) Status { - grpcTableName := pb.TableName{tableName, struct{}{}, nil, 0} +func (client *Milvusclient) DropCollection(collectionName string) (Status, error) { + grpcTableName := pb.TableName{collectionName, struct{}{}, nil, 0} grpcStatus, err := client.Instance.DropTable(grpcTableName) if err != nil { - return status{int64(RPCFailed), err.Error()} + return nil, err } errorCode := int64(grpcStatus.ErrorCode) - return status{errorCode, grpcStatus.Reason} + return status{errorCode, grpcStatus.Reason}, err } -func (client *Milvusclient) CreateIndex(indexParam *IndexParam) Status { - index := pb.Index{int32(indexParam.IndexType), int32(indexParam.Nlist), - struct{}{}, nil, 0} - grpcIndexParam := pb.IndexParam{nil, indexParam.TableName, &index, +func (client *Milvusclient) CreateIndex(indexParam *IndexParam) (Status, error) { + keyValuePair := make([]*pb.KeyValuePair, 1) + pair := pb.KeyValuePair{"params", indexParam.ExtraParams, struct{}{}, nil, 0} + keyValuePair[0] = &pair + grpcIndexParam := pb.IndexParam{nil, indexParam.CollectionName, int32(indexParam.IndexType), keyValuePair, struct{}{}, nil, 0} grpcStatus, err := client.Instance.CreateIndex(grpcIndexParam) if err != nil { - return status{int64(RPCFailed), err.Error()} + return nil, err } - return status{int64(grpcStatus.ErrorCode), grpcStatus.Reason} + return status{int64(grpcStatus.ErrorCode), grpcStatus.Reason}, err } //////////////////////////////////////////////////////////////////////////// -func (client *Milvusclient) Insert(insertParam *InsertParam) Status { +func (client *Milvusclient) Insert(insertParam *InsertParam) (Status, error) { var i int var rowRecordArray = make([]*pb.RowRecord, len(insertParam.RecordArray)) for i = 0; i < len(insertParam.RecordArray); i++ { - rowRecord := pb.RowRecord{insertParam.RecordArray[i], struct{}{}, nil, 0} + rowRecord := pb.RowRecord{insertParam.RecordArray[i].FloatData, insertParam.RecordArray[i].BinaryData, struct{}{}, nil, 0} rowRecordArray[i] = &rowRecord } - grpcInsertParam := pb.InsertParam{insertParam.TableName, rowRecordArray, insertParam.IDArray, - insertParam.PartitionTag, struct{}{}, nil, 0} + + grpcInsertParam := pb.InsertParam{insertParam.CollectionName, rowRecordArray, insertParam.IDArray, + insertParam.PartitionTag, nil, struct{}{}, nil, 0} vectorIds, err := client.Instance.Insert(grpcInsertParam) if err != nil { - return status{int64(RPCFailed), err.Error()} + return nil, err } insertParam.IDArray = vectorIds.VectorIdArray - return status{int64(vectorIds.Status.ErrorCode), vectorIds.Status.Reason} + return status{int64(vectorIds.Status.ErrorCode), vectorIds.Status.Reason}, err +} + +//////////////////////////////////////////////////////////////////////////// + +func (client *Milvusclient) GetEntityByID(collectionName string, vector_id int64) (Entity, Status, error) { + grpcIdentity := pb.VectorIdentity{collectionName, vector_id, struct{}{}, nil, 0} + grpcVectorData, err := client.Instance.GetVectorByID(grpcIdentity) + if err != nil { + return Entity{nil, nil}, nil, err + } + if grpcVectorData.VectorData != nil { + return Entity{grpcVectorData.VectorData.FloatData, grpcVectorData.VectorData.BinaryData}, + status{int64(grpcVectorData.Status.ErrorCode), grpcVectorData.Status.Reason}, err + } + return Entity{nil, nil}, status{int64(grpcVectorData.Status.ErrorCode), grpcVectorData.Status.Reason}, err } //////////////////////////////////////////////////////////////////////////// -func (client *Milvusclient) Search(searchParam SearchParam) (Status, TopkQueryResult) { - var queryRecordArray = make([]*pb.RowRecord, len(searchParam.QueryVectors)) +func (client *Milvusclient) GetEntityIDs(getEntityIDsParam GetEntityIDsParam) ([]int64, Status, error) { + grpcParam := pb.GetVectorIDsParam{getEntityIDsParam.CollectionName, getEntityIDsParam.SegmentName, struct{}{}, nil, 0} + vectorIDs, err := client.Instance.GetVectorIDs(grpcParam) + if err != nil { + return nil, nil, err + } + return vectorIDs.VectorIdArray, status{int64(vectorIDs.Status.ErrorCode), vectorIDs.Status.Reason}, err +} + +//////////////////////////////////////////////////////////////////////////// + +func (client *Milvusclient) Search(searchParam SearchParam) (TopkQueryResult, Status, error) { + var queryRecordArray = make([]*pb.RowRecord, len(searchParam.QueryEntities)) var i, j int64 - for i = 0; i < int64(len(searchParam.QueryVectors)); i++ { - rowRecord := pb.RowRecord{searchParam.QueryVectors[i], struct{}{}, nil, 0} + for i = 0; i < int64(len(searchParam.QueryEntities)); i++ { + rowRecord := pb.RowRecord{searchParam.QueryEntities[i].FloatData, searchParam.QueryEntities[i].BinaryData, struct{}{}, nil, 0} queryRecordArray[i] = &rowRecord } - grpcSearchParam := pb.SearchParam{searchParam.TableName, queryRecordArray, nil, - searchParam.Topk, searchParam.Nprobe, searchParam.PartitionTag, struct{}{}, nil, 0} + + keyValuePair := make([]*pb.KeyValuePair, 1) + pair := pb.KeyValuePair{"params", searchParam.ExtraParams, struct{}{}, nil, 0} + keyValuePair[0] = &pair + + grpcSearchParam := pb.SearchParam{searchParam.CollectionName, searchParam.PartitionTag, queryRecordArray, + searchParam.Topk, keyValuePair, struct{}{}, nil, 0} topkQueryResult, err := client.Instance.Search(grpcSearchParam) if err != nil { - return status{int64(RPCFailed), err.Error()}, TopkQueryResult{nil} + return TopkQueryResult{nil}, nil, err } nq := topkQueryResult.GetRowNum() var result = make([]QueryResult, nq) @@ -159,137 +192,226 @@ func (client *Milvusclient) Search(searchParam SearchParam) (Status, TopkQueryRe result[i].Distances[j] = topkQueryResult.GetDistances()[i*nq+j] } } - return status{int64(topkQueryResult.Status.ErrorCode), topkQueryResult.Status.Reason}, - TopkQueryResult{result} + return TopkQueryResult{result}, status{int64(topkQueryResult.Status.ErrorCode), topkQueryResult.Status.Reason}, nil +} + +//////////////////////////////////////////////////////////////////////////// + +func (client *Milvusclient) DeleteByID(collectionName string, id_array []int64) (Status, error) { + grpcParam := pb.DeleteByIDParam{collectionName, id_array, struct{}{}, nil, 0} + grpcStatus, err := client.Instance.DeleteByID(grpcParam) + if err != nil { + return nil, err + } + return status{int64(grpcStatus.GetErrorCode()), grpcStatus.GetReason()}, err } -func (client *Milvusclient) DescribeTable(tableName string) (Status, TableSchema) { - grpcTableName := pb.TableName{tableName, struct{}{}, nil, 0} - tableSchema, err := client.Instance.DescribeTable(grpcTableName) +//////////////////////////////////////////////////////////////////////////// + +func (client *Milvusclient) DescribeCollection(collectionName string) (CollectionParam, Status, error) { + grpcCollectionName := pb.TableName{collectionName, struct{}{}, nil, 0} + tableSchema, err := client.Instance.DescribeTable(grpcCollectionName) if err != nil { - return status{int64(RPCFailed), err.Error()}, TableSchema{"", 0, 0, 0} + return CollectionParam{"", 0, 0, 0}, nil, err } - return status{int64(tableSchema.GetStatus().GetErrorCode()), tableSchema.Status.Reason}, - TableSchema{tableSchema.GetTableName(), tableSchema.GetDimension(), tableSchema.GetIndexFileSize(), int64(tableSchema.GetMetricType())} + return CollectionParam{tableSchema.GetTableName(), tableSchema.GetDimension(), tableSchema.GetIndexFileSize(), int64(tableSchema.GetMetricType())}, + status{int64(tableSchema.GetStatus().GetErrorCode()), tableSchema.Status.Reason}, err } -func (client *Milvusclient) CountTable(tableName string) (Status, int64) { - grpcTableName := pb.TableName{tableName, struct{}{}, nil, 0} +//////////////////////////////////////////////////////////////////////////// + +func (client *Milvusclient) CountCollection(collectionName string) (int64, Status, error) { + grpcTableName := pb.TableName{collectionName, struct{}{}, nil, 0} rowCount, err := client.Instance.CountTable(grpcTableName) if err != nil { - return status{int64(RPCFailed), err.Error()}, 0 + return 0, nil, err } - return status{int64(rowCount.GetStatus().GetErrorCode()), rowCount.GetStatus().GetReason()}, rowCount.GetTableRowCount() + return rowCount.GetTableRowCount(), status{int64(rowCount.GetStatus().GetErrorCode()), + rowCount.GetStatus().GetReason()}, err +} + +//////////////////////////////////////////////////////////////////////////// +func (client *Milvusclient) ShowCollections() ([]string, Status, error) { + tableNameList, err := client.Instance.ShowTables() + if err != nil { + return nil, nil, err + } + return tableNameList.GetTableNames(), status{int64(tableNameList.GetStatus().GetErrorCode()), tableNameList.GetStatus().GetReason()}, err } -func (client *Milvusclient) ShowTables() (Status, []string) { - tableNameList, err := client.Instance.ShowTable() +//////////////////////////////////////////////////////////////////////////// + +func (client *Milvusclient) ShowCollectionInfo(collectionName string) (CollectionInfo, Status, error) { + grpcTableName := pb.TableName{collectionName, struct{}{}, nil, 0} + grpcTableInfo, err := client.Instance.ShowTableInfos(grpcTableName) if err != nil { - return status{int64(RPCFailed), err.Error()}, nil + return CollectionInfo{0, nil}, nil, err + } + partitionStats := make([]PartitionStat, len(grpcTableInfo.PartitionsStat)) + var i, j int + for i = 0; i < len(grpcTableInfo.PartitionsStat); i++ { + partitionStats[i].Tag = grpcTableInfo.PartitionsStat[i].Tag + partitionStats[i].RowCount = grpcTableInfo.PartitionsStat[i].TotalRowCount + segmentStat := make([]SegmentStat, len(grpcTableInfo.PartitionsStat[i].SegmentsStat)) + for j = 0; j < len(grpcTableInfo.GetPartitionsStat()[i].GetSegmentsStat()); j++ { + segmentStat[j] = SegmentStat{grpcTableInfo.PartitionsStat[i].SegmentsStat[j].SegmentName, + grpcTableInfo.PartitionsStat[i].SegmentsStat[j].RowCount, + grpcTableInfo.PartitionsStat[i].SegmentsStat[j].IndexName, + grpcTableInfo.PartitionsStat[i].SegmentsStat[j].DataSize} + } + partitionStats[i].SegmentsStat = segmentStat } - return status{int64(tableNameList.GetStatus().GetErrorCode()), tableNameList.GetStatus().GetReason()}, tableNameList.GetTableNames() + collectionInfo := CollectionInfo{grpcTableInfo.TotalRowCount, partitionStats} + return collectionInfo, status{int64(grpcTableInfo.Status.ErrorCode), grpcTableInfo.Status.Reason}, err } -func (client *Milvusclient) ServerVersion() (Status, string) { +//////////////////////////////////////////////////////////////////////////// + +func (client *Milvusclient) ServerVersion() (string, Status, error) { command := pb.Command{"version", struct{}{}, nil, 0} serverVersion, err := client.Instance.Cmd(command) if err != nil { - return status{int64(RPCFailed), err.Error()}, "" + return "", nil, err } - return status{int64(serverVersion.GetStatus().GetErrorCode()), serverVersion.GetStatus().GetReason()}, serverVersion.GetStringReply() + return serverVersion.GetStringReply(), status{int64(serverVersion.GetStatus().GetErrorCode()), serverVersion.GetStatus().GetReason()}, err } -func (client *Milvusclient) ServerStatus() (Status, string) { +//////////////////////////////////////////////////////////////////////////// + +func (client *Milvusclient) ServerStatus() (string, Status, error) { if client.Instance == nil { - return status{int64(0), ""}, "not connect to server" + return "not connect to server", status{int64(0), ""}, nil } command := pb.Command{"", struct{}{}, nil, 0} serverStatus, err := client.Instance.Cmd(command) if err != nil { - return status{int64(RPCFailed), err.Error()}, "" + return "connection lost", nil, err } - return status{int64(serverStatus.GetStatus().GetErrorCode()), serverStatus.GetStatus().GetReason()}, serverStatus.GetStringReply() + return "server alive", status{int64(serverStatus.GetStatus().GetErrorCode()), serverStatus.GetStatus().GetReason()}, err } -func (client *Milvusclient) PreloadTable(tableName string) Status { - grpcTableName := pb.TableName{tableName, struct{}{}, nil, 0} +//////////////////////////////////////////////////////////////////////////// + +func (client *Milvusclient) PreloadCollection(collectionName string) (Status, error) { + grpcTableName := pb.TableName{collectionName, struct{}{}, nil, 0} grpcStatus, err := client.Instance.PreloadTable(grpcTableName) if err != nil { - return status{int64(RPCFailed), err.Error()} + return nil, err } - return status{int64(grpcStatus.GetErrorCode()), grpcStatus.GetReason()} + return status{int64(grpcStatus.GetErrorCode()), grpcStatus.GetReason()}, err } -func (client *Milvusclient) DescribeIndex(tableName string) (Status, IndexParam) { - grpcTableName := pb.TableName{tableName, struct{}{}, nil, 0} +//////////////////////////////////////////////////////////////////////////// + +func (client *Milvusclient) DescribeIndex(collectionName string) (IndexParam, Status, error) { + grpcTableName := pb.TableName{collectionName, struct{}{}, nil, 0} indexParam, err := client.Instance.DescribeIndex(grpcTableName) if err != nil { - return status{int64(RPCFailed), err.Error()}, IndexParam{"", 0, 0} + return IndexParam{"", 0, ""}, nil, err + } + var i int + var extraParam string + for i = 0; i < len(indexParam.ExtraParams); i++ { + if indexParam.ExtraParams[i].Key == "params" { + extraParam = indexParam.ExtraParams[i].Value + } } - return status{int64(indexParam.GetStatus().GetErrorCode()), indexParam.GetStatus().GetReason()}, - IndexParam{indexParam.GetTableName(), IndexType(indexParam.GetIndex().GetIndexType()), int64(indexParam.GetIndex().GetNlist())} + return IndexParam{indexParam.GetTableName(), IndexType(indexParam.IndexType), extraParam}, + status{int64(indexParam.GetStatus().GetErrorCode()), indexParam.GetStatus().GetReason()}, err } -func (client *Milvusclient) DropIndex(tableName string) Status { - grpcTableName := pb.TableName{tableName, struct{}{}, nil, 0} +//////////////////////////////////////////////////////////////////////////// + +func (client *Milvusclient) DropIndex(collectionName string) (Status, error) { + grpcTableName := pb.TableName{collectionName, struct{}{}, nil, 0} grpcStatus, err := client.Instance.DropIndex(grpcTableName) if err != nil { - return status{int64(RPCFailed), err.Error()} + return nil, err } - return status{int64(grpcStatus.GetErrorCode()), grpcStatus.GetReason()} + return status{int64(grpcStatus.GetErrorCode()), grpcStatus.GetReason()}, err } -func (client *Milvusclient) CreatePartition(partitionParam PartitionParam) Status { - grpcPartitionParam := pb.PartitionParam{partitionParam.TableName, partitionParam.PartitionName, +//////////////////////////////////////////////////////////////////////////// + +func (client *Milvusclient) CreatePartition(partitionParam PartitionParam) (Status, error) { + grpcPartitionParam := pb.PartitionParam{partitionParam.CollectionName, partitionParam.PartitionTag, struct{}{}, nil, 0} grpcStatus, err := client.Instance.CreatePartition(grpcPartitionParam) if err != nil { - return status{int64(RPCFailed), err.Error()} + return nil, err } - return status{int64(grpcStatus.GetErrorCode()), grpcStatus.GetReason()} + return status{int64(grpcStatus.GetErrorCode()), grpcStatus.GetReason()}, err } -func (client *Milvusclient) ShowPartitions(tableName string) (Status, []PartitionParam) { - grpcTableName := pb.TableName{tableName, struct{}{}, nil, 0} +//////////////////////////////////////////////////////////////////////////// + +func (client *Milvusclient) ShowPartitions(collectionName string) ([]PartitionParam, Status, error) { + grpcTableName := pb.TableName{collectionName, struct{}{}, nil, 0} grpcPartitionList, err := client.Instance.ShowPartitions(grpcTableName) if err != nil { - return status{int64(RPCFailed), err.Error()}, nil + return nil, status{int64(RPCFailed), err.Error()}, err } - var partitionList = make([]PartitionParam, len(grpcPartitionList.GetPartitionArray())) + var partitionList = make([]PartitionParam, len(grpcPartitionList.GetPartitionTagArray())) var i int - for i = 0; i < len(grpcPartitionList.GetPartitionArray()); i++ { - partitionList[i].TableName = grpcPartitionList.GetPartitionArray()[i].TableName - partitionList[i].PartitionTag = grpcPartitionList.GetPartitionArray()[i].Tag - partitionList[i].PartitionName = grpcPartitionList.GetPartitionArray()[i].PartitionName + for i = 0; i < len(grpcPartitionList.GetPartitionTagArray()); i++ { + partitionList[i].CollectionName = grpcPartitionList.GetPartitionTagArray()[i] } - return status{int64(grpcPartitionList.GetStatus().GetErrorCode()), grpcPartitionList.GetStatus().GetReason()}, partitionList + return partitionList, status{int64(grpcPartitionList.GetStatus().GetErrorCode()), grpcPartitionList.GetStatus().GetReason()}, err } -func (client *Milvusclient) DropPartition(partitionParam PartitionParam) Status { - grpcPartitionParam := pb.PartitionParam{partitionParam.TableName, partitionParam.PartitionName, +//////////////////////////////////////////////////////////////////////////// + +func (client *Milvusclient) DropPartition(partitionParam PartitionParam) (Status, error) { + grpcPartitionParam := pb.PartitionParam{partitionParam.CollectionName, partitionParam.PartitionTag, struct{}{}, nil, 0} grpcStatus, err := client.Instance.DropPartition(grpcPartitionParam) if err != nil { - return status{int64(RPCFailed), err.Error()} + return nil, err } - return status{int64(grpcStatus.GetErrorCode()), grpcStatus.Reason} + return status{int64(grpcStatus.GetErrorCode()), grpcStatus.Reason}, err } -func (client *Milvusclient) GetConfig(nodeName string) (Status, string) { +//////////////////////////////////////////////////////////////////////////// + +func (client *Milvusclient) GetConfig(nodeName string) (string, Status, error) { command := pb.Command{"get_config " + nodeName, struct{}{}, nil, 0} configInfo, err := client.Instance.Cmd(command) if err != nil { - return status{int64(RPCFailed), err.Error()}, "" + return "", nil, err } - return status{int64(configInfo.GetStatus().GetErrorCode()), configInfo.GetStatus().GetReason()}, configInfo.GetStringReply() + return configInfo.GetStringReply(), status{int64(configInfo.GetStatus().GetErrorCode()), configInfo.GetStatus().GetReason()}, err } -func (client *Milvusclient) SetConfig(nodeName string, value string) Status { +//////////////////////////////////////////////////////////////////////////// + +func (client *Milvusclient) SetConfig(nodeName string, value string) (Status, error) { command := pb.Command{"set_config " + nodeName + " " + value, struct{}{}, nil, 0} reply, err := client.Instance.Cmd(command) if err != nil { - return status{int64(RPCFailed), err.Error()} + return nil, err + } + return status{int64(reply.GetStatus().GetErrorCode()), reply.GetStatus().GetReason()}, err +} + +//////////////////////////////////////////////////////////////////////////// + +func (client *Milvusclient) Flush(collectionNameArray []string) (Status, error) { + grpcParam := pb.FlushParam{collectionNameArray, struct{}{}, nil, 0} + grpcStatus, err := client.Instance.Flush(grpcParam) + if err != nil { + return nil, err + } + return status{int64(grpcStatus.GetErrorCode()), grpcStatus.GetReason()}, err +} + +//////////////////////////////////////////////////////////////////////////// + +func (client *Milvusclient) Compact(collectionName string) (Status, error) { + grpcParam := pb.TableName{collectionName, struct{}{}, nil, 0} + grpcStatus, err := client.Instance.Compact(grpcParam) + if err != nil { + return nil, err } - return status{int64(reply.GetStatus().GetErrorCode()), reply.GetStatus().GetReason()} + return status{int64(grpcStatus.GetErrorCode()), grpcStatus.GetReason()}, err } diff --git a/milvus/MilvusClient.go b/milvus/MilvusClient.go index 54bf7675..64715d21 100644 --- a/milvus/MilvusClient.go +++ b/milvus/MilvusClient.go @@ -17,6 +17,7 @@ * under the License. */ +// package milvus package milvus import () @@ -61,6 +62,8 @@ const ( SPTAGKDT IndexType = 7 // SPTAGBKT sptagbkt SPTAGBKT IndexType = 8 + // HNSW hnsw + HNSW IndexType = 11 ) // ConnectParam Parameters for connect @@ -71,11 +74,41 @@ type ConnectParam struct { Port string } -//TableSchema informations of a table -type TableSchema struct { - // TableName table name - TableName string - // Dimension Vector dimension, must be a positive value +// SegmentStat segment statistics +type SegmentStat struct { + // SegmentName segment name + SegmentName string + // RowCount segment row count + RowCount int64 + // IndexName index name + IndexName string + //DataSize data size + DataSize int64 +} + +// PartitionStat +type PartitionStat struct { + // Tag partition tag + Tag string + // RowCount row count of partition + RowCount int64 + // SegmentsStat array of partition's SegmentStat + SegmentsStat []SegmentStat +} + +//CollectionInfo +type CollectionInfo struct { + // TotalRowCount collection total row count + TotalRowCount int64 + // PartitionsStat collection's parititons statistics + PartitionsStat []PartitionStat +} + +//CollectionParam informations of a collection +type CollectionParam struct { + // CollectionName collection name + CollectionName string + // Dimension Entity dimension, must be a positive value Dimension int64 // IndexFileSize Index file size, must be a positive value IndexFileSize int64 @@ -85,22 +118,43 @@ type TableSchema struct { // IndexParam index parameters type IndexParam struct { - // TableName table name for create index - TableName string + // CollectionName collection name for create index + CollectionName string // IndexType create index type IndexType IndexType - // Nlist index nlist - Nlist int64 + // ExtraParams extra parameters + // Note: extra_params is extra parameters list, it must be json format + // For different index type, parameter list is different accordingly, for example: + // FLAT/IVFLAT/SQ8: "{nlist: '16384'}" + // ///< nlist range:[1, 999999] + // IVFPQ: "{nlist: '16384', m: "12"}" + // ///< nlist range:[1, 999999] + // ///< m is decided by dim and have a couple of results. + // NSG: "{search_length: '45', out_degree:'50', candidate_pool_size:'300', "knng":'100'}" + // ///< search_length range:[10, 300] + // ///< out_degree range:[5, 300] + // ///< candidate_pool_size range:[50, 1000] + // ///< knng range:[5, 300] + // HNSW "{M: '16', efConstruction:'500'}" + // ///< M range:[5, 48] + // ///< efConstruction range:[topk, 4096] + ExtraParams string +} + +// Entity record typy +type Entity struct { + FloatData []float32 + BinaryData []byte } // InsertParam insert parameters type InsertParam struct { - // TableName table name - TableName string + // CollectionName collection name + CollectionName string // PartitionTag partition tag PartitionTag string - // RecordArray raw vectors array - RecordArray [][]float32 + // RecordArray raw entities array + RecordArray []Entity // IDArray id array IDArray []int64 } @@ -115,18 +169,24 @@ type Range struct { // SearchParam search parameters type SearchParam struct { - // TableName table name for search - TableName string - // QueryVectors query vectors raw array - QueryVectors [][]float32 - // DateRange date range array - DateRanges [][]Range + // CollectionName collection name for search + CollectionName string + // QueryEntities query entities raw array + QueryEntities []Entity // Topk topk Topk int64 - // Nprobe nprobe - Nprobe int64 // PartitionTag partition tag array PartitionTag []string + // ExtraParams extra parameters + // Note: extra_params is extra parameters list, it must be json format, for example: + // For different index type, parameter list is different accordingly + // FLAT/IVFLAT/SQ8/IVFPQ: "{nprobe: '32'}" + // ///< nprobe range:[1,999999] + // NSG: "{search_length:'100'} + // ///< search_length range:[10, 300] + // HNSW "{ef: '64'} + // ///< ef range:[k, 4096] + ExtraParams string } //QueryResult Query result @@ -145,14 +205,17 @@ type TopkQueryResult struct { // PartitionParam partition parameters type PartitionParam struct { - // TableName partition table name - TableName string - // PartitionName partition name - PartitionName string + // CollectionName partition collection name + CollectionName string // PartitionTag partition tag PartitionTag string } +type GetEntityIDsParam struct { + CollectionName string + SegmentName string +} + // MilvusClient SDK main interface type MilvusClient interface { @@ -164,7 +227,7 @@ type MilvusClient interface { // Connect method // Create a connection instance and return it's shared pointer // return indicate if connect is successful - Connect(connectParam ConnectParam) Status + Connect(connectParam ConnectParam) error // IsConnected method // This method is used to test whether server is connected @@ -174,101 +237,131 @@ type MilvusClient interface { // Disconnect method // This method is used to disconnect server // return indicate if disconnect is successful - Disconnect() Status + Disconnect() error - // CreateTable method - // This method is used to create table - // param tableSchema is used to provide table information to be created. - // return indicate if table is created successfully - CreateTable(tableSchema TableSchema) Status + // CreateCollection method + // This method is used to create collection + // param collectionParam is used to provide collection information to be created. + // return indicate if collection is created successfully + CreateCollection(collectionParam CollectionParam) (Status, error) - // HasTable method - // This method is used to create table. - //return indicate if table is cexist - HasTable(tableName string) (Status, bool) + // HasCollection method + // This method is used to create collection. + //return indicate if collection is exist + HasCollection(collectionName string) (bool, Status, error) - // DropTable method - // This method is used to drop table(and its partitions). - // return indicate if table is drop successfully. - DropTable(tableName string) Status + // DropCollection method + // This method is used to drop collection(and its partitions). + // return indicate if collection is drop successfully. + DropCollection(collectionName string) (Status, error) // CreateIndex method - // This method is used to create index for whole table(and its partitions). + // This method is used to create index for whole collection(and its partitions). // return indicate if build index successfully. - CreateIndex(indexParam *IndexParam) Status + CreateIndex(indexParam *IndexParam) (Status, error) // Insert method - // This method is used to query vector in table. + // This method is used to query entity in collection. // return indicate if insert is successful. - Insert(insertParam *InsertParam) Status + Insert(insertParam *InsertParam) (Status, error) + + // GetEntityByID method + // This method is used to get entity by entity id + // return entity data + GetEntityByID(collectionName string, entity_id int64) (Entity, Status, error) + + // GetEntityIDs method + // This method is used to get entity ids + // return entity ids + GetEntityIDs(getEntityIDsParam GetEntityIDsParam) ([]int64, Status, error) // Search method - // This method is used to query vector in table. + // This method is used to query entity in collection. // return indicate if query is successful. - Search(searchParam SearchParam) (Status, TopkQueryResult) + Search(searchParam SearchParam) (TopkQueryResult, Status, error) - // DescribeTable method - // This method is used to show table information. + // DeleteByID method + // This method is used to delete entities by ids + // return indicate if delete is successful + DeleteByID(collectionName string, id_array []int64) (Status, error) + + // DescribeCollection method + // This method is used to show collection information. //return indicate if this operation is successful. - DescribeTable(tableName string) (Status, TableSchema) + DescribeCollection(collectionName string) (CollectionParam, Status, error) - // CountTable method - // This method is used to get table row count. + // CountCollection method + // This method is used to get collection row count. // return indicate if this operation is successful. - CountTable(tableName string) (Status, int64) + CountCollection(collectionName string) (int64, Status, error) - // ShowTables method - // This method is used to list all tables. + // ShowCollections method + // This method is used to list all collections. // return indicate if this operation is successful. - ShowTables() (Status, []string) + ShowCollections() ([]string, Status, error) + + // ShowCollectionInfo method + // This method is used to get collection informations + // return collection informations + ShowCollectionInfo(collectionName string) (CollectionInfo, Status, error) // ServerVersion method // This method is used to give the server version. // return server version. - ServerVersion() (Status, string) + ServerVersion() (string, Status, error) // ServerStatus method // This method is used to give the server status. // return server status. - ServerStatus() (Status, string) + ServerStatus() (string, Status, error) - // PreloadTable method - // This method is used to preload table + // PreloadCollection method + // This method is used to preload collection // return indicate if this operation is successful. - PreloadTable(tableName string) Status + PreloadCollection(collectionName string) (Status, error) // DescribeIndex method // This method is used to describe index // return indicate if this operation is successful. - DescribeIndex(tableName string) (Status, IndexParam) + DescribeIndex(collectionName string) (IndexParam, Status, error) // DropIndex method - // This method is used to drop index of table(and its partitions) + // This method is used to drop index of collection(and its partitions) // return indicate if this operation is successful. - DropIndex(tableName string) Status + DropIndex(collectionName string) (Status, error) // CreatePartition method - // This method is used to create table partition + // This method is used to create collection partition // return indicate if partition is created successfully - CreatePartition(partitionParam PartitionParam) Status + CreatePartition(partitionParam PartitionParam) (Status, error) // ShowPartition method - // This method is used to create table + // This method is used to create collection // return indicate if this operation is successful - ShowPartitions(tableName string) (Status, []PartitionParam) + ShowPartitions(collectionName string) ([]PartitionParam, Status, error) // DropPartition method - // This method is used to delete table partition. + // This method is used to delete collection partition. // return indicate if partition is delete successfully. - DropPartition(partitionParam PartitionParam) Status + DropPartition(partitionParam PartitionParam) (Status, error) // GetConfig // This method is used to get config // return indicate if this operation is successful. - GetConfig(nodeName string) (Status, string) + GetConfig(nodeName string) (string, Status, error) // SetConfig // This method is used to set config // return indicate if this operation is successful. - SetConfig(nodeName string, value string) Status + SetConfig(nodeName string, value string) (Status, error) + + // Flush method + // This method is used to flush collections + // return indicate if flush is successful + Flush(collectionNameArray []string) (Status, error) + + // Compact method + // This method is used to compact collection + // return indicate if compact is successful + Compact(collectionName string) (Status, error) } diff --git a/milvus/MilvusGrpcClient.go b/milvus/MilvusGrpcClient.go index 64a3dd41..9d3a9f70 100644 --- a/milvus/MilvusGrpcClient.go +++ b/milvus/MilvusGrpcClient.go @@ -17,11 +17,11 @@ * under the License. */ +// package milvus package milvus import ( "context" - "log" "time" pb "github.com/milvus-io/milvus-sdk-go/milvus/grpc/gen" @@ -39,7 +39,9 @@ type MilvusGrpcClient interface { CountTable(tableName pb.TableName) (pb.TableRowCount, error) - ShowTable() (pb.TableNameList, error) + ShowTables() (pb.TableNameList, error) + + ShowTableInfos(tableName pb.TableName) (pb.TableInfo, error) DropTable(tableName pb.TableName) (pb.Status, error) @@ -57,15 +59,23 @@ type MilvusGrpcClient interface { Insert(insertParam pb.InsertParam) (pb.VectorIds, error) + GetVectorByID(identity pb.VectorIdentity) (pb.VectorData, error) + + GetVectorIDs(param pb.GetVectorIDsParam) (pb.VectorIds, error) + Search(searchParam pb.SearchParam) (*pb.TopKQueryResult, error) SearchInFiles(searchInFilesParam pb.SearchInFilesParam) (*pb.TopKQueryResult, error) Cmd(command pb.Command) (pb.StringReply, error) - DeleteByDate(deleteByDateParam pb.DeleteByDateParam) (pb.Status, error) + DeleteByID(param pb.DeleteByIDParam) (pb.Status, error) PreloadTable(tableName pb.TableName) (pb.Status, error) + + Flush(param pb.FlushParam) (pb.Status, error) + + Compact(name pb.TableName) (pb.Status, error) } type milvusGrpcClient struct { @@ -81,9 +91,6 @@ func (grpcClient *milvusGrpcClient) CreateTable(tableSchema pb.TableSchema) (pb. ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() reply, err := grpcClient.serviceInstance.CreateTable(ctx, &tableSchema) - if err != nil { - log.Println("CreateTable rpc failed: " + err.Error()) - } return *reply, err } @@ -91,10 +98,6 @@ func (grpcClient *milvusGrpcClient) HasTable(tableName pb.TableName) (pb.BoolRep ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() boolReply, err := grpcClient.serviceInstance.HasTable(ctx, &tableName) - if err != nil { - log.Println("HasTable rpc failed: " + err.Error()) - } - return *boolReply, err } @@ -102,9 +105,6 @@ func (grpcClient *milvusGrpcClient) DescribeTable(tableName pb.TableName) (pb.Ta ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() tableSchema, err := grpcClient.serviceInstance.DescribeTable(ctx, &tableName) - if err != nil { - log.Println("DescribeTable rpc failed: " + err.Error()) - } return *tableSchema, err } @@ -112,39 +112,34 @@ func (grpcClient *milvusGrpcClient) CountTable(tableName pb.TableName) (pb.Table ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() count, err := grpcClient.serviceInstance.CountTable(ctx, &tableName) - if err != nil { - log.Println("CountTable rpc failed: " + err.Error()) - } return *count, err } -func (grpcClient *milvusGrpcClient) ShowTable() (pb.TableNameList, error) { +func (grpcClient *milvusGrpcClient) ShowTables() (pb.TableNameList, error) { cmd := pb.Command{"", struct{}{}, nil, 0} ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() tableNameList, err := grpcClient.serviceInstance.ShowTables(ctx, &cmd) - if err != nil { - log.Println("ShowTable rpc failed: " + err.Error()) - } return *tableNameList, err } +func (grpcClient *milvusGrpcClient) ShowTableInfos(tableName pb.TableName) (pb.TableInfo, error) { + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() + tableInfo, err := grpcClient.serviceInstance.ShowTableInfo(ctx, &tableName) + return *tableInfo, err +} + func (grpcClient *milvusGrpcClient) DropTable(tableName pb.TableName) (pb.Status, error) { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() status, err := grpcClient.serviceInstance.DropTable(ctx, &tableName) - if err != nil { - log.Println("DropTable rpc failed: " + err.Error()) - } return *status, err } func (grpcClient *milvusGrpcClient) CreateIndex(indexParam pb.IndexParam) (pb.Status, error) { ctx := context.Background() status, err := grpcClient.serviceInstance.CreateIndex(ctx, &indexParam) - if err != nil { - log.Println("CreateIndex rpc failed: " + err.Error()) - } return *status, err } @@ -152,9 +147,6 @@ func (grpcClient *milvusGrpcClient) DescribeIndex(tableName pb.TableName) (pb.In ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() indexParam, err := grpcClient.serviceInstance.DescribeIndex(ctx, &tableName) - if err != nil { - log.Println("DescribeIndex rpc failed: " + err.Error()) - } return *indexParam, err } @@ -162,9 +154,6 @@ func (grpcClient *milvusGrpcClient) DropIndex(tableName pb.TableName) (pb.Status ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() status, err := grpcClient.serviceInstance.DropIndex(ctx, &tableName) - if err != nil { - log.Println("DropIndex rpc failed: " + err.Error()) - } return *status, err } @@ -172,9 +161,6 @@ func (grpcClient *milvusGrpcClient) CreatePartition(partitionParam pb.PartitionP ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() status, err := grpcClient.serviceInstance.CreatePartition(ctx, &partitionParam) - if err != nil { - log.Println("CreatePartition rpc failed: " + err.Error()) - } return *status, err } @@ -182,9 +168,6 @@ func (grpcClient *milvusGrpcClient) ShowPartitions(tableName pb.TableName) (pb.P ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() status, err := grpcClient.serviceInstance.ShowPartitions(ctx, &tableName) - if err != nil { - log.Println("ShowPartition rpc failed: " + err.Error()) - } return *status, err } @@ -192,36 +175,36 @@ func (grpcClient *milvusGrpcClient) DropPartition(partitionParam pb.PartitionPar ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() status, err := grpcClient.serviceInstance.DropPartition(ctx, &partitionParam) - if err != nil { - log.Println("DropPartition rpc failed: " + err.Error()) - } return *status, err } func (grpcClient *milvusGrpcClient) Insert(insertParam pb.InsertParam) (pb.VectorIds, error) { ctx := context.Background() vectorIds, err := grpcClient.serviceInstance.Insert(ctx, &insertParam) - if err != nil { - log.Println("Insert rpc failed: " + err.Error()) - } return *vectorIds, err } +func (grpcClient *milvusGrpcClient) GetVectorByID(identity pb.VectorIdentity) (pb.VectorData, error) { + ctx := context.Background() + status, err := grpcClient.serviceInstance.GetVectorByID(ctx, &identity) + return *status, err +} + +func (grpcClient *milvusGrpcClient) GetVectorIDs(param pb.GetVectorIDsParam) (pb.VectorIds, error) { + ctx := context.Background() + status, err := grpcClient.serviceInstance.GetVectorIDs(ctx, ¶m) + return *status, err +} + func (grpcClient *milvusGrpcClient) Search(searchParam pb.SearchParam) (*pb.TopKQueryResult, error) { ctx := context.Background() topkQueryResult, err := grpcClient.serviceInstance.Search(ctx, &searchParam) - if err != nil { - log.Println("Search rpc failed: " + err.Error()) - } return topkQueryResult, err } func (grpcClient *milvusGrpcClient) SearchInFiles(searchInFilesParam pb.SearchInFilesParam) (*pb.TopKQueryResult, error) { ctx := context.Background() topkQueryResult, err := grpcClient.serviceInstance.SearchInFiles(ctx, &searchInFilesParam) - if err != nil { - log.Println("SearchInFiles rpc failed: " + err.Error()) - } return topkQueryResult, err } @@ -229,19 +212,13 @@ func (grpcClient *milvusGrpcClient) Cmd(command pb.Command) (pb.StringReply, err ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() stringReply, err := grpcClient.serviceInstance.Cmd(ctx, &command) - if err != nil { - log.Println("Cmd rpc failed: " + err.Error()) - } return *stringReply, err } -func (grpcClient *milvusGrpcClient) DeleteByDate(deleteByDateParam pb.DeleteByDateParam) (pb.Status, error) { +func (grpcClient *milvusGrpcClient) DeleteByID(param pb.DeleteByIDParam) (pb.Status, error) { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - status, err := grpcClient.serviceInstance.DeleteByDate(ctx, &deleteByDateParam) - if err != nil { - log.Println("DeleteByDate rpc failed: " + err.Error()) - } + status, err := grpcClient.serviceInstance.DeleteByID(ctx, ¶m) return *status, err } @@ -249,8 +226,19 @@ func (grpcClient *milvusGrpcClient) PreloadTable(tableName pb.TableName) (pb.Sta ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() status, err := grpcClient.serviceInstance.PreloadTable(ctx, &tableName) - if err != nil { - log.Println("PreloadTable rpc failed: " + err.Error()) - } + return *status, err +} + +func (grpcClient *milvusGrpcClient) Flush(param pb.FlushParam) (pb.Status, error) { + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() + status, err := grpcClient.serviceInstance.Flush(ctx, ¶m) + return *status, err +} + +func (grpcClient *milvusGrpcClient) Compact(tableName pb.TableName) (pb.Status, error) { + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() + status, err := grpcClient.serviceInstance.Compact(ctx, &tableName) return *status, err } diff --git a/milvus/grpc/gen/milvus.pb.go b/milvus/grpc/gen/milvus.pb.go index 58a5b4bb..a2c35341 100644 --- a/milvus/grpc/gen/milvus.pb.go +++ b/milvus/grpc/gen/milvus.pb.go @@ -25,83 +25,91 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package //* -// @brief Table name -type TableName struct { - TableName string `protobuf:"bytes,1,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` +// @brief general usage +type KeyValuePair struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *TableName) Reset() { *m = TableName{} } -func (m *TableName) String() string { return proto.CompactTextString(m) } -func (*TableName) ProtoMessage() {} -func (*TableName) Descriptor() ([]byte, []int) { +func (m *KeyValuePair) Reset() { *m = KeyValuePair{} } +func (m *KeyValuePair) String() string { return proto.CompactTextString(m) } +func (*KeyValuePair) ProtoMessage() {} +func (*KeyValuePair) Descriptor() ([]byte, []int) { return fileDescriptor_02345ba45cc0e303, []int{0} } -func (m *TableName) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TableName.Unmarshal(m, b) +func (m *KeyValuePair) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_KeyValuePair.Unmarshal(m, b) } -func (m *TableName) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TableName.Marshal(b, m, deterministic) +func (m *KeyValuePair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_KeyValuePair.Marshal(b, m, deterministic) } -func (m *TableName) XXX_Merge(src proto.Message) { - xxx_messageInfo_TableName.Merge(m, src) +func (m *KeyValuePair) XXX_Merge(src proto.Message) { + xxx_messageInfo_KeyValuePair.Merge(m, src) } -func (m *TableName) XXX_Size() int { - return xxx_messageInfo_TableName.Size(m) +func (m *KeyValuePair) XXX_Size() int { + return xxx_messageInfo_KeyValuePair.Size(m) } -func (m *TableName) XXX_DiscardUnknown() { - xxx_messageInfo_TableName.DiscardUnknown(m) +func (m *KeyValuePair) XXX_DiscardUnknown() { + xxx_messageInfo_KeyValuePair.DiscardUnknown(m) } -var xxx_messageInfo_TableName proto.InternalMessageInfo +var xxx_messageInfo_KeyValuePair proto.InternalMessageInfo -func (m *TableName) GetTableName() string { +func (m *KeyValuePair) GetKey() string { if m != nil { - return m.TableName + return m.Key + } + return "" +} + +func (m *KeyValuePair) GetValue() string { + if m != nil { + return m.Value } return "" } //* -// @brief Partition name -type PartitionName struct { - PartitionName string `protobuf:"bytes,1,opt,name=partition_name,json=partitionName,proto3" json:"partition_name,omitempty"` +// @brief Table name +type TableName struct { + TableName string `protobuf:"bytes,1,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *PartitionName) Reset() { *m = PartitionName{} } -func (m *PartitionName) String() string { return proto.CompactTextString(m) } -func (*PartitionName) ProtoMessage() {} -func (*PartitionName) Descriptor() ([]byte, []int) { +func (m *TableName) Reset() { *m = TableName{} } +func (m *TableName) String() string { return proto.CompactTextString(m) } +func (*TableName) ProtoMessage() {} +func (*TableName) Descriptor() ([]byte, []int) { return fileDescriptor_02345ba45cc0e303, []int{1} } -func (m *PartitionName) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PartitionName.Unmarshal(m, b) +func (m *TableName) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TableName.Unmarshal(m, b) } -func (m *PartitionName) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PartitionName.Marshal(b, m, deterministic) +func (m *TableName) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TableName.Marshal(b, m, deterministic) } -func (m *PartitionName) XXX_Merge(src proto.Message) { - xxx_messageInfo_PartitionName.Merge(m, src) +func (m *TableName) XXX_Merge(src proto.Message) { + xxx_messageInfo_TableName.Merge(m, src) } -func (m *PartitionName) XXX_Size() int { - return xxx_messageInfo_PartitionName.Size(m) +func (m *TableName) XXX_Size() int { + return xxx_messageInfo_TableName.Size(m) } -func (m *PartitionName) XXX_DiscardUnknown() { - xxx_messageInfo_PartitionName.DiscardUnknown(m) +func (m *TableName) XXX_DiscardUnknown() { + xxx_messageInfo_TableName.DiscardUnknown(m) } -var xxx_messageInfo_PartitionName proto.InternalMessageInfo +var xxx_messageInfo_TableName proto.InternalMessageInfo -func (m *PartitionName) GetPartitionName() string { +func (m *TableName) GetTableName() string { if m != nil { - return m.PartitionName + return m.TableName } return "" } @@ -157,15 +165,17 @@ func (m *TableNameList) GetTableNames() []string { //* // @brief Table schema +// metric_type: 1-L2, 2-IP type TableSchema struct { - Status *Status `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` - TableName string `protobuf:"bytes,2,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` - Dimension int64 `protobuf:"varint,3,opt,name=dimension,proto3" json:"dimension,omitempty"` - IndexFileSize int64 `protobuf:"varint,4,opt,name=index_file_size,json=indexFileSize,proto3" json:"index_file_size,omitempty"` - MetricType int32 `protobuf:"varint,5,opt,name=metric_type,json=metricType,proto3" json:"metric_type,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Status *Status `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` + TableName string `protobuf:"bytes,2,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` + Dimension int64 `protobuf:"varint,3,opt,name=dimension,proto3" json:"dimension,omitempty"` + IndexFileSize int64 `protobuf:"varint,4,opt,name=index_file_size,json=indexFileSize,proto3" json:"index_file_size,omitempty"` + MetricType int32 `protobuf:"varint,5,opt,name=metric_type,json=metricType,proto3" json:"metric_type,omitempty"` + ExtraParams []*KeyValuePair `protobuf:"bytes,6,rep,name=extra_params,json=extraParams,proto3" json:"extra_params,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *TableSchema) Reset() { *m = TableSchema{} } @@ -228,12 +238,18 @@ func (m *TableSchema) GetMetricType() int32 { return 0 } +func (m *TableSchema) GetExtraParams() []*KeyValuePair { + if m != nil { + return m.ExtraParams + } + return nil +} + //* // @brief Params of partition type PartitionParam struct { TableName string `protobuf:"bytes,1,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` - PartitionName string `protobuf:"bytes,2,opt,name=partition_name,json=partitionName,proto3" json:"partition_name,omitempty"` - Tag string `protobuf:"bytes,3,opt,name=tag,proto3" json:"tag,omitempty"` + Tag string `protobuf:"bytes,2,opt,name=tag,proto3" json:"tag,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -271,13 +287,6 @@ func (m *PartitionParam) GetTableName() string { return "" } -func (m *PartitionParam) GetPartitionName() string { - if m != nil { - return m.PartitionName - } - return "" -} - func (m *PartitionParam) GetTag() string { if m != nil { return m.Tag @@ -288,11 +297,11 @@ func (m *PartitionParam) GetTag() string { //* // @brief Partition list type PartitionList struct { - Status *Status `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` - PartitionArray []*PartitionParam `protobuf:"bytes,2,rep,name=partition_array,json=partitionArray,proto3" json:"partition_array,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Status *Status `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` + PartitionTagArray []string `protobuf:"bytes,2,rep,name=partition_tag_array,json=partitionTagArray,proto3" json:"partition_tag_array,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PartitionList) Reset() { *m = PartitionList{} } @@ -327,66 +336,18 @@ func (m *PartitionList) GetStatus() *Status { return nil } -func (m *PartitionList) GetPartitionArray() []*PartitionParam { +func (m *PartitionList) GetPartitionTagArray() []string { if m != nil { - return m.PartitionArray + return m.PartitionTagArray } return nil } -//* -// @brief Range schema -type Range struct { - StartValue string `protobuf:"bytes,1,opt,name=start_value,json=startValue,proto3" json:"start_value,omitempty"` - EndValue string `protobuf:"bytes,2,opt,name=end_value,json=endValue,proto3" json:"end_value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Range) Reset() { *m = Range{} } -func (m *Range) String() string { return proto.CompactTextString(m) } -func (*Range) ProtoMessage() {} -func (*Range) Descriptor() ([]byte, []int) { - return fileDescriptor_02345ba45cc0e303, []int{6} -} - -func (m *Range) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Range.Unmarshal(m, b) -} -func (m *Range) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Range.Marshal(b, m, deterministic) -} -func (m *Range) XXX_Merge(src proto.Message) { - xxx_messageInfo_Range.Merge(m, src) -} -func (m *Range) XXX_Size() int { - return xxx_messageInfo_Range.Size(m) -} -func (m *Range) XXX_DiscardUnknown() { - xxx_messageInfo_Range.DiscardUnknown(m) -} - -var xxx_messageInfo_Range proto.InternalMessageInfo - -func (m *Range) GetStartValue() string { - if m != nil { - return m.StartValue - } - return "" -} - -func (m *Range) GetEndValue() string { - if m != nil { - return m.EndValue - } - return "" -} - //* // @brief Record inserted type RowRecord struct { - VectorData []float32 `protobuf:"fixed32,1,rep,packed,name=vector_data,json=vectorData,proto3" json:"vector_data,omitempty"` + FloatData []float32 `protobuf:"fixed32,1,rep,packed,name=float_data,json=floatData,proto3" json:"float_data,omitempty"` + BinaryData []byte `protobuf:"bytes,2,opt,name=binary_data,json=binaryData,proto3" json:"binary_data,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -396,7 +357,7 @@ func (m *RowRecord) Reset() { *m = RowRecord{} } func (m *RowRecord) String() string { return proto.CompactTextString(m) } func (*RowRecord) ProtoMessage() {} func (*RowRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_02345ba45cc0e303, []int{7} + return fileDescriptor_02345ba45cc0e303, []int{6} } func (m *RowRecord) XXX_Unmarshal(b []byte) error { @@ -417,9 +378,16 @@ func (m *RowRecord) XXX_DiscardUnknown() { var xxx_messageInfo_RowRecord proto.InternalMessageInfo -func (m *RowRecord) GetVectorData() []float32 { +func (m *RowRecord) GetFloatData() []float32 { if m != nil { - return m.VectorData + return m.FloatData + } + return nil +} + +func (m *RowRecord) GetBinaryData() []byte { + if m != nil { + return m.BinaryData } return nil } @@ -427,20 +395,21 @@ func (m *RowRecord) GetVectorData() []float32 { //* // @brief Params to be inserted type InsertParam struct { - TableName string `protobuf:"bytes,1,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` - RowRecordArray []*RowRecord `protobuf:"bytes,2,rep,name=row_record_array,json=rowRecordArray,proto3" json:"row_record_array,omitempty"` - RowIdArray []int64 `protobuf:"varint,3,rep,packed,name=row_id_array,json=rowIdArray,proto3" json:"row_id_array,omitempty"` - PartitionTag string `protobuf:"bytes,4,opt,name=partition_tag,json=partitionTag,proto3" json:"partition_tag,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + TableName string `protobuf:"bytes,1,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` + RowRecordArray []*RowRecord `protobuf:"bytes,2,rep,name=row_record_array,json=rowRecordArray,proto3" json:"row_record_array,omitempty"` + RowIdArray []int64 `protobuf:"varint,3,rep,packed,name=row_id_array,json=rowIdArray,proto3" json:"row_id_array,omitempty"` + PartitionTag string `protobuf:"bytes,4,opt,name=partition_tag,json=partitionTag,proto3" json:"partition_tag,omitempty"` + ExtraParams []*KeyValuePair `protobuf:"bytes,5,rep,name=extra_params,json=extraParams,proto3" json:"extra_params,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *InsertParam) Reset() { *m = InsertParam{} } func (m *InsertParam) String() string { return proto.CompactTextString(m) } func (*InsertParam) ProtoMessage() {} func (*InsertParam) Descriptor() ([]byte, []int) { - return fileDescriptor_02345ba45cc0e303, []int{8} + return fileDescriptor_02345ba45cc0e303, []int{7} } func (m *InsertParam) XXX_Unmarshal(b []byte) error { @@ -489,6 +458,13 @@ func (m *InsertParam) GetPartitionTag() string { return "" } +func (m *InsertParam) GetExtraParams() []*KeyValuePair { + if m != nil { + return m.ExtraParams + } + return nil +} + //* // @brief Vector ids type VectorIds struct { @@ -503,7 +479,7 @@ func (m *VectorIds) Reset() { *m = VectorIds{} } func (m *VectorIds) String() string { return proto.CompactTextString(m) } func (*VectorIds) ProtoMessage() {} func (*VectorIds) Descriptor() ([]byte, []int) { - return fileDescriptor_02345ba45cc0e303, []int{9} + return fileDescriptor_02345ba45cc0e303, []int{8} } func (m *VectorIds) XXX_Unmarshal(b []byte) error { @@ -541,22 +517,21 @@ func (m *VectorIds) GetVectorIdArray() []int64 { //* // @brief Params for searching vector type SearchParam struct { - TableName string `protobuf:"bytes,1,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` - QueryRecordArray []*RowRecord `protobuf:"bytes,2,rep,name=query_record_array,json=queryRecordArray,proto3" json:"query_record_array,omitempty"` - QueryRangeArray []*Range `protobuf:"bytes,3,rep,name=query_range_array,json=queryRangeArray,proto3" json:"query_range_array,omitempty"` - Topk int64 `protobuf:"varint,4,opt,name=topk,proto3" json:"topk,omitempty"` - Nprobe int64 `protobuf:"varint,5,opt,name=nprobe,proto3" json:"nprobe,omitempty"` - PartitionTagArray []string `protobuf:"bytes,6,rep,name=partition_tag_array,json=partitionTagArray,proto3" json:"partition_tag_array,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + TableName string `protobuf:"bytes,1,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` + PartitionTagArray []string `protobuf:"bytes,2,rep,name=partition_tag_array,json=partitionTagArray,proto3" json:"partition_tag_array,omitempty"` + QueryRecordArray []*RowRecord `protobuf:"bytes,3,rep,name=query_record_array,json=queryRecordArray,proto3" json:"query_record_array,omitempty"` + Topk int64 `protobuf:"varint,4,opt,name=topk,proto3" json:"topk,omitempty"` + ExtraParams []*KeyValuePair `protobuf:"bytes,5,rep,name=extra_params,json=extraParams,proto3" json:"extra_params,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SearchParam) Reset() { *m = SearchParam{} } func (m *SearchParam) String() string { return proto.CompactTextString(m) } func (*SearchParam) ProtoMessage() {} func (*SearchParam) Descriptor() ([]byte, []int) { - return fileDescriptor_02345ba45cc0e303, []int{10} + return fileDescriptor_02345ba45cc0e303, []int{9} } func (m *SearchParam) XXX_Unmarshal(b []byte) error { @@ -584,16 +559,16 @@ func (m *SearchParam) GetTableName() string { return "" } -func (m *SearchParam) GetQueryRecordArray() []*RowRecord { +func (m *SearchParam) GetPartitionTagArray() []string { if m != nil { - return m.QueryRecordArray + return m.PartitionTagArray } return nil } -func (m *SearchParam) GetQueryRangeArray() []*Range { +func (m *SearchParam) GetQueryRecordArray() []*RowRecord { if m != nil { - return m.QueryRangeArray + return m.QueryRecordArray } return nil } @@ -605,16 +580,9 @@ func (m *SearchParam) GetTopk() int64 { return 0 } -func (m *SearchParam) GetNprobe() int64 { +func (m *SearchParam) GetExtraParams() []*KeyValuePair { if m != nil { - return m.Nprobe - } - return 0 -} - -func (m *SearchParam) GetPartitionTagArray() []string { - if m != nil { - return m.PartitionTagArray + return m.ExtraParams } return nil } @@ -633,7 +601,7 @@ func (m *SearchInFilesParam) Reset() { *m = SearchInFilesParam{} } func (m *SearchInFilesParam) String() string { return proto.CompactTextString(m) } func (*SearchInFilesParam) ProtoMessage() {} func (*SearchInFilesParam) Descriptor() ([]byte, []int) { - return fileDescriptor_02345ba45cc0e303, []int{11} + return fileDescriptor_02345ba45cc0e303, []int{10} } func (m *SearchInFilesParam) XXX_Unmarshal(b []byte) error { @@ -668,6 +636,79 @@ func (m *SearchInFilesParam) GetSearchParam() *SearchParam { return nil } +//* +// @brief Params for searching vector by ID +type SearchByIDParam struct { + TableName string `protobuf:"bytes,1,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` + PartitionTagArray []string `protobuf:"bytes,2,rep,name=partition_tag_array,json=partitionTagArray,proto3" json:"partition_tag_array,omitempty"` + Id int64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` + Topk int64 `protobuf:"varint,4,opt,name=topk,proto3" json:"topk,omitempty"` + ExtraParams []*KeyValuePair `protobuf:"bytes,5,rep,name=extra_params,json=extraParams,proto3" json:"extra_params,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SearchByIDParam) Reset() { *m = SearchByIDParam{} } +func (m *SearchByIDParam) String() string { return proto.CompactTextString(m) } +func (*SearchByIDParam) ProtoMessage() {} +func (*SearchByIDParam) Descriptor() ([]byte, []int) { + return fileDescriptor_02345ba45cc0e303, []int{11} +} + +func (m *SearchByIDParam) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SearchByIDParam.Unmarshal(m, b) +} +func (m *SearchByIDParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SearchByIDParam.Marshal(b, m, deterministic) +} +func (m *SearchByIDParam) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchByIDParam.Merge(m, src) +} +func (m *SearchByIDParam) XXX_Size() int { + return xxx_messageInfo_SearchByIDParam.Size(m) +} +func (m *SearchByIDParam) XXX_DiscardUnknown() { + xxx_messageInfo_SearchByIDParam.DiscardUnknown(m) +} + +var xxx_messageInfo_SearchByIDParam proto.InternalMessageInfo + +func (m *SearchByIDParam) GetTableName() string { + if m != nil { + return m.TableName + } + return "" +} + +func (m *SearchByIDParam) GetPartitionTagArray() []string { + if m != nil { + return m.PartitionTagArray + } + return nil +} + +func (m *SearchByIDParam) GetId() int64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *SearchByIDParam) GetTopk() int64 { + if m != nil { + return m.Topk + } + return 0 +} + +func (m *SearchByIDParam) GetExtraParams() []*KeyValuePair { + if m != nil { + return m.ExtraParams + } + return nil +} + //* // @brief Query result params type TopKQueryResult struct { @@ -896,286 +937,633 @@ func (*Command) Descriptor() ([]byte, []int) { return fileDescriptor_02345ba45cc0e303, []int{16} } -func (m *Command) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Command.Unmarshal(m, b) +func (m *Command) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Command.Unmarshal(m, b) +} +func (m *Command) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Command.Marshal(b, m, deterministic) +} +func (m *Command) XXX_Merge(src proto.Message) { + xxx_messageInfo_Command.Merge(m, src) +} +func (m *Command) XXX_Size() int { + return xxx_messageInfo_Command.Size(m) +} +func (m *Command) XXX_DiscardUnknown() { + xxx_messageInfo_Command.DiscardUnknown(m) +} + +var xxx_messageInfo_Command proto.InternalMessageInfo + +func (m *Command) GetCmd() string { + if m != nil { + return m.Cmd + } + return "" +} + +//* +// @brief Index params +// @index_type: 0-invalid, 1-idmap, 2-ivflat, 3-ivfsq8, 4-nsgmix +type IndexParam struct { + Status *Status `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` + TableName string `protobuf:"bytes,2,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` + IndexType int32 `protobuf:"varint,3,opt,name=index_type,json=indexType,proto3" json:"index_type,omitempty"` + ExtraParams []*KeyValuePair `protobuf:"bytes,4,rep,name=extra_params,json=extraParams,proto3" json:"extra_params,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IndexParam) Reset() { *m = IndexParam{} } +func (m *IndexParam) String() string { return proto.CompactTextString(m) } +func (*IndexParam) ProtoMessage() {} +func (*IndexParam) Descriptor() ([]byte, []int) { + return fileDescriptor_02345ba45cc0e303, []int{17} +} + +func (m *IndexParam) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_IndexParam.Unmarshal(m, b) +} +func (m *IndexParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_IndexParam.Marshal(b, m, deterministic) +} +func (m *IndexParam) XXX_Merge(src proto.Message) { + xxx_messageInfo_IndexParam.Merge(m, src) +} +func (m *IndexParam) XXX_Size() int { + return xxx_messageInfo_IndexParam.Size(m) +} +func (m *IndexParam) XXX_DiscardUnknown() { + xxx_messageInfo_IndexParam.DiscardUnknown(m) +} + +var xxx_messageInfo_IndexParam proto.InternalMessageInfo + +func (m *IndexParam) GetStatus() *Status { + if m != nil { + return m.Status + } + return nil +} + +func (m *IndexParam) GetTableName() string { + if m != nil { + return m.TableName + } + return "" +} + +func (m *IndexParam) GetIndexType() int32 { + if m != nil { + return m.IndexType + } + return 0 +} + +func (m *IndexParam) GetExtraParams() []*KeyValuePair { + if m != nil { + return m.ExtraParams + } + return nil +} + +//* +// @brief Flush params +type FlushParam struct { + TableNameArray []string `protobuf:"bytes,1,rep,name=table_name_array,json=tableNameArray,proto3" json:"table_name_array,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FlushParam) Reset() { *m = FlushParam{} } +func (m *FlushParam) String() string { return proto.CompactTextString(m) } +func (*FlushParam) ProtoMessage() {} +func (*FlushParam) Descriptor() ([]byte, []int) { + return fileDescriptor_02345ba45cc0e303, []int{18} +} + +func (m *FlushParam) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FlushParam.Unmarshal(m, b) +} +func (m *FlushParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FlushParam.Marshal(b, m, deterministic) +} +func (m *FlushParam) XXX_Merge(src proto.Message) { + xxx_messageInfo_FlushParam.Merge(m, src) +} +func (m *FlushParam) XXX_Size() int { + return xxx_messageInfo_FlushParam.Size(m) +} +func (m *FlushParam) XXX_DiscardUnknown() { + xxx_messageInfo_FlushParam.DiscardUnknown(m) +} + +var xxx_messageInfo_FlushParam proto.InternalMessageInfo + +func (m *FlushParam) GetTableNameArray() []string { + if m != nil { + return m.TableNameArray + } + return nil +} + +//* +// @brief Flush params +type DeleteByIDParam struct { + TableName string `protobuf:"bytes,1,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` + IdArray []int64 `protobuf:"varint,2,rep,packed,name=id_array,json=idArray,proto3" json:"id_array,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteByIDParam) Reset() { *m = DeleteByIDParam{} } +func (m *DeleteByIDParam) String() string { return proto.CompactTextString(m) } +func (*DeleteByIDParam) ProtoMessage() {} +func (*DeleteByIDParam) Descriptor() ([]byte, []int) { + return fileDescriptor_02345ba45cc0e303, []int{19} +} + +func (m *DeleteByIDParam) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeleteByIDParam.Unmarshal(m, b) +} +func (m *DeleteByIDParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeleteByIDParam.Marshal(b, m, deterministic) +} +func (m *DeleteByIDParam) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteByIDParam.Merge(m, src) +} +func (m *DeleteByIDParam) XXX_Size() int { + return xxx_messageInfo_DeleteByIDParam.Size(m) +} +func (m *DeleteByIDParam) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteByIDParam.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteByIDParam proto.InternalMessageInfo + +func (m *DeleteByIDParam) GetTableName() string { + if m != nil { + return m.TableName + } + return "" +} + +func (m *DeleteByIDParam) GetIdArray() []int64 { + if m != nil { + return m.IdArray + } + return nil +} + +//* +// @brief segment statistics +type SegmentStat struct { + SegmentName string `protobuf:"bytes,1,opt,name=segment_name,json=segmentName,proto3" json:"segment_name,omitempty"` + RowCount int64 `protobuf:"varint,2,opt,name=row_count,json=rowCount,proto3" json:"row_count,omitempty"` + IndexName string `protobuf:"bytes,3,opt,name=index_name,json=indexName,proto3" json:"index_name,omitempty"` + DataSize int64 `protobuf:"varint,4,opt,name=data_size,json=dataSize,proto3" json:"data_size,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SegmentStat) Reset() { *m = SegmentStat{} } +func (m *SegmentStat) String() string { return proto.CompactTextString(m) } +func (*SegmentStat) ProtoMessage() {} +func (*SegmentStat) Descriptor() ([]byte, []int) { + return fileDescriptor_02345ba45cc0e303, []int{20} +} + +func (m *SegmentStat) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SegmentStat.Unmarshal(m, b) +} +func (m *SegmentStat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SegmentStat.Marshal(b, m, deterministic) +} +func (m *SegmentStat) XXX_Merge(src proto.Message) { + xxx_messageInfo_SegmentStat.Merge(m, src) +} +func (m *SegmentStat) XXX_Size() int { + return xxx_messageInfo_SegmentStat.Size(m) +} +func (m *SegmentStat) XXX_DiscardUnknown() { + xxx_messageInfo_SegmentStat.DiscardUnknown(m) +} + +var xxx_messageInfo_SegmentStat proto.InternalMessageInfo + +func (m *SegmentStat) GetSegmentName() string { + if m != nil { + return m.SegmentName + } + return "" +} + +func (m *SegmentStat) GetRowCount() int64 { + if m != nil { + return m.RowCount + } + return 0 +} + +func (m *SegmentStat) GetIndexName() string { + if m != nil { + return m.IndexName + } + return "" +} + +func (m *SegmentStat) GetDataSize() int64 { + if m != nil { + return m.DataSize + } + return 0 +} + +//* +// @brief table statistics +type PartitionStat struct { + Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"` + TotalRowCount int64 `protobuf:"varint,2,opt,name=total_row_count,json=totalRowCount,proto3" json:"total_row_count,omitempty"` + SegmentsStat []*SegmentStat `protobuf:"bytes,3,rep,name=segments_stat,json=segmentsStat,proto3" json:"segments_stat,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PartitionStat) Reset() { *m = PartitionStat{} } +func (m *PartitionStat) String() string { return proto.CompactTextString(m) } +func (*PartitionStat) ProtoMessage() {} +func (*PartitionStat) Descriptor() ([]byte, []int) { + return fileDescriptor_02345ba45cc0e303, []int{21} +} + +func (m *PartitionStat) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PartitionStat.Unmarshal(m, b) +} +func (m *PartitionStat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PartitionStat.Marshal(b, m, deterministic) +} +func (m *PartitionStat) XXX_Merge(src proto.Message) { + xxx_messageInfo_PartitionStat.Merge(m, src) +} +func (m *PartitionStat) XXX_Size() int { + return xxx_messageInfo_PartitionStat.Size(m) +} +func (m *PartitionStat) XXX_DiscardUnknown() { + xxx_messageInfo_PartitionStat.DiscardUnknown(m) +} + +var xxx_messageInfo_PartitionStat proto.InternalMessageInfo + +func (m *PartitionStat) GetTag() string { + if m != nil { + return m.Tag + } + return "" +} + +func (m *PartitionStat) GetTotalRowCount() int64 { + if m != nil { + return m.TotalRowCount + } + return 0 +} + +func (m *PartitionStat) GetSegmentsStat() []*SegmentStat { + if m != nil { + return m.SegmentsStat + } + return nil +} + +//* +// @brief table information +type TableInfo struct { + Status *Status `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` + TotalRowCount int64 `protobuf:"varint,2,opt,name=total_row_count,json=totalRowCount,proto3" json:"total_row_count,omitempty"` + PartitionsStat []*PartitionStat `protobuf:"bytes,3,rep,name=partitions_stat,json=partitionsStat,proto3" json:"partitions_stat,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TableInfo) Reset() { *m = TableInfo{} } +func (m *TableInfo) String() string { return proto.CompactTextString(m) } +func (*TableInfo) ProtoMessage() {} +func (*TableInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_02345ba45cc0e303, []int{22} +} + +func (m *TableInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TableInfo.Unmarshal(m, b) } -func (m *Command) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Command.Marshal(b, m, deterministic) +func (m *TableInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TableInfo.Marshal(b, m, deterministic) } -func (m *Command) XXX_Merge(src proto.Message) { - xxx_messageInfo_Command.Merge(m, src) +func (m *TableInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_TableInfo.Merge(m, src) } -func (m *Command) XXX_Size() int { - return xxx_messageInfo_Command.Size(m) +func (m *TableInfo) XXX_Size() int { + return xxx_messageInfo_TableInfo.Size(m) } -func (m *Command) XXX_DiscardUnknown() { - xxx_messageInfo_Command.DiscardUnknown(m) +func (m *TableInfo) XXX_DiscardUnknown() { + xxx_messageInfo_TableInfo.DiscardUnknown(m) } -var xxx_messageInfo_Command proto.InternalMessageInfo +var xxx_messageInfo_TableInfo proto.InternalMessageInfo -func (m *Command) GetCmd() string { +func (m *TableInfo) GetStatus() *Status { if m != nil { - return m.Cmd + return m.Status } - return "" + return nil +} + +func (m *TableInfo) GetTotalRowCount() int64 { + if m != nil { + return m.TotalRowCount + } + return 0 +} + +func (m *TableInfo) GetPartitionsStat() []*PartitionStat { + if m != nil { + return m.PartitionsStat + } + return nil } //* -// @brief Index -// @index_type: 0-invalid, 1-idmap, 2-ivflat, 3-ivfsq8, 4-nsgmix -// @metric_type: 1-L2, 2-IP -type Index struct { - IndexType int32 `protobuf:"varint,1,opt,name=index_type,json=indexType,proto3" json:"index_type,omitempty"` - Nlist int32 `protobuf:"varint,2,opt,name=nlist,proto3" json:"nlist,omitempty"` +// @brief vector identity +type VectorIdentity struct { + TableName string `protobuf:"bytes,1,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` + Id int64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *Index) Reset() { *m = Index{} } -func (m *Index) String() string { return proto.CompactTextString(m) } -func (*Index) ProtoMessage() {} -func (*Index) Descriptor() ([]byte, []int) { - return fileDescriptor_02345ba45cc0e303, []int{17} +func (m *VectorIdentity) Reset() { *m = VectorIdentity{} } +func (m *VectorIdentity) String() string { return proto.CompactTextString(m) } +func (*VectorIdentity) ProtoMessage() {} +func (*VectorIdentity) Descriptor() ([]byte, []int) { + return fileDescriptor_02345ba45cc0e303, []int{23} } -func (m *Index) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Index.Unmarshal(m, b) +func (m *VectorIdentity) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_VectorIdentity.Unmarshal(m, b) } -func (m *Index) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Index.Marshal(b, m, deterministic) +func (m *VectorIdentity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_VectorIdentity.Marshal(b, m, deterministic) } -func (m *Index) XXX_Merge(src proto.Message) { - xxx_messageInfo_Index.Merge(m, src) +func (m *VectorIdentity) XXX_Merge(src proto.Message) { + xxx_messageInfo_VectorIdentity.Merge(m, src) } -func (m *Index) XXX_Size() int { - return xxx_messageInfo_Index.Size(m) +func (m *VectorIdentity) XXX_Size() int { + return xxx_messageInfo_VectorIdentity.Size(m) } -func (m *Index) XXX_DiscardUnknown() { - xxx_messageInfo_Index.DiscardUnknown(m) +func (m *VectorIdentity) XXX_DiscardUnknown() { + xxx_messageInfo_VectorIdentity.DiscardUnknown(m) } -var xxx_messageInfo_Index proto.InternalMessageInfo +var xxx_messageInfo_VectorIdentity proto.InternalMessageInfo -func (m *Index) GetIndexType() int32 { +func (m *VectorIdentity) GetTableName() string { if m != nil { - return m.IndexType + return m.TableName } - return 0 + return "" } -func (m *Index) GetNlist() int32 { +func (m *VectorIdentity) GetId() int64 { if m != nil { - return m.Nlist + return m.Id } return 0 } //* -// @brief Index params -type IndexParam struct { - Status *Status `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` - TableName string `protobuf:"bytes,2,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` - Index *Index `protobuf:"bytes,3,opt,name=index,proto3" json:"index,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// @brief vector data +type VectorData struct { + Status *Status `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` + VectorData *RowRecord `protobuf:"bytes,2,opt,name=vector_data,json=vectorData,proto3" json:"vector_data,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *IndexParam) Reset() { *m = IndexParam{} } -func (m *IndexParam) String() string { return proto.CompactTextString(m) } -func (*IndexParam) ProtoMessage() {} -func (*IndexParam) Descriptor() ([]byte, []int) { - return fileDescriptor_02345ba45cc0e303, []int{18} +func (m *VectorData) Reset() { *m = VectorData{} } +func (m *VectorData) String() string { return proto.CompactTextString(m) } +func (*VectorData) ProtoMessage() {} +func (*VectorData) Descriptor() ([]byte, []int) { + return fileDescriptor_02345ba45cc0e303, []int{24} } -func (m *IndexParam) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_IndexParam.Unmarshal(m, b) +func (m *VectorData) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_VectorData.Unmarshal(m, b) } -func (m *IndexParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_IndexParam.Marshal(b, m, deterministic) +func (m *VectorData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_VectorData.Marshal(b, m, deterministic) } -func (m *IndexParam) XXX_Merge(src proto.Message) { - xxx_messageInfo_IndexParam.Merge(m, src) +func (m *VectorData) XXX_Merge(src proto.Message) { + xxx_messageInfo_VectorData.Merge(m, src) } -func (m *IndexParam) XXX_Size() int { - return xxx_messageInfo_IndexParam.Size(m) +func (m *VectorData) XXX_Size() int { + return xxx_messageInfo_VectorData.Size(m) } -func (m *IndexParam) XXX_DiscardUnknown() { - xxx_messageInfo_IndexParam.DiscardUnknown(m) +func (m *VectorData) XXX_DiscardUnknown() { + xxx_messageInfo_VectorData.DiscardUnknown(m) } -var xxx_messageInfo_IndexParam proto.InternalMessageInfo +var xxx_messageInfo_VectorData proto.InternalMessageInfo -func (m *IndexParam) GetStatus() *Status { +func (m *VectorData) GetStatus() *Status { if m != nil { return m.Status } return nil } -func (m *IndexParam) GetTableName() string { - if m != nil { - return m.TableName - } - return "" -} - -func (m *IndexParam) GetIndex() *Index { +func (m *VectorData) GetVectorData() *RowRecord { if m != nil { - return m.Index + return m.VectorData } return nil } //* -// @brief table name and range for DeleteByDate -type DeleteByDateParam struct { - Range *Range `protobuf:"bytes,1,opt,name=range,proto3" json:"range,omitempty"` - TableName string `protobuf:"bytes,2,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` +// @brief get vector ids from a segment parameters +type GetVectorIDsParam struct { + TableName string `protobuf:"bytes,1,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` + SegmentName string `protobuf:"bytes,2,opt,name=segment_name,json=segmentName,proto3" json:"segment_name,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *DeleteByDateParam) Reset() { *m = DeleteByDateParam{} } -func (m *DeleteByDateParam) String() string { return proto.CompactTextString(m) } -func (*DeleteByDateParam) ProtoMessage() {} -func (*DeleteByDateParam) Descriptor() ([]byte, []int) { - return fileDescriptor_02345ba45cc0e303, []int{19} +func (m *GetVectorIDsParam) Reset() { *m = GetVectorIDsParam{} } +func (m *GetVectorIDsParam) String() string { return proto.CompactTextString(m) } +func (*GetVectorIDsParam) ProtoMessage() {} +func (*GetVectorIDsParam) Descriptor() ([]byte, []int) { + return fileDescriptor_02345ba45cc0e303, []int{25} } -func (m *DeleteByDateParam) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeleteByDateParam.Unmarshal(m, b) +func (m *GetVectorIDsParam) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetVectorIDsParam.Unmarshal(m, b) } -func (m *DeleteByDateParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeleteByDateParam.Marshal(b, m, deterministic) +func (m *GetVectorIDsParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetVectorIDsParam.Marshal(b, m, deterministic) } -func (m *DeleteByDateParam) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteByDateParam.Merge(m, src) +func (m *GetVectorIDsParam) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetVectorIDsParam.Merge(m, src) } -func (m *DeleteByDateParam) XXX_Size() int { - return xxx_messageInfo_DeleteByDateParam.Size(m) +func (m *GetVectorIDsParam) XXX_Size() int { + return xxx_messageInfo_GetVectorIDsParam.Size(m) } -func (m *DeleteByDateParam) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteByDateParam.DiscardUnknown(m) +func (m *GetVectorIDsParam) XXX_DiscardUnknown() { + xxx_messageInfo_GetVectorIDsParam.DiscardUnknown(m) } -var xxx_messageInfo_DeleteByDateParam proto.InternalMessageInfo +var xxx_messageInfo_GetVectorIDsParam proto.InternalMessageInfo -func (m *DeleteByDateParam) GetRange() *Range { +func (m *GetVectorIDsParam) GetTableName() string { if m != nil { - return m.Range + return m.TableName } - return nil + return "" } -func (m *DeleteByDateParam) GetTableName() string { +func (m *GetVectorIDsParam) GetSegmentName() string { if m != nil { - return m.TableName + return m.SegmentName } return "" } func init() { + proto.RegisterType((*KeyValuePair)(nil), "milvus.grpc.KeyValuePair") proto.RegisterType((*TableName)(nil), "milvus.grpc.TableName") - proto.RegisterType((*PartitionName)(nil), "milvus.grpc.PartitionName") proto.RegisterType((*TableNameList)(nil), "milvus.grpc.TableNameList") proto.RegisterType((*TableSchema)(nil), "milvus.grpc.TableSchema") proto.RegisterType((*PartitionParam)(nil), "milvus.grpc.PartitionParam") proto.RegisterType((*PartitionList)(nil), "milvus.grpc.PartitionList") - proto.RegisterType((*Range)(nil), "milvus.grpc.Range") proto.RegisterType((*RowRecord)(nil), "milvus.grpc.RowRecord") proto.RegisterType((*InsertParam)(nil), "milvus.grpc.InsertParam") proto.RegisterType((*VectorIds)(nil), "milvus.grpc.VectorIds") proto.RegisterType((*SearchParam)(nil), "milvus.grpc.SearchParam") proto.RegisterType((*SearchInFilesParam)(nil), "milvus.grpc.SearchInFilesParam") + proto.RegisterType((*SearchByIDParam)(nil), "milvus.grpc.SearchByIDParam") proto.RegisterType((*TopKQueryResult)(nil), "milvus.grpc.TopKQueryResult") proto.RegisterType((*StringReply)(nil), "milvus.grpc.StringReply") proto.RegisterType((*BoolReply)(nil), "milvus.grpc.BoolReply") proto.RegisterType((*TableRowCount)(nil), "milvus.grpc.TableRowCount") proto.RegisterType((*Command)(nil), "milvus.grpc.Command") - proto.RegisterType((*Index)(nil), "milvus.grpc.Index") proto.RegisterType((*IndexParam)(nil), "milvus.grpc.IndexParam") - proto.RegisterType((*DeleteByDateParam)(nil), "milvus.grpc.DeleteByDateParam") + proto.RegisterType((*FlushParam)(nil), "milvus.grpc.FlushParam") + proto.RegisterType((*DeleteByIDParam)(nil), "milvus.grpc.DeleteByIDParam") + proto.RegisterType((*SegmentStat)(nil), "milvus.grpc.SegmentStat") + proto.RegisterType((*PartitionStat)(nil), "milvus.grpc.PartitionStat") + proto.RegisterType((*TableInfo)(nil), "milvus.grpc.TableInfo") + proto.RegisterType((*VectorIdentity)(nil), "milvus.grpc.VectorIdentity") + proto.RegisterType((*VectorData)(nil), "milvus.grpc.VectorData") + proto.RegisterType((*GetVectorIDsParam)(nil), "milvus.grpc.GetVectorIDsParam") } func init() { proto.RegisterFile("milvus.proto", fileDescriptor_02345ba45cc0e303) } var fileDescriptor_02345ba45cc0e303 = []byte{ - // 1123 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xdf, 0x6f, 0x1b, 0xc5, - 0x13, 0xb7, 0x73, 0xb1, 0x9b, 0x9b, 0xb3, 0xe3, 0x64, 0x5b, 0xa5, 0x56, 0xd2, 0x7e, 0xeb, 0xef, - 0x22, 0x2a, 0x0b, 0x50, 0x1e, 0x82, 0x04, 0x12, 0x84, 0xaa, 0x24, 0x6e, 0x45, 0x04, 0x54, 0x61, - 0x1d, 0x95, 0x17, 0x2a, 0xb3, 0xbe, 0x5b, 0x92, 0x13, 0x77, 0xb7, 0xc7, 0xee, 0x3a, 0xc6, 0x7d, - 0xe4, 0x85, 0x37, 0xfe, 0x1b, 0x5e, 0x78, 0xe2, 0x4f, 0x43, 0xbb, 0x7b, 0xbe, 0x1f, 0x89, 0x9d, - 0xc4, 0x85, 0xb7, 0xbd, 0xd9, 0x99, 0xcf, 0xce, 0x7c, 0x66, 0x66, 0x67, 0x0f, 0x5a, 0x71, 0x18, - 0x5d, 0x4e, 0xe4, 0x7e, 0x2a, 0xb8, 0xe2, 0xc8, 0xcb, 0xbe, 0xce, 0x45, 0xea,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, 0xd0, 0xb4, - 0x0f, 0x96, 0x2b, 0x2d, 0x51, 0x7a, 0xc5, 0x5c, 0xa9, 0xeb, 0xfc, 0xa1, 0x60, 0x32, 0xd2, 0xb4, - 0x93, 0x06, 0x2d, 0x1d, 0x3f, 0xbb, 0x8f, 0xaa, 0xc1, 0x55, 0x67, 0x0f, 0xae, 0xa1, 0x53, 0x68, - 0x57, 0x06, 0x21, 0x7a, 0xb2, 0x00, 0xaa, 0x3c, 0x24, 0x6f, 0x45, 0xfc, 0x14, 0x9c, 0xe3, 0x38, - 0x58, 0x52, 0xdd, 0x57, 0x1c, 0x2d, 0x4d, 0x0c, 0x9d, 0xe0, 0x56, 0xf9, 0x52, 0x42, 0xff, 0xab, - 0xe8, 0x5e, 0xbb, 0xaf, 0x96, 0x97, 0x79, 0xeb, 0x54, 0xb0, 0x88, 0xd3, 0xe0, 0x5d, 0xba, 0x64, - 0xdc, 0x34, 0x7f, 0x4d, 0x1f, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x8a, 0xcc, 0x69, 0x60, - 0x0d, 0x00, 0x00, + // 1382 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xdd, 0x72, 0x13, 0xc7, + 0x12, 0xd6, 0x6a, 0x6d, 0xe3, 0xed, 0xd5, 0x8f, 0x19, 0x28, 0x10, 0x06, 0x0e, 0x3a, 0x73, 0xaa, + 0x28, 0xd5, 0x49, 0x95, 0x2f, 0x9c, 0x2a, 0x48, 0x25, 0x90, 0x80, 0xad, 0x00, 0x0a, 0x09, 0xe5, + 0xac, 0x1c, 0x72, 0x45, 0x29, 0x63, 0xed, 0x60, 0xb6, 0xd8, 0xdd, 0x51, 0x66, 0x46, 0x36, 0xe2, + 0x05, 0x92, 0x3c, 0x48, 0x1e, 0x21, 0x2f, 0x90, 0xdb, 0x3c, 0x4e, 0x72, 0x9d, 0x4a, 0x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0x00, 0x3c, 0x0a, 0xc7, 0x22, 0x41, 0xab, + 0x0e, 0x6c, 0xe5, 0x96, 0x94, 0x7a, 0xb6, 0x91, 0xd9, 0x93, 0x0e, 0xa3, 0x66, 0x97, 0x86, 0x54, + 0xd2, 0xa5, 0x1b, 0xef, 0x1a, 0x6c, 0x4e, 0x41, 0xe7, 0x85, 0x20, 0x01, 0xcd, 0x5f, 0x34, 0x68, + 0x1e, 0x47, 0x34, 0x96, 0x2a, 0x34, 0xba, 0x96, 0xcc, 0xb1, 0xa8, 0xcb, 0x4d, 0x68, 0x5a, 0xdb, + 0x75, 0x70, 0xa6, 0xd3, 0xb5, 0xc9, 0xd3, 0xf4, 0x67, 0x11, 0xd3, 0xd2, 0xb6, 0xb1, 0x44, 0x53, + 0x52, 0x59, 0x35, 0x15, 0x8b, 0xab, 0xc7, 0xa6, 0x22, 0xa8, 0xad, 0x03, 0xff, 0x6c, 0x15, 0x86, + 0xba, 0xb6, 0x26, 0x99, 0xfb, 0x56, 0x36, 0xf7, 0x75, 0xc5, 0x30, 0x49, 0xc2, 0x19, 0x15, 0xa3, + 0xc8, 0x59, 0x19, 0xde, 0x87, 0x7a, 0x62, 0xb3, 0x18, 0xa8, 0x5c, 0x27, 0x40, 0x3d, 0x0d, 0x6e, + 0x99, 0xe3, 0x5e, 0xea, 0xb6, 0x50, 0x27, 0xfc, 0xab, 0x95, 0xac, 0x8b, 0xbd, 0xf8, 0x25, 0x5b, + 0xbd, 0xa6, 0x97, 0xb1, 0x70, 0x1f, 0x9a, 0x19, 0xe4, 0x95, 0x6c, 0xdc, 0x2e, 0x69, 0x2f, 0x05, + 0xc4, 0x6b, 0xe4, 0x22, 0xda, 0xce, 0x2f, 0xa0, 0x91, 0x4e, 0x55, 0x1a, 0xcb, 0x40, 0x4e, 0xce, + 0x2b, 0x05, 0x83, 0xa9, 0xd5, 0x14, 0x53, 0x31, 0x07, 0x30, 0x0a, 0xf4, 0xee, 0xb2, 0x92, 0xa3, + 0x77, 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17, 0xc7, 0x11, 0x19, 0xca, 0x15, + 0x9f, 0x3c, 0xda, 0xd0, 0x7f, 0x37, 0x7d, 0xfc, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x31, 0x08, + 0xcb, 0x0b, 0x99, 0x12, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1226,6 +1614,13 @@ type MilvusServiceClient interface { // @return TableNameList ShowTables(ctx context.Context, in *Command, opts ...grpc.CallOption) (*TableNameList, error) //* + // @brief This method is used to get table detail information. + // + // @param TableName, target table name. + // + // @return TableInfo + ShowTableInfo(ctx context.Context, in *TableName, opts ...grpc.CallOption) (*TableInfo, error) + //* // @brief This method is used to delete table. // // @param TableName, table name is going to be deleted. @@ -1282,6 +1677,20 @@ type MilvusServiceClient interface { // @return VectorIds Insert(ctx context.Context, in *InsertParam, opts ...grpc.CallOption) (*VectorIds, error) //* + // @brief This method is used to get vector data by id. + // + // @param VectorIdentity, target vector id. + // + // @return VectorData + GetVectorByID(ctx context.Context, in *VectorIdentity, opts ...grpc.CallOption) (*VectorData, error) + //* + // @brief This method is used to get vector ids from a segment + // + // @param GetVectorIDsParam, target table and segment + // + // @return VectorIds + GetVectorIDs(ctx context.Context, in *GetVectorIDsParam, opts ...grpc.CallOption) (*VectorIds, error) + //* // @brief This method is used to query vector in table. // // @param SearchParam, search parameters. @@ -1289,6 +1698,13 @@ type MilvusServiceClient interface { // @return TopKQueryResult Search(ctx context.Context, in *SearchParam, opts ...grpc.CallOption) (*TopKQueryResult, error) //* + // @brief This method is used to query vector by id. + // + // @param SearchByIDParam, search parameters. + // + // @return TopKQueryResult + SearchByID(ctx context.Context, in *SearchByIDParam, opts ...grpc.CallOption) (*TopKQueryResult, error) + //* // @brief This method is used to query vector in specified files. // // @param SearchInFilesParam, search in files paremeters. @@ -1303,12 +1719,12 @@ type MilvusServiceClient interface { // @return StringReply Cmd(ctx context.Context, in *Command, opts ...grpc.CallOption) (*StringReply, error) //* - // @brief This method is used to delete vector by date range + // @brief This method is used to delete vector by id // - // @param DeleteByDateParam, delete parameters. + // @param DeleteByIDParam, delete parameters. // // @return status - DeleteByDate(ctx context.Context, in *DeleteByDateParam, opts ...grpc.CallOption) (*Status, error) + DeleteByID(ctx context.Context, in *DeleteByIDParam, opts ...grpc.CallOption) (*Status, error) //* // @brief This method is used to preload table // @@ -1316,6 +1732,20 @@ type MilvusServiceClient interface { // // @return Status PreloadTable(ctx context.Context, in *TableName, opts ...grpc.CallOption) (*Status, error) + //* + // @brief This method is used to flush buffer into storage. + // + // @param FlushParam, flush parameters + // + // @return Status + Flush(ctx context.Context, in *FlushParam, opts ...grpc.CallOption) (*Status, error) + //* + // @brief This method is used to compact table + // + // @param TableName, target table name. + // + // @return Status + Compact(ctx context.Context, in *TableName, opts ...grpc.CallOption) (*Status, error) } type milvusServiceClient struct { @@ -1371,6 +1801,15 @@ func (c *milvusServiceClient) ShowTables(ctx context.Context, in *Command, opts return out, nil } +func (c *milvusServiceClient) ShowTableInfo(ctx context.Context, in *TableName, opts ...grpc.CallOption) (*TableInfo, error) { + out := new(TableInfo) + err := c.cc.Invoke(ctx, "/milvus.grpc.MilvusService/ShowTableInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *milvusServiceClient) DropTable(ctx context.Context, in *TableName, opts ...grpc.CallOption) (*Status, error) { out := new(Status) err := c.cc.Invoke(ctx, "/milvus.grpc.MilvusService/DropTable", in, out, opts...) @@ -1443,6 +1882,24 @@ func (c *milvusServiceClient) Insert(ctx context.Context, in *InsertParam, opts return out, nil } +func (c *milvusServiceClient) GetVectorByID(ctx context.Context, in *VectorIdentity, opts ...grpc.CallOption) (*VectorData, error) { + out := new(VectorData) + err := c.cc.Invoke(ctx, "/milvus.grpc.MilvusService/GetVectorByID", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *milvusServiceClient) GetVectorIDs(ctx context.Context, in *GetVectorIDsParam, opts ...grpc.CallOption) (*VectorIds, error) { + out := new(VectorIds) + err := c.cc.Invoke(ctx, "/milvus.grpc.MilvusService/GetVectorIDs", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *milvusServiceClient) Search(ctx context.Context, in *SearchParam, opts ...grpc.CallOption) (*TopKQueryResult, error) { out := new(TopKQueryResult) err := c.cc.Invoke(ctx, "/milvus.grpc.MilvusService/Search", in, out, opts...) @@ -1452,6 +1909,15 @@ func (c *milvusServiceClient) Search(ctx context.Context, in *SearchParam, opts return out, nil } +func (c *milvusServiceClient) SearchByID(ctx context.Context, in *SearchByIDParam, opts ...grpc.CallOption) (*TopKQueryResult, error) { + out := new(TopKQueryResult) + err := c.cc.Invoke(ctx, "/milvus.grpc.MilvusService/SearchByID", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *milvusServiceClient) SearchInFiles(ctx context.Context, in *SearchInFilesParam, opts ...grpc.CallOption) (*TopKQueryResult, error) { out := new(TopKQueryResult) err := c.cc.Invoke(ctx, "/milvus.grpc.MilvusService/SearchInFiles", in, out, opts...) @@ -1470,9 +1936,9 @@ func (c *milvusServiceClient) Cmd(ctx context.Context, in *Command, opts ...grpc return out, nil } -func (c *milvusServiceClient) DeleteByDate(ctx context.Context, in *DeleteByDateParam, opts ...grpc.CallOption) (*Status, error) { +func (c *milvusServiceClient) DeleteByID(ctx context.Context, in *DeleteByIDParam, opts ...grpc.CallOption) (*Status, error) { out := new(Status) - err := c.cc.Invoke(ctx, "/milvus.grpc.MilvusService/DeleteByDate", in, out, opts...) + err := c.cc.Invoke(ctx, "/milvus.grpc.MilvusService/DeleteByID", in, out, opts...) if err != nil { return nil, err } @@ -1488,6 +1954,24 @@ func (c *milvusServiceClient) PreloadTable(ctx context.Context, in *TableName, o return out, nil } +func (c *milvusServiceClient) Flush(ctx context.Context, in *FlushParam, opts ...grpc.CallOption) (*Status, error) { + out := new(Status) + err := c.cc.Invoke(ctx, "/milvus.grpc.MilvusService/Flush", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *milvusServiceClient) Compact(ctx context.Context, in *TableName, opts ...grpc.CallOption) (*Status, error) { + out := new(Status) + err := c.cc.Invoke(ctx, "/milvus.grpc.MilvusService/Compact", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MilvusServiceServer is the server API for MilvusService service. type MilvusServiceServer interface { //* @@ -1526,6 +2010,13 @@ type MilvusServiceServer interface { // @return TableNameList ShowTables(context.Context, *Command) (*TableNameList, error) //* + // @brief This method is used to get table detail information. + // + // @param TableName, target table name. + // + // @return TableInfo + ShowTableInfo(context.Context, *TableName) (*TableInfo, error) + //* // @brief This method is used to delete table. // // @param TableName, table name is going to be deleted. @@ -1582,6 +2073,20 @@ type MilvusServiceServer interface { // @return VectorIds Insert(context.Context, *InsertParam) (*VectorIds, error) //* + // @brief This method is used to get vector data by id. + // + // @param VectorIdentity, target vector id. + // + // @return VectorData + GetVectorByID(context.Context, *VectorIdentity) (*VectorData, error) + //* + // @brief This method is used to get vector ids from a segment + // + // @param GetVectorIDsParam, target table and segment + // + // @return VectorIds + GetVectorIDs(context.Context, *GetVectorIDsParam) (*VectorIds, error) + //* // @brief This method is used to query vector in table. // // @param SearchParam, search parameters. @@ -1589,6 +2094,13 @@ type MilvusServiceServer interface { // @return TopKQueryResult Search(context.Context, *SearchParam) (*TopKQueryResult, error) //* + // @brief This method is used to query vector by id. + // + // @param SearchByIDParam, search parameters. + // + // @return TopKQueryResult + SearchByID(context.Context, *SearchByIDParam) (*TopKQueryResult, error) + //* // @brief This method is used to query vector in specified files. // // @param SearchInFilesParam, search in files paremeters. @@ -1603,12 +2115,12 @@ type MilvusServiceServer interface { // @return StringReply Cmd(context.Context, *Command) (*StringReply, error) //* - // @brief This method is used to delete vector by date range + // @brief This method is used to delete vector by id // - // @param DeleteByDateParam, delete parameters. + // @param DeleteByIDParam, delete parameters. // // @return status - DeleteByDate(context.Context, *DeleteByDateParam) (*Status, error) + DeleteByID(context.Context, *DeleteByIDParam) (*Status, error) //* // @brief This method is used to preload table // @@ -1616,6 +2128,20 @@ type MilvusServiceServer interface { // // @return Status PreloadTable(context.Context, *TableName) (*Status, error) + //* + // @brief This method is used to flush buffer into storage. + // + // @param FlushParam, flush parameters + // + // @return Status + Flush(context.Context, *FlushParam) (*Status, error) + //* + // @brief This method is used to compact table + // + // @param TableName, target table name. + // + // @return Status + Compact(context.Context, *TableName) (*Status, error) } // UnimplementedMilvusServiceServer can be embedded to have forward compatible implementations. @@ -1637,6 +2163,9 @@ func (*UnimplementedMilvusServiceServer) CountTable(ctx context.Context, req *Ta func (*UnimplementedMilvusServiceServer) ShowTables(ctx context.Context, req *Command) (*TableNameList, error) { return nil, status.Errorf(codes.Unimplemented, "method ShowTables not implemented") } +func (*UnimplementedMilvusServiceServer) ShowTableInfo(ctx context.Context, req *TableName) (*TableInfo, error) { + return nil, status.Errorf(codes.Unimplemented, "method ShowTableInfo not implemented") +} func (*UnimplementedMilvusServiceServer) DropTable(ctx context.Context, req *TableName) (*Status, error) { return nil, status.Errorf(codes.Unimplemented, "method DropTable not implemented") } @@ -1661,21 +2190,36 @@ func (*UnimplementedMilvusServiceServer) DropPartition(ctx context.Context, req func (*UnimplementedMilvusServiceServer) Insert(ctx context.Context, req *InsertParam) (*VectorIds, error) { return nil, status.Errorf(codes.Unimplemented, "method Insert not implemented") } +func (*UnimplementedMilvusServiceServer) GetVectorByID(ctx context.Context, req *VectorIdentity) (*VectorData, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetVectorByID not implemented") +} +func (*UnimplementedMilvusServiceServer) GetVectorIDs(ctx context.Context, req *GetVectorIDsParam) (*VectorIds, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetVectorIDs not implemented") +} func (*UnimplementedMilvusServiceServer) Search(ctx context.Context, req *SearchParam) (*TopKQueryResult, error) { return nil, status.Errorf(codes.Unimplemented, "method Search not implemented") } +func (*UnimplementedMilvusServiceServer) SearchByID(ctx context.Context, req *SearchByIDParam) (*TopKQueryResult, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchByID not implemented") +} func (*UnimplementedMilvusServiceServer) SearchInFiles(ctx context.Context, req *SearchInFilesParam) (*TopKQueryResult, error) { return nil, status.Errorf(codes.Unimplemented, "method SearchInFiles not implemented") } func (*UnimplementedMilvusServiceServer) Cmd(ctx context.Context, req *Command) (*StringReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Cmd not implemented") } -func (*UnimplementedMilvusServiceServer) DeleteByDate(ctx context.Context, req *DeleteByDateParam) (*Status, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteByDate not implemented") +func (*UnimplementedMilvusServiceServer) DeleteByID(ctx context.Context, req *DeleteByIDParam) (*Status, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteByID not implemented") } func (*UnimplementedMilvusServiceServer) PreloadTable(ctx context.Context, req *TableName) (*Status, error) { return nil, status.Errorf(codes.Unimplemented, "method PreloadTable not implemented") } +func (*UnimplementedMilvusServiceServer) Flush(ctx context.Context, req *FlushParam) (*Status, error) { + return nil, status.Errorf(codes.Unimplemented, "method Flush not implemented") +} +func (*UnimplementedMilvusServiceServer) Compact(ctx context.Context, req *TableName) (*Status, error) { + return nil, status.Errorf(codes.Unimplemented, "method Compact not implemented") +} func RegisterMilvusServiceServer(s *grpc.Server, srv MilvusServiceServer) { s.RegisterService(&_MilvusService_serviceDesc, srv) @@ -1771,6 +2315,24 @@ func _MilvusService_ShowTables_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _MilvusService_ShowTableInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TableName) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MilvusServiceServer).ShowTableInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milvus.grpc.MilvusService/ShowTableInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MilvusServiceServer).ShowTableInfo(ctx, req.(*TableName)) + } + return interceptor(ctx, in, info, handler) +} + func _MilvusService_DropTable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(TableName) if err := dec(in); err != nil { @@ -1915,6 +2477,42 @@ func _MilvusService_Insert_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _MilvusService_GetVectorByID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VectorIdentity) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MilvusServiceServer).GetVectorByID(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milvus.grpc.MilvusService/GetVectorByID", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MilvusServiceServer).GetVectorByID(ctx, req.(*VectorIdentity)) + } + return interceptor(ctx, in, info, handler) +} + +func _MilvusService_GetVectorIDs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetVectorIDsParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MilvusServiceServer).GetVectorIDs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milvus.grpc.MilvusService/GetVectorIDs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MilvusServiceServer).GetVectorIDs(ctx, req.(*GetVectorIDsParam)) + } + return interceptor(ctx, in, info, handler) +} + func _MilvusService_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SearchParam) if err := dec(in); err != nil { @@ -1933,6 +2531,24 @@ func _MilvusService_Search_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _MilvusService_SearchByID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchByIDParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MilvusServiceServer).SearchByID(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milvus.grpc.MilvusService/SearchByID", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MilvusServiceServer).SearchByID(ctx, req.(*SearchByIDParam)) + } + return interceptor(ctx, in, info, handler) +} + func _MilvusService_SearchInFiles_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SearchInFilesParam) if err := dec(in); err != nil { @@ -1969,20 +2585,20 @@ func _MilvusService_Cmd_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } -func _MilvusService_DeleteByDate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteByDateParam) +func _MilvusService_DeleteByID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteByIDParam) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MilvusServiceServer).DeleteByDate(ctx, in) + return srv.(MilvusServiceServer).DeleteByID(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/milvus.grpc.MilvusService/DeleteByDate", + FullMethod: "/milvus.grpc.MilvusService/DeleteByID", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MilvusServiceServer).DeleteByDate(ctx, req.(*DeleteByDateParam)) + return srv.(MilvusServiceServer).DeleteByID(ctx, req.(*DeleteByIDParam)) } return interceptor(ctx, in, info, handler) } @@ -2005,6 +2621,42 @@ func _MilvusService_PreloadTable_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +func _MilvusService_Flush_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FlushParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MilvusServiceServer).Flush(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milvus.grpc.MilvusService/Flush", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MilvusServiceServer).Flush(ctx, req.(*FlushParam)) + } + return interceptor(ctx, in, info, handler) +} + +func _MilvusService_Compact_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TableName) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MilvusServiceServer).Compact(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milvus.grpc.MilvusService/Compact", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MilvusServiceServer).Compact(ctx, req.(*TableName)) + } + return interceptor(ctx, in, info, handler) +} + var _MilvusService_serviceDesc = grpc.ServiceDesc{ ServiceName: "milvus.grpc.MilvusService", HandlerType: (*MilvusServiceServer)(nil), @@ -2029,6 +2681,10 @@ var _MilvusService_serviceDesc = grpc.ServiceDesc{ MethodName: "ShowTables", Handler: _MilvusService_ShowTables_Handler, }, + { + MethodName: "ShowTableInfo", + Handler: _MilvusService_ShowTableInfo_Handler, + }, { MethodName: "DropTable", Handler: _MilvusService_DropTable_Handler, @@ -2061,10 +2717,22 @@ var _MilvusService_serviceDesc = grpc.ServiceDesc{ MethodName: "Insert", Handler: _MilvusService_Insert_Handler, }, + { + MethodName: "GetVectorByID", + Handler: _MilvusService_GetVectorByID_Handler, + }, + { + MethodName: "GetVectorIDs", + Handler: _MilvusService_GetVectorIDs_Handler, + }, { MethodName: "Search", Handler: _MilvusService_Search_Handler, }, + { + MethodName: "SearchByID", + Handler: _MilvusService_SearchByID_Handler, + }, { MethodName: "SearchInFiles", Handler: _MilvusService_SearchInFiles_Handler, @@ -2074,13 +2742,21 @@ var _MilvusService_serviceDesc = grpc.ServiceDesc{ Handler: _MilvusService_Cmd_Handler, }, { - MethodName: "DeleteByDate", - Handler: _MilvusService_DeleteByDate_Handler, + MethodName: "DeleteByID", + Handler: _MilvusService_DeleteByID_Handler, }, { MethodName: "PreloadTable", Handler: _MilvusService_PreloadTable_Handler, }, + { + MethodName: "Flush", + Handler: _MilvusService_Flush_Handler, + }, + { + MethodName: "Compact", + Handler: _MilvusService_Compact_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "milvus.proto", diff --git a/milvus/grpc/go_gen.sh b/milvus/grpc/go_gen.sh index 61f0a5e7..041b96b3 100755 --- a/milvus/grpc/go_gen.sh +++ b/milvus/grpc/go_gen.sh @@ -1,5 +1,7 @@ #!/bin/bash -protoc -I . milvus.proto --go_out=plugins=grpc:gen +/home/yukun/test/milvus/core/cmake-build-debug/grpc_ep-prefix/src/grpc_ep/bins/opt/protobuf/protoc -I . milvus.proto --go_out=plugins=grpc:gen + +/home/yukun/test/milvus/core/cmake-build-debug/grpc_ep-prefix/src/grpc_ep/bins/opt/protobuf/protoc -I . status.proto --go_out=plugins=grpc:gen + -protoc -I . status.proto --go_out=plugins=grpc:gen diff --git a/milvus/grpc/milvus.proto b/milvus/grpc/milvus.proto index 4cfc1cfa..7a7393ce 100644 --- a/milvus/grpc/milvus.proto +++ b/milvus/grpc/milvus.proto @@ -5,17 +5,18 @@ import "status.proto"; package milvus.grpc; /** - * @brief Table name + * @brief general usage */ -message TableName { - string table_name = 1; +message KeyValuePair { + string key = 1; + string value = 2; } /** - * @brief Partition name + * @brief Table name */ -message PartitionName { - string partition_name = 1; +message TableName { + string table_name = 1; } /** @@ -28,6 +29,7 @@ message TableNameList { /** * @brief Table schema + * metric_type: 1-L2, 2-IP */ message TableSchema { Status status = 1; @@ -35,6 +37,7 @@ message TableSchema { int64 dimension = 3; int64 index_file_size = 4; int32 metric_type = 5; + repeated KeyValuePair extra_params = 6; } /** @@ -42,8 +45,7 @@ message TableSchema { */ message PartitionParam { string table_name = 1; - string partition_name = 2; - string tag = 3; + string tag = 2; } /** @@ -51,22 +53,15 @@ message PartitionParam { */ message PartitionList { Status status = 1; - repeated PartitionParam partition_array = 2; -} - -/** - * @brief Range schema - */ -message Range { - string start_value = 1; - string end_value = 2; + repeated string partition_tag_array = 2; } /** * @brief Record inserted */ message RowRecord { - repeated float vector_data = 1; //binary vector data + repeated float float_data = 1; //float vector data + bytes binary_data = 2; //binary vector data } /** @@ -77,6 +72,7 @@ message InsertParam { repeated RowRecord row_record_array = 2; repeated int64 row_id_array = 3; //optional string partition_tag = 4; + repeated KeyValuePair extra_params = 5; } /** @@ -92,11 +88,10 @@ message VectorIds { */ message SearchParam { string table_name = 1; - repeated RowRecord query_record_array = 2; - repeated Range query_range_array = 3; + repeated string partition_tag_array = 2; + repeated RowRecord query_record_array = 3; int64 topk = 4; - int64 nprobe = 5; - repeated string partition_tag_array = 6; + repeated KeyValuePair extra_params = 5; } /** @@ -107,6 +102,17 @@ message SearchInFilesParam { SearchParam search_param = 2; } +/** + * @brief Params for searching vector by ID + */ +message SearchByIDParam { + string table_name = 1; + repeated string partition_tag_array = 2; + int64 id = 3; + int64 topk = 4; + repeated KeyValuePair extra_params = 5; +} + /** * @brief Query result params */ @@ -149,30 +155,81 @@ message Command { } /** - * @brief Index + * @brief Index params * @index_type: 0-invalid, 1-idmap, 2-ivflat, 3-ivfsq8, 4-nsgmix - * @metric_type: 1-L2, 2-IP */ -message Index { - int32 index_type = 1; - int32 nlist = 2; +message IndexParam { + Status status = 1; + string table_name = 2; + int32 index_type = 3; + repeated KeyValuePair extra_params = 4; } /** - * @brief Index params + * @brief Flush params */ -message IndexParam { +message FlushParam { + repeated string table_name_array = 1; +} + +/** + * @brief Flush params + */ +message DeleteByIDParam { + string table_name = 1; + repeated int64 id_array = 2; +} + +/** + * @brief segment statistics + */ +message SegmentStat { + string segment_name = 1; + int64 row_count = 2; + string index_name = 3; + int64 data_size = 4; +} + +/** + * @brief table statistics + */ +message PartitionStat { + string tag = 1; + int64 total_row_count = 2; + repeated SegmentStat segments_stat = 3; +} + +/** + * @brief table information + */ +message TableInfo { Status status = 1; - string table_name = 2; - Index index = 3; + int64 total_row_count = 2; + repeated PartitionStat partitions_stat = 3; } /** - * @brief table name and range for DeleteByDate + * @brief vector identity */ -message DeleteByDateParam { - Range range = 1; - string table_name = 2; +message VectorIdentity { + string table_name = 1; + int64 id = 2; +} + +/** + * @brief vector data + */ +message VectorData { + Status status = 1; + RowRecord vector_data = 2; +} + +/** + * @brief get vector ids from a segment parameters + */ +message GetVectorIDsParam { + string table_name = 1; + string segment_name = 2; } service MilvusService { @@ -221,6 +278,15 @@ service MilvusService { */ rpc ShowTables(Command) returns (TableNameList) {} + /** + * @brief This method is used to get table detail information. + * + * @param TableName, target table name. + * + * @return TableInfo + */ + rpc ShowTableInfo(TableName) returns (TableInfo) {} + /** * @brief This method is used to delete table. * @@ -293,6 +359,24 @@ service MilvusService { */ rpc Insert(InsertParam) returns (VectorIds) {} + /** + * @brief This method is used to get vector data by id. + * + * @param VectorIdentity, target vector id. + * + * @return VectorData + */ + rpc GetVectorByID(VectorIdentity) returns (VectorData) {} + + /** + * @brief This method is used to get vector ids from a segment + * + * @param GetVectorIDsParam, target table and segment + * + * @return VectorIds + */ + rpc GetVectorIDs(GetVectorIDsParam) returns (VectorIds) {} + /** * @brief This method is used to query vector in table. * @@ -302,6 +386,15 @@ service MilvusService { */ rpc Search(SearchParam) returns (TopKQueryResult) {} + /** + * @brief This method is used to query vector by id. + * + * @param SearchByIDParam, search parameters. + * + * @return TopKQueryResult + */ + rpc SearchByID(SearchByIDParam) returns (TopKQueryResult) {} + /** * @brief This method is used to query vector in specified files. * @@ -320,21 +413,39 @@ service MilvusService { */ rpc Cmd(Command) returns (StringReply) {} - /** - * @brief This method is used to delete vector by date range + /** + * @brief This method is used to delete vector by id * - * @param DeleteByDateParam, delete parameters. + * @param DeleteByIDParam, delete parameters. * * @return status */ - rpc DeleteByDate(DeleteByDateParam) returns (Status) {} - - /** - * @brief This method is used to preload table - * - * @param TableName, target table name. - * - * @return Status - */ - rpc PreloadTable(TableName) returns (Status) {} + rpc DeleteByID(DeleteByIDParam) returns (Status) {} + + /** + * @brief This method is used to preload table + * + * @param TableName, target table name. + * + * @return Status + */ + rpc PreloadTable(TableName) returns (Status) {} + + /** + * @brief This method is used to flush buffer into storage. + * + * @param FlushParam, flush parameters + * + * @return Status + */ + rpc Flush(FlushParam) returns (Status) {} + + /** + * @brief This method is used to compact table + * + * @param TableName, target table name. + * + * @return Status + */ + rpc Compact(TableName) returns (Status) {} } diff --git a/test/client_test.go b/test/client_test.go new file mode 100644 index 00000000..3663e8f6 --- /dev/null +++ b/test/client_test.go @@ -0,0 +1,402 @@ +package test + +import ( + "github.com/milvus-io/milvus-sdk-go/milvus" + "testing" +) + +var TABLENAME string = "go_test" +var client milvus.MilvusClient = GetClient() + +func GetClient() milvus.MilvusClient { + var grpcClient milvus.Milvusclient + client := milvus.NewMilvusClient(grpcClient.Instance) + connectParam := milvus.ConnectParam{"127.0.0.1", "19530"} + err := client.Connect(connectParam) + if err != nil { + println("Connect failed") + return nil + } + return client +} + +func CreateCollection() error { + boolReply, status, err := client.HasCollection(TABLENAME) + if boolReply == true { + return err + } + + collectionParam := milvus.CollectionParam{TABLENAME, 128, 1024, int64(milvus.L2)} + status, err = client.CreateCollection(collectionParam) + if err != nil { + return err + } + if !status.Ok() { + println("CreateCollection failed") + } + return err +} + +func TestConnection(t *testing.T) { + var grpcClient milvus.Milvusclient + testClient := milvus.NewMilvusClient(grpcClient.Instance) + connectParam := milvus.ConnectParam{"127.0.0.1", "19530"} + err := testClient.Connect(connectParam) + if err != nil { + t.Error("Connect error: " + err.Error()) + } + + // test wrong uri connect + connectParam = milvus.ConnectParam{"12345", "111"} + err = testClient.Connect(connectParam) + if err == nil { + t.Error("Use wrong uri to connect, return true") + } +} + +func TestCollection(t *testing.T) { + param := milvus.CollectionParam{"test_1", 128, 1024, int64(milvus.L2)} + status, err := client.CreateCollection(param) + if err != nil { + t.Error("CreateCollection error") + } + + if !status.Ok() { + t.Error("CreateCollection return status wrong!") + } + + // test ShowCollections + collections, status, err := client.ShowCollections() + if err != nil { + t.Error("ShowCollections error") + return + } + if !status.Ok() { + t.Error("ShowCollections status check error") + } + if len(collections) != 1 && collections[0] != TABLENAME { + t.Error("ShowCollections result check error") + } + + // test normal hascollection + hasCollection, status, err := client.HasCollection("test_1") + if err != nil { + t.Error("HasCollection error") + return + } + + if !status.Ok() { + t.Error("HasCollection status check error") + } + + if !hasCollection { + t.Error("HasCollection result check error") + } + + // test HasCollection with collection not exist + hasCollection, status, err = client.HasCollection("aaa") + if err != nil { + t.Error("HasCollection error") + } + + if hasCollection == true { + t.Error("HasCollection result check error") + } + + // test DropCollection + status, err = client.DropCollection("test_1") + if err != nil { + t.Error("DropCollection error") + } + + if !status.Ok() { + t.Error("DropCollection status check error") + } + + hasCollection, status, err = client.HasCollection("test_1") + if hasCollection == true { + t.Error("DropCollection result check error") + } + + // test DropCollection with collection not exist + status, err = client.DropCollection("aaa") + if err != nil { + t.Error("DropCollection error") + } + + if status.Ok() { + t.Error("DropCollection status check error") + } +} + +func TestEntity(t *testing.T) { + err := CreateCollection() + if err != nil { + t.Error("Create collection error") + } + // test insert + var i, j int + + nb := 10000 + dimension := 128 + records := make([]milvus.Entity, nb) + recordArray := make([][]float32, 10000) + for i = 0; i < nb; i++ { + recordArray[i] = make([]float32, dimension) + for j = 0; j < dimension; j++ { + recordArray[i][j] = float32(i % (j + 1)) + } + records[i].FloatData = recordArray[i] + } + insertParam := milvus.InsertParam{TABLENAME, "", records, nil} + status, err := client.Insert(&insertParam) + if err != nil { + t.Error("Insert error") + return + } + + if !status.Ok() { + t.Error("Insert status check error") + } + + // Flush + collection_array := make([]string, 1) + collection_array[0] = TABLENAME + status, err = client.Flush(collection_array) + if err != nil { + t.Error("Flush error") + return + } + if !status.Ok() { + t.Error("Flush status check error") + } + + // test ShowCollectionInfos + collectionInfo, status, err := client.ShowCollectionInfo(TABLENAME) + if err != nil { + t.Error("ShowCollectionInfo error") + return + } + + if !status.Ok() { + t.Error("ShowCollectionInfo status check error") + } + + if collectionInfo.TotalRowCount == 0 { + t.Error("ShowCollectionInfo result check error") + } + + // test GetEntityIds + getEntityIDsParam := milvus.GetEntityIDsParam{TABLENAME, collectionInfo.PartitionsStat[0].SegmentsStat[0].SegmentName} + entityIDs, status, err := client.GetEntityIDs(getEntityIDsParam) + if err != nil { + t.Error("GetEntityIDs error") + return + } + + if len(entityIDs) == 0 { + t.Error("GetEntityIDs result check error") + } + + // test GetEntityById + rowRecord, status, err := client.GetEntityByID(TABLENAME, entityIDs[0]) + if err != nil { + t.Error("GetEntityByID error") + return + } + if !status.Ok() { + t.Error("GetEntityByID status check error") + } + if len(rowRecord.FloatData) != 128 { + t.Error("GetEntityByID result check error") + } + + // test DeleteByID + id_array := make([]int64, 1) + id_array[0] = entityIDs[0] + status, err = client.DeleteByID(TABLENAME, id_array) + if err != nil { + t.Error("DeleteByID error") + return + } + if !status.Ok() { + t.Error("DeleteByID status check error") + } +} + +func TestIndex(t *testing.T) { + extraParam := "{\"nlist\" : 16384}" + indexParam := milvus.IndexParam{TABLENAME, milvus.IVFFLAT, extraParam} + status, err := client.CreateIndex(&indexParam) + if err != nil { + t.Error("CreateIndex error") + } + if !status.Ok() { + t.Error("CreateIndex status check error") + } + + // test DescribeIndex + indexInfo, status, err := client.DescribeIndex(TABLENAME) + if err != nil { + t.Error("DescribeIndex error") + return + } + if !status.Ok() { + t.Error("DescribeIndex status check error") + } + if indexInfo.CollectionName != TABLENAME || indexInfo.IndexType != milvus.IVFFLAT { + t.Error("DescribeIndex result chck error") + } + + // test DropIndex + status, err = client.DropIndex(TABLENAME) + if err != nil { + t.Error("DropIndex error") + return + } + + if !status.Ok() { + t.Error("DropIndex status check erro") + } + + status, err = client.CreateIndex(&indexParam) + if err != nil { + t.Error("CreateIndex error") + } + if !status.Ok() { + t.Error("CreateIndex status check error") + } +} + +func TestSearch(t *testing.T) { + var i, j int + //Construct query entities + nq := 10 + dimension := 128 + topk := 10 + queryRecords := make([]milvus.Entity, nq) + queryEntitys := make([][]float32, nq) + for i = 0; i < nq; i++ { + queryEntitys[i] = make([]float32, dimension) + for j = 0; j < dimension; j++ { + queryEntitys[i][j] = float32(i % (j + 1)) + } + queryRecords[i].FloatData = queryEntitys[i] + } + + var topkQueryResult milvus.TopkQueryResult + extraParam := "{\"nprobe\" : 32}" + searchParam := milvus.SearchParam{TABLENAME, queryRecords, int64(topk), nil, extraParam} + topkQueryResult, status, err := client.Search(searchParam) + if err != nil { + t.Error(err.Error()) + } + if !status.Ok() { + t.Error("Search status check error") + } + if len(topkQueryResult.QueryResultList) != nq { + t.Error("Search result check error") + } +} + +func TestCmd(t *testing.T) { + // test ServerStatus + serverStatus, status, err := client.ServerStatus() + if err != nil { + t.Error("ServerStatus error") + return + } + if !status.Ok() { + t.Error("ServerStatus status check error") + } + if serverStatus != "server alive" { + t.Error("ServerStatus result check error: " + serverStatus) + } + + // test ServerVersion + serverVersion, status, err := client.ServerVersion() + if err != nil { + t.Error("ServerVersion error") + return + } + if !status.Ok() { + t.Error("ServerVersion status check error") + } + if len(serverVersion) == 0 { + t.Error("ServerVersion result check error") + } + + // test SetConfig and GetConfig + nodeName := "cache_config.cpu_cache_capacity" + nodeValue := "2" + status, err = client.SetConfig(nodeName, nodeValue) + if err != nil { + t.Error("SetConfig error") + } + if !status.Ok() { + t.Error("SetConfig status check error: " + status.GetMessage()) + } + + value, status, err := client.GetConfig(nodeName) + if err != nil { + t.Error("GetConfig error") + return + } + if !status.Ok() { + t.Error("GetConfig status check error") + } + if value != nodeValue { + t.Error("GetConfig or SetConfig result check error") + } +} + +func TestPartition(t *testing.T) { + // test CreatePartition + partitionTag := "part_1" + status, err := client.CreatePartition(milvus.PartitionParam{TABLENAME, partitionTag}) + if err != nil { + t.Error("CreatePartition error") + return + } + if !status.Ok() { + t.Error("CreatePartition status check error") + } + + // test ShowPartitions + partitionParam, status, err := client.ShowPartitions(TABLENAME) + if !status.Ok() { + t.Error("ShowPartitions status check error") + } + if len(partitionParam) == 0 { + t.Error("ShowPartitions result check error") + } + + // test DropPartition + status, err = client.DropPartition(milvus.PartitionParam{TABLENAME, partitionTag}) + if !status.Ok() { + t.Error("DropPartition status check error") + } +} + +func TestFlush(t *testing.T) { + collectionNameArray := make([]string, 1) + collectionNameArray[0] = TABLENAME + status, err := client.Flush(collectionNameArray) + if err != nil { + t.Error("Flush error") + } + if !status.Ok() { + t.Error("Flush status check error") + } +} + +func TestCompact(t *testing.T) { + status, err := client.Compact(TABLENAME) + if err != nil { + t.Error("Compact error") + return + } + if !status.Ok() { + t.Error("Compact status check error") + } +}