Browse Source

release v0.1.1: change proto package to io.milvus.grpc

zhiru 5 years ago
parent
commit
d0c66e0d06

+ 1 - 0
milvus-sdk-java.iml

@@ -8,6 +8,7 @@
       <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/target/generated-sources/protobuf/grpc-java" isTestSource="false" generated="true" />
       <sourceFolder url="file://$MODULE_DIR$/target/generated-sources/protobuf/grpc-java" isTestSource="false" generated="true" />
       <sourceFolder url="file://$MODULE_DIR$/target/generated-sources/protobuf/java" isTestSource="false" generated="true" />
       <sourceFolder url="file://$MODULE_DIR$/target/generated-sources/protobuf/java" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/proto" type="java-resource" />
       <excludeFolder url="file://$MODULE_DIR$/target" />
       <excludeFolder url="file://$MODULE_DIR$/target" />
     </content>
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="inheritedJdk" />

+ 18 - 1
pom.xml

@@ -1,4 +1,21 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
 <project xmlns="http://maven.apache.org/POM/4.0.0"
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -6,7 +23,7 @@
 
 
     <groupId>io.milvus</groupId>
     <groupId>io.milvus</groupId>
     <artifactId>milvus-sdk-java</artifactId>
     <artifactId>milvus-sdk-java</artifactId>
-    <version>0.1.0</version>
+    <version>0.1.1</version>
     <packaging>jar</packaging>
     <packaging>jar</packaging>
 
 
     <name>io.milvus:milvus-sdk-java</name>
     <name>io.milvus:milvus-sdk-java</name>

+ 5 - 5
src/main/java/io/milvus/client/MilvusClient.java

@@ -126,7 +126,7 @@ public interface MilvusClient {
   /**
   /**
    * Creates index specified by <code>indexParam</code>
    * Creates index specified by <code>indexParam</code>
    *
    *
-   * @param createIndexParam the <code>IndexParam</code> object
+   * @param createIndexParam the <code>CreateIndexParam</code> object
    *     <pre>
    *     <pre>
    * example usage:
    * example usage:
    * <code>
    * <code>
@@ -134,10 +134,10 @@ public interface MilvusClient {
    *                        .withIndexType(IndexType.IVF_SQ8)
    *                        .withIndexType(IndexType.IVF_SQ8)
    *                        .withNList(16384)
    *                        .withNList(16384)
    *                        .build();
    *                        .build();
-   * IndexParam indexParam = new IndexParam.Builder(tableName)
-   *                                       .withIndex(index)
-   *                                       .withTimeout(timeout)
-   *                                       .build();
+   * CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName)
+   *                                                   .withIndex(index)
+   *                                                   .withTimeout(timeout)
+   *                                                   .build();
    * </code>
    * </code>
    * </pre>
    * </pre>
    *
    *

+ 91 - 94
src/main/java/io/milvus/client/MilvusGrpcClient.java

@@ -41,7 +41,7 @@ public class MilvusGrpcClient implements MilvusClient {
   private static final String ANSI_BRIGHT_PURPLE = "\u001B[95m";
   private static final String ANSI_BRIGHT_PURPLE = "\u001B[95m";
 
 
   private ManagedChannel channel = null;
   private ManagedChannel channel = null;
-  private io.milvus.client.grpc.MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub;
+  private io.milvus.grpc.MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub;
 
 
   /////////////////////// Client Calls///////////////////////
   /////////////////////// Client Calls///////////////////////
 
 
@@ -56,7 +56,7 @@ public class MilvusGrpcClient implements MilvusClient {
       int port = Integer.parseInt(connectParam.getPort());
       int port = Integer.parseInt(connectParam.getPort());
       if (port < 0 || port > 0xFFFF) {
       if (port < 0 || port > 0xFFFF) {
         logSevere("Connect failed! Port {0} out of range", connectParam.getPort());
         logSevere("Connect failed! Port {0} out of range", connectParam.getPort());
-        return new Response(Response.Status.CONNECT_FAILED);
+        return new Response(Response.Status.CONNECT_FAILED, "Port " + port + " out of range");
       }
       }
 
 
       channel =
       channel =
@@ -74,14 +74,15 @@ public class MilvusGrpcClient implements MilvusClient {
       connectivityState = channel.getState(false);
       connectivityState = channel.getState(false);
       if (connectivityState != ConnectivityState.READY) {
       if (connectivityState != ConnectivityState.READY) {
         logSevere("Connect failed! {0}", connectParam.toString());
         logSevere("Connect failed! {0}", connectParam.toString());
-        return new Response(Response.Status.CONNECT_FAILED);
+        return new Response(
+            Response.Status.CONNECT_FAILED, "connectivity state = " + connectivityState);
       }
       }
 
 
-      blockingStub = io.milvus.client.grpc.MilvusServiceGrpc.newBlockingStub(channel);
+      blockingStub = io.milvus.grpc.MilvusServiceGrpc.newBlockingStub(channel);
 
 
     } catch (Exception e) {
     } catch (Exception e) {
       logSevere("Connect failed! {0}\n{1}", connectParam.toString(), e.toString());
       logSevere("Connect failed! {0}\n{1}", connectParam.toString(), e.toString());
-      return new Response(Response.Status.CONNECT_FAILED);
+      return new Response(Response.Status.CONNECT_FAILED, e.toString());
     }
     }
 
 
     logInfo("Connected successfully!\n{0}", connectParam.toString());
     logInfo("Connected successfully!\n{0}", connectParam.toString());
@@ -122,15 +123,15 @@ public class MilvusGrpcClient implements MilvusClient {
     }
     }
 
 
     TableSchema tableSchema = tableSchemaParam.getTableSchema();
     TableSchema tableSchema = tableSchemaParam.getTableSchema();
-    io.milvus.client.grpc.TableSchema request =
-        io.milvus.client.grpc.TableSchema.newBuilder()
+    io.milvus.grpc.TableSchema request =
+        io.milvus.grpc.TableSchema.newBuilder()
             .setTableName(tableSchema.getTableName())
             .setTableName(tableSchema.getTableName())
             .setDimension(tableSchema.getDimension())
             .setDimension(tableSchema.getDimension())
             .setIndexFileSize(tableSchema.getIndexFileSize())
             .setIndexFileSize(tableSchema.getIndexFileSize())
             .setMetricType(tableSchema.getMetricType().getVal())
             .setMetricType(tableSchema.getMetricType().getVal())
             .build();
             .build();
 
 
-    io.milvus.client.grpc.Status response;
+    io.milvus.grpc.Status response;
 
 
     try {
     try {
       response =
       response =
@@ -138,7 +139,7 @@ public class MilvusGrpcClient implements MilvusClient {
               .withDeadlineAfter(tableSchemaParam.getTimeout(), TimeUnit.SECONDS)
               .withDeadlineAfter(tableSchemaParam.getTimeout(), TimeUnit.SECONDS)
               .createTable(request);
               .createTable(request);
 
 
-      if (response.getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+      if (response.getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         logInfo("Created table successfully!\n{0}", tableSchema.toString());
         logInfo("Created table successfully!\n{0}", tableSchema.toString());
         return new Response(Response.Status.SUCCESS);
         return new Response(Response.Status.SUCCESS);
       } else if (response.getReason().contentEquals("Table already exists")) {
       } else if (response.getReason().contentEquals("Table already exists")) {
@@ -165,9 +166,9 @@ public class MilvusGrpcClient implements MilvusClient {
     }
     }
 
 
     String tableName = tableParam.getTableName();
     String tableName = tableParam.getTableName();
-    io.milvus.client.grpc.TableName request =
-        io.milvus.client.grpc.TableName.newBuilder().setTableName(tableName).build();
-    io.milvus.client.grpc.BoolReply response;
+    io.milvus.grpc.TableName request =
+        io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
+    io.milvus.grpc.BoolReply response;
 
 
     try {
     try {
       response =
       response =
@@ -175,7 +176,7 @@ public class MilvusGrpcClient implements MilvusClient {
               .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
               .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
               .hasTable(request);
               .hasTable(request);
 
 
-      if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+      if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         logInfo("hasTable `{0}` = {1}", tableName, response.getBoolReply());
         logInfo("hasTable `{0}` = {1}", tableName, response.getBoolReply());
         return new HasTableResponse(new Response(Response.Status.SUCCESS), response.getBoolReply());
         return new HasTableResponse(new Response(Response.Status.SUCCESS), response.getBoolReply());
       } else {
       } else {
@@ -201,9 +202,9 @@ public class MilvusGrpcClient implements MilvusClient {
     }
     }
 
 
     String tableName = tableParam.getTableName();
     String tableName = tableParam.getTableName();
-    io.milvus.client.grpc.TableName request =
-        io.milvus.client.grpc.TableName.newBuilder().setTableName(tableName).build();
-    io.milvus.client.grpc.Status response;
+    io.milvus.grpc.TableName request =
+        io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
+    io.milvus.grpc.Status response;
 
 
     try {
     try {
       response =
       response =
@@ -211,7 +212,7 @@ public class MilvusGrpcClient implements MilvusClient {
               .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
               .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
               .dropTable(request);
               .dropTable(request);
 
 
-      if (response.getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+      if (response.getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         logInfo("Dropped table `{0}` successfully!", tableName);
         logInfo("Dropped table `{0}` successfully!", tableName);
         return new Response(Response.Status.SUCCESS);
         return new Response(Response.Status.SUCCESS);
       } else {
       } else {
@@ -233,18 +234,18 @@ public class MilvusGrpcClient implements MilvusClient {
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
     }
     }
 
 
-    io.milvus.client.grpc.Index index =
-        io.milvus.client.grpc.Index.newBuilder()
+    io.milvus.grpc.Index index =
+        io.milvus.grpc.Index.newBuilder()
             .setIndexType(createIndexParam.getIndex().getIndexType().getVal())
             .setIndexType(createIndexParam.getIndex().getIndexType().getVal())
             .setNlist(createIndexParam.getIndex().getNList())
             .setNlist(createIndexParam.getIndex().getNList())
             .build();
             .build();
-    io.milvus.client.grpc.IndexParam request =
-        io.milvus.client.grpc.IndexParam.newBuilder()
+    io.milvus.grpc.IndexParam request =
+        io.milvus.grpc.IndexParam.newBuilder()
             .setTableName(createIndexParam.getTableName())
             .setTableName(createIndexParam.getTableName())
             .setIndex(index)
             .setIndex(index)
             .build();
             .build();
 
 
-    io.milvus.client.grpc.Status response;
+    io.milvus.grpc.Status response;
 
 
     try {
     try {
       response =
       response =
@@ -252,7 +253,7 @@ public class MilvusGrpcClient implements MilvusClient {
               .withDeadlineAfter(createIndexParam.getTimeout(), TimeUnit.SECONDS)
               .withDeadlineAfter(createIndexParam.getTimeout(), TimeUnit.SECONDS)
               .createIndex(request);
               .createIndex(request);
 
 
-      if (response.getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+      if (response.getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         logInfo("Created index successfully!\n{0}", createIndexParam.toString());
         logInfo("Created index successfully!\n{0}", createIndexParam.toString());
         return new Response(Response.Status.SUCCESS);
         return new Response(Response.Status.SUCCESS);
       } else {
       } else {
@@ -276,20 +277,20 @@ public class MilvusGrpcClient implements MilvusClient {
           new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
           new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
     }
     }
 
 
-    List<io.milvus.client.grpc.RowRecord> rowRecordList = new ArrayList<>();
+    List<io.milvus.grpc.RowRecord> rowRecordList = new ArrayList<>();
     for (List<Float> vectors : insertParam.getVectors()) {
     for (List<Float> vectors : insertParam.getVectors()) {
-      io.milvus.client.grpc.RowRecord rowRecord =
-          io.milvus.client.grpc.RowRecord.newBuilder().addAllVectorData(vectors).build();
+      io.milvus.grpc.RowRecord rowRecord =
+          io.milvus.grpc.RowRecord.newBuilder().addAllVectorData(vectors).build();
       rowRecordList.add(rowRecord);
       rowRecordList.add(rowRecord);
     }
     }
 
 
-    io.milvus.client.grpc.InsertParam request =
-        io.milvus.client.grpc.InsertParam.newBuilder()
+    io.milvus.grpc.InsertParam request =
+        io.milvus.grpc.InsertParam.newBuilder()
             .setTableName(insertParam.getTableName())
             .setTableName(insertParam.getTableName())
             .addAllRowRecordArray(rowRecordList)
             .addAllRowRecordArray(rowRecordList)
             .addAllRowIdArray(insertParam.getVectorIds())
             .addAllRowIdArray(insertParam.getVectorIds())
             .build();
             .build();
-    io.milvus.client.grpc.VectorIds response;
+    io.milvus.grpc.VectorIds response;
 
 
     try {
     try {
       response =
       response =
@@ -297,10 +298,10 @@ public class MilvusGrpcClient implements MilvusClient {
               .withDeadlineAfter(insertParam.getTimeout(), TimeUnit.SECONDS)
               .withDeadlineAfter(insertParam.getTimeout(), TimeUnit.SECONDS)
               .insert(request);
               .insert(request);
 
 
-      if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+      if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         Optional<List<Long>> resultVectorIds = Optional.ofNullable(response.getVectorIdArrayList());
         Optional<List<Long>> resultVectorIds = Optional.ofNullable(response.getVectorIdArrayList());
         logInfo(
         logInfo(
-            "Inserted {0} vectors to table `{1} successfully!",
+            "Inserted {0} vectors to table `{1}` successfully!",
             resultVectorIds.map(List::size).orElse(0), insertParam.getTableName());
             resultVectorIds.map(List::size).orElse(0), insertParam.getTableName());
         return new InsertResponse(
         return new InsertResponse(
             new Response(Response.Status.SUCCESS), resultVectorIds.orElse(new ArrayList<>()));
             new Response(Response.Status.SUCCESS), resultVectorIds.orElse(new ArrayList<>()));
@@ -328,12 +329,12 @@ public class MilvusGrpcClient implements MilvusClient {
           new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
           new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
     }
     }
 
 
-    List<io.milvus.client.grpc.RowRecord> queryRowRecordList = getQueryRowRecordList(searchParam);
+    List<io.milvus.grpc.RowRecord> queryRowRecordList = getQueryRowRecordList(searchParam);
 
 
-    List<io.milvus.client.grpc.Range> queryRangeList = getQueryRangeList(searchParam);
+    List<io.milvus.grpc.Range> queryRangeList = getQueryRangeList(searchParam);
 
 
-    io.milvus.client.grpc.SearchParam request =
-        io.milvus.client.grpc.SearchParam.newBuilder()
+    io.milvus.grpc.SearchParam request =
+        io.milvus.grpc.SearchParam.newBuilder()
             .setTableName(searchParam.getTableName())
             .setTableName(searchParam.getTableName())
             .addAllQueryRecordArray(queryRowRecordList)
             .addAllQueryRecordArray(queryRowRecordList)
             .addAllQueryRangeArray(queryRangeList)
             .addAllQueryRangeArray(queryRangeList)
@@ -341,7 +342,7 @@ public class MilvusGrpcClient implements MilvusClient {
             .setNprobe(searchParam.getNProbe())
             .setNprobe(searchParam.getNProbe())
             .build();
             .build();
 
 
-    io.milvus.client.grpc.TopKQueryResultList response;
+    io.milvus.grpc.TopKQueryResultList response;
 
 
     try {
     try {
       response =
       response =
@@ -349,7 +350,7 @@ public class MilvusGrpcClient implements MilvusClient {
               .withDeadlineAfter(searchParam.getTimeout(), TimeUnit.SECONDS)
               .withDeadlineAfter(searchParam.getTimeout(), TimeUnit.SECONDS)
               .search(request);
               .search(request);
 
 
-      if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+      if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         List<List<SearchResponse.QueryResult>> queryResultsList = getQueryResultsList(response);
         List<List<SearchResponse.QueryResult>> queryResultsList = getQueryResultsList(response);
         logInfo(
         logInfo(
             "Search completed successfully! Returned results for {0} queries",
             "Search completed successfully! Returned results for {0} queries",
@@ -381,12 +382,12 @@ public class MilvusGrpcClient implements MilvusClient {
 
 
     SearchParam searchParam = searchInFilesParam.getSearchParam();
     SearchParam searchParam = searchInFilesParam.getSearchParam();
 
 
-    List<io.milvus.client.grpc.RowRecord> queryRowRecordList = getQueryRowRecordList(searchParam);
+    List<io.milvus.grpc.RowRecord> queryRowRecordList = getQueryRowRecordList(searchParam);
 
 
-    List<io.milvus.client.grpc.Range> queryRangeList = getQueryRangeList(searchParam);
+    List<io.milvus.grpc.Range> queryRangeList = getQueryRangeList(searchParam);
 
 
-    io.milvus.client.grpc.SearchParam searchParamToSet =
-        io.milvus.client.grpc.SearchParam.newBuilder()
+    io.milvus.grpc.SearchParam searchParamToSet =
+        io.milvus.grpc.SearchParam.newBuilder()
             .setTableName(searchParam.getTableName())
             .setTableName(searchParam.getTableName())
             .addAllQueryRecordArray(queryRowRecordList)
             .addAllQueryRecordArray(queryRowRecordList)
             .addAllQueryRangeArray(queryRangeList)
             .addAllQueryRangeArray(queryRangeList)
@@ -394,13 +395,13 @@ public class MilvusGrpcClient implements MilvusClient {
             .setNprobe(searchParam.getNProbe())
             .setNprobe(searchParam.getNProbe())
             .build();
             .build();
 
 
-    io.milvus.client.grpc.SearchInFilesParam request =
-        io.milvus.client.grpc.SearchInFilesParam.newBuilder()
+    io.milvus.grpc.SearchInFilesParam request =
+        io.milvus.grpc.SearchInFilesParam.newBuilder()
             .addAllFileIdArray(searchInFilesParam.getFileIds())
             .addAllFileIdArray(searchInFilesParam.getFileIds())
             .setSearchParam(searchParamToSet)
             .setSearchParam(searchParamToSet)
             .build();
             .build();
 
 
-    io.milvus.client.grpc.TopKQueryResultList response;
+    io.milvus.grpc.TopKQueryResultList response;
 
 
     try {
     try {
       response =
       response =
@@ -408,7 +409,7 @@ public class MilvusGrpcClient implements MilvusClient {
               .withDeadlineAfter(searchInFilesParam.getTimeout(), TimeUnit.SECONDS)
               .withDeadlineAfter(searchInFilesParam.getTimeout(), TimeUnit.SECONDS)
               .searchInFiles(request);
               .searchInFiles(request);
 
 
-      if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+      if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         logInfo("Search in files {0} completed successfully!", searchInFilesParam.getFileIds());
         logInfo("Search in files {0} completed successfully!", searchInFilesParam.getFileIds());
 
 
         List<List<SearchResponse.QueryResult>> queryResultsList = getQueryResultsList(response);
         List<List<SearchResponse.QueryResult>> queryResultsList = getQueryResultsList(response);
@@ -439,9 +440,9 @@ public class MilvusGrpcClient implements MilvusClient {
     }
     }
 
 
     String tableName = tableParam.getTableName();
     String tableName = tableParam.getTableName();
-    io.milvus.client.grpc.TableName request =
-        io.milvus.client.grpc.TableName.newBuilder().setTableName(tableName).build();
-    io.milvus.client.grpc.TableSchema response;
+    io.milvus.grpc.TableName request =
+        io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
+    io.milvus.grpc.TableSchema response;
 
 
     try {
     try {
       response =
       response =
@@ -449,7 +450,7 @@ public class MilvusGrpcClient implements MilvusClient {
               .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
               .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
               .describeTable(request);
               .describeTable(request);
 
 
-      if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+      if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         TableSchema tableSchema =
         TableSchema tableSchema =
             new TableSchema.Builder(response.getTableName(), response.getDimension())
             new TableSchema.Builder(response.getTableName(), response.getDimension())
                 .withIndexFileSize(response.getIndexFileSize())
                 .withIndexFileSize(response.getIndexFileSize())
@@ -480,14 +481,13 @@ public class MilvusGrpcClient implements MilvusClient {
           new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
           new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
     }
     }
 
 
-    io.milvus.client.grpc.Command request =
-        io.milvus.client.grpc.Command.newBuilder().setCmd("").build();
-    io.milvus.client.grpc.TableNameList response;
+    io.milvus.grpc.Command request = io.milvus.grpc.Command.newBuilder().setCmd("").build();
+    io.milvus.grpc.TableNameList response;
 
 
     try {
     try {
       response = blockingStub.showTables(request);
       response = blockingStub.showTables(request);
 
 
-      if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+      if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         List<String> tableNames = response.getTableNamesList();
         List<String> tableNames = response.getTableNamesList();
         logInfo("Current tables: {0}", tableNames.toString());
         logInfo("Current tables: {0}", tableNames.toString());
         return new ShowTablesResponse(new Response(Response.Status.SUCCESS), tableNames);
         return new ShowTablesResponse(new Response(Response.Status.SUCCESS), tableNames);
@@ -515,9 +515,9 @@ public class MilvusGrpcClient implements MilvusClient {
     }
     }
 
 
     String tableName = tableParam.getTableName();
     String tableName = tableParam.getTableName();
-    io.milvus.client.grpc.TableName request =
-        io.milvus.client.grpc.TableName.newBuilder().setTableName(tableName).build();
-    io.milvus.client.grpc.TableRowCount response;
+    io.milvus.grpc.TableName request =
+        io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
+    io.milvus.grpc.TableRowCount response;
 
 
     try {
     try {
       response =
       response =
@@ -525,7 +525,7 @@ public class MilvusGrpcClient implements MilvusClient {
               .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
               .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
               .countTable(request);
               .countTable(request);
 
 
-      if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+      if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         long tableRowCount = response.getTableRowCount();
         long tableRowCount = response.getTableRowCount();
         logInfo("Table `{0}` has {1} rows", tableName, tableRowCount);
         logInfo("Table `{0}` has {1} rows", tableName, tableRowCount);
         return new GetTableRowCountResponse(new Response(Response.Status.SUCCESS), tableRowCount);
         return new GetTableRowCountResponse(new Response(Response.Status.SUCCESS), tableRowCount);
@@ -563,15 +563,14 @@ public class MilvusGrpcClient implements MilvusClient {
     }
     }
 
 
     String command = commandParam.getCommand();
     String command = commandParam.getCommand();
-    io.milvus.client.grpc.Command request =
-        io.milvus.client.grpc.Command.newBuilder().setCmd(command).build();
-    io.milvus.client.grpc.StringReply response;
+    io.milvus.grpc.Command request = io.milvus.grpc.Command.newBuilder().setCmd(command).build();
+    io.milvus.grpc.StringReply response;
 
 
     try {
     try {
       response =
       response =
           blockingStub.withDeadlineAfter(commandParam.getTimeout(), TimeUnit.SECONDS).cmd(request);
           blockingStub.withDeadlineAfter(commandParam.getTimeout(), TimeUnit.SECONDS).cmd(request);
 
 
-      if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+      if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         logInfo("Command `{0}`: {1}", command, response.getStringReply());
         logInfo("Command `{0}`: {1}", command, response.getStringReply());
         return new Response(Response.Status.SUCCESS, response.getStringReply());
         return new Response(Response.Status.SUCCESS, response.getStringReply());
       } else {
       } else {
@@ -593,12 +592,12 @@ public class MilvusGrpcClient implements MilvusClient {
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
     }
     }
 
 
-    io.milvus.client.grpc.DeleteByRangeParam request =
-        io.milvus.client.grpc.DeleteByRangeParam.newBuilder()
+    io.milvus.grpc.DeleteByRangeParam request =
+        io.milvus.grpc.DeleteByRangeParam.newBuilder()
             .setRange(getRange(deleteByRangeParam.getDateRange()))
             .setRange(getRange(deleteByRangeParam.getDateRange()))
             .setTableName(deleteByRangeParam.getTableName())
             .setTableName(deleteByRangeParam.getTableName())
             .build();
             .build();
-    io.milvus.client.grpc.Status response;
+    io.milvus.grpc.Status response;
 
 
     try {
     try {
       response =
       response =
@@ -606,7 +605,7 @@ public class MilvusGrpcClient implements MilvusClient {
               .withDeadlineAfter(deleteByRangeParam.getTimeout(), TimeUnit.SECONDS)
               .withDeadlineAfter(deleteByRangeParam.getTimeout(), TimeUnit.SECONDS)
               .deleteByRange(request);
               .deleteByRange(request);
 
 
-      if (response.getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+      if (response.getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         logInfo(
         logInfo(
             "Deleted vectors from table `{0}` in range {1} successfully!",
             "Deleted vectors from table `{0}` in range {1} successfully!",
             deleteByRangeParam.getTableName(), deleteByRangeParam.getDateRange().toString());
             deleteByRangeParam.getTableName(), deleteByRangeParam.getDateRange().toString());
@@ -635,9 +634,9 @@ public class MilvusGrpcClient implements MilvusClient {
     }
     }
 
 
     String tableName = tableParam.getTableName();
     String tableName = tableParam.getTableName();
-    io.milvus.client.grpc.TableName request =
-        io.milvus.client.grpc.TableName.newBuilder().setTableName(tableName).build();
-    io.milvus.client.grpc.Status response;
+    io.milvus.grpc.TableName request =
+        io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
+    io.milvus.grpc.Status response;
 
 
     try {
     try {
       response =
       response =
@@ -645,7 +644,7 @@ public class MilvusGrpcClient implements MilvusClient {
               .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
               .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
               .preloadTable(request);
               .preloadTable(request);
 
 
-      if (response.getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+      if (response.getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         logInfo("Preloaded table `{0}` successfully!", tableName);
         logInfo("Preloaded table `{0}` successfully!", tableName);
         return new Response(Response.Status.SUCCESS);
         return new Response(Response.Status.SUCCESS);
       } else {
       } else {
@@ -668,9 +667,9 @@ public class MilvusGrpcClient implements MilvusClient {
     }
     }
 
 
     String tableName = tableParam.getTableName();
     String tableName = tableParam.getTableName();
-    io.milvus.client.grpc.TableName request =
-        io.milvus.client.grpc.TableName.newBuilder().setTableName(tableName).build();
-    io.milvus.client.grpc.IndexParam response;
+    io.milvus.grpc.TableName request =
+        io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
+    io.milvus.grpc.IndexParam response;
 
 
     try {
     try {
       response =
       response =
@@ -678,7 +677,7 @@ public class MilvusGrpcClient implements MilvusClient {
               .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
               .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
               .describeIndex(request);
               .describeIndex(request);
 
 
-      if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+      if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         Index index =
         Index index =
             new Index.Builder()
             new Index.Builder()
                 .withIndexType(IndexType.valueOf(response.getIndex().getIndexType()))
                 .withIndexType(IndexType.valueOf(response.getIndex().getIndexType()))
@@ -709,9 +708,9 @@ public class MilvusGrpcClient implements MilvusClient {
     }
     }
 
 
     String tableName = tableParam.getTableName();
     String tableName = tableParam.getTableName();
-    io.milvus.client.grpc.TableName request =
-        io.milvus.client.grpc.TableName.newBuilder().setTableName(tableName).build();
-    io.milvus.client.grpc.Status response;
+    io.milvus.grpc.TableName request =
+        io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
+    io.milvus.grpc.Status response;
 
 
     try {
     try {
       response =
       response =
@@ -719,7 +718,7 @@ public class MilvusGrpcClient implements MilvusClient {
               .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
               .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
               .dropIndex(request);
               .dropIndex(request);
 
 
-      if (response.getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+      if (response.getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         logInfo("Dropped index for table `{0}` successfully!", tableName);
         logInfo("Dropped index for table `{0}` successfully!", tableName);
         return new Response(Response.Status.SUCCESS);
         return new Response(Response.Status.SUCCESS);
       } else {
       } else {
@@ -734,24 +733,23 @@ public class MilvusGrpcClient implements MilvusClient {
   }
   }
 
 
   ///////////////////// Util Functions/////////////////////
   ///////////////////// Util Functions/////////////////////
-  private List<io.milvus.client.grpc.RowRecord> getQueryRowRecordList(
-      @Nonnull SearchParam searchParam) {
-    List<io.milvus.client.grpc.RowRecord> queryRowRecordList = new ArrayList<>();
+  private List<io.milvus.grpc.RowRecord> getQueryRowRecordList(@Nonnull SearchParam searchParam) {
+    List<io.milvus.grpc.RowRecord> queryRowRecordList = new ArrayList<>();
     for (List<Float> vectors : searchParam.getQueryVectors()) {
     for (List<Float> vectors : searchParam.getQueryVectors()) {
-      io.milvus.client.grpc.RowRecord rowRecord =
-          io.milvus.client.grpc.RowRecord.newBuilder().addAllVectorData(vectors).build();
+      io.milvus.grpc.RowRecord rowRecord =
+          io.milvus.grpc.RowRecord.newBuilder().addAllVectorData(vectors).build();
       queryRowRecordList.add(rowRecord);
       queryRowRecordList.add(rowRecord);
     }
     }
     return queryRowRecordList;
     return queryRowRecordList;
   }
   }
 
 
-  private List<io.milvus.client.grpc.Range> getQueryRangeList(@Nonnull SearchParam searchParam) {
-    List<io.milvus.client.grpc.Range> queryRangeList = new ArrayList<>();
+  private List<io.milvus.grpc.Range> getQueryRangeList(@Nonnull SearchParam searchParam) {
+    List<io.milvus.grpc.Range> queryRangeList = new ArrayList<>();
     String datePattern = "yyyy-MM-dd";
     String datePattern = "yyyy-MM-dd";
     SimpleDateFormat simpleDateFormat = new SimpleDateFormat(datePattern);
     SimpleDateFormat simpleDateFormat = new SimpleDateFormat(datePattern);
     for (DateRange queryRange : searchParam.getdateRanges()) {
     for (DateRange queryRange : searchParam.getdateRanges()) {
-      io.milvus.client.grpc.Range dateRange =
-          io.milvus.client.grpc.Range.newBuilder()
+      io.milvus.grpc.Range dateRange =
+          io.milvus.grpc.Range.newBuilder()
               .setStartValue(simpleDateFormat.format(queryRange.getStartDate()))
               .setStartValue(simpleDateFormat.format(queryRange.getStartDate()))
               .setEndValue(simpleDateFormat.format(queryRange.getEndDate()))
               .setEndValue(simpleDateFormat.format(queryRange.getEndDate()))
               .build();
               .build();
@@ -760,27 +758,26 @@ public class MilvusGrpcClient implements MilvusClient {
     return queryRangeList;
     return queryRangeList;
   }
   }
 
 
-  private io.milvus.client.grpc.Range getRange(@Nonnull DateRange dateRange) {
+  private io.milvus.grpc.Range getRange(@Nonnull DateRange dateRange) {
     String datePattern = "yyyy-MM-dd";
     String datePattern = "yyyy-MM-dd";
     SimpleDateFormat simpleDateFormat = new SimpleDateFormat(datePattern);
     SimpleDateFormat simpleDateFormat = new SimpleDateFormat(datePattern);
-    return io.milvus.client.grpc.Range.newBuilder()
+    return io.milvus.grpc.Range.newBuilder()
         .setStartValue(simpleDateFormat.format(dateRange.getStartDate()))
         .setStartValue(simpleDateFormat.format(dateRange.getStartDate()))
         .setEndValue(simpleDateFormat.format(dateRange.getEndDate()))
         .setEndValue(simpleDateFormat.format(dateRange.getEndDate()))
         .build();
         .build();
   }
   }
 
 
   private List<List<SearchResponse.QueryResult>> getQueryResultsList(
   private List<List<SearchResponse.QueryResult>> getQueryResultsList(
-      io.milvus.client.grpc.TopKQueryResultList searchResponse) {
+      io.milvus.grpc.TopKQueryResultList searchResponse) {
     // TODO: refactor
     // TODO: refactor
     List<List<SearchResponse.QueryResult>> queryResultsList = new ArrayList<>();
     List<List<SearchResponse.QueryResult>> queryResultsList = new ArrayList<>();
-    Optional<List<io.milvus.client.grpc.TopKQueryResult>> topKQueryResultList =
+    Optional<List<io.milvus.grpc.TopKQueryResult>> topKQueryResultList =
         Optional.ofNullable(searchResponse.getTopkQueryResultList());
         Optional.ofNullable(searchResponse.getTopkQueryResultList());
     if (topKQueryResultList.isPresent()) {
     if (topKQueryResultList.isPresent()) {
-      for (io.milvus.client.grpc.TopKQueryResult topKQueryResult : topKQueryResultList.get()) {
+      for (io.milvus.grpc.TopKQueryResult topKQueryResult : topKQueryResultList.get()) {
         List<SearchResponse.QueryResult> responseQueryResults = new ArrayList<>();
         List<SearchResponse.QueryResult> responseQueryResults = new ArrayList<>();
-        List<io.milvus.client.grpc.QueryResult> queryResults =
-            topKQueryResult.getQueryResultArraysList();
-        for (io.milvus.client.grpc.QueryResult queryResult : queryResults) {
+        List<io.milvus.grpc.QueryResult> queryResults = topKQueryResult.getQueryResultArraysList();
+        for (io.milvus.grpc.QueryResult queryResult : queryResults) {
           SearchResponse.QueryResult responseQueryResult =
           SearchResponse.QueryResult responseQueryResult =
               new SearchResponse.QueryResult(queryResult.getId(), queryResult.getDistance());
               new SearchResponse.QueryResult(queryResult.getId(), queryResult.getDistance());
           responseQueryResults.add(responseQueryResult);
           responseQueryResults.add(responseQueryResult);

+ 5 - 4
src/main/java/io/milvus/client/Response.java

@@ -25,8 +25,9 @@ import java.util.Optional;
  */
  */
 public class Response {
 public class Response {
 
 
-    private final Status status;
-    private final String message;
+  private final Status status;
+  private final String message;
+
   public Response(Status status, String message) {
   public Response(Status status, String message) {
     this.status = status;
     this.status = status;
     this.message = message;
     this.message = message;
@@ -56,10 +57,10 @@ public class Response {
 
 
   @Override
   @Override
   public String toString() {
   public String toString() {
-    return String.format("Response {code = %s, message = %s}", status.name(), this.message);
+    return String.format("Response {code = %s, message = \"%s\"}", status.name(), this.message);
   }
   }
 
 
-/** Represents server and client side status code */
+  /** Represents server and client side status code */
   public enum Status {
   public enum Status {
     // Server side error
     // Server side error
     SUCCESS(0),
     SUCCESS(0),

+ 1 - 1
src/main/proto/milvus.proto

@@ -3,7 +3,7 @@ syntax = "proto3";
 import "status.proto";
 import "status.proto";
 
 
 option java_multiple_files = true;
 option java_multiple_files = true;
-option java_package = "io.milvus.client.grpc";
+option java_package = "io.milvus.grpc";
 option java_outer_classname = "MilvusProto";
 option java_outer_classname = "MilvusProto";
 
 
 package milvus.grpc;
 package milvus.grpc;

+ 1 - 1
src/main/proto/status.proto

@@ -1,7 +1,7 @@
 syntax = "proto3";
 syntax = "proto3";
 
 
 option java_multiple_files = true;
 option java_multiple_files = true;
-option java_package = "io.milvus.client.grpc";
+option java_package = "io.milvus.grpc";
 option java_outer_classname = "MilvusStatusProto";
 option java_outer_classname = "MilvusStatusProto";
 
 
 package milvus.grpc;
 package milvus.grpc;