2828import io .milvus .v2 .service .utility .response .*;
2929
3030import java .util .*;
31+ import java .util .stream .Collectors ;
3132
3233public class UtilityService extends BaseService {
3334 public FlushResp flush (MilvusServiceGrpc .MilvusServiceBlockingStub blockingStub , FlushReq request ) {
@@ -100,7 +101,7 @@ public CompactResp compact(MilvusServiceGrpc.MilvusServiceBlockingStub blockingS
100101
101102 public GetCompactionStateResp getCompactionState (MilvusServiceGrpc .MilvusServiceBlockingStub blockingStub ,
102103 GetCompactionStateReq request ) {
103- String title = "Get compaction state " ;
104+ String title = "GetCompactionState " ;
104105 io .milvus .grpc .GetCompactionStateRequest getRequest = io .milvus .grpc .GetCompactionStateRequest .newBuilder ()
105106 .setCompactionID (request .getCompactionID ())
106107 .build ();
@@ -116,7 +117,7 @@ public GetCompactionStateResp getCompactionState(MilvusServiceGrpc.MilvusService
116117 }
117118
118119 public Void createAlias (MilvusServiceGrpc .MilvusServiceBlockingStub blockingStub , CreateAliasReq request ) {
119- String title = String .format ("Create alias %s for collection %s" , request .getAlias (), request .getCollectionName ());
120+ String title = String .format ("CreateAlias %s for collection %s" , request .getAlias (), request .getCollectionName ());
120121 io .milvus .grpc .CreateAliasRequest createAliasRequest = io .milvus .grpc .CreateAliasRequest .newBuilder ()
121122 .setCollectionName (request .getCollectionName ())
122123 .setAlias (request .getAlias ())
@@ -128,7 +129,7 @@ public Void createAlias(MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub
128129 }
129130
130131 public Void dropAlias (MilvusServiceGrpc .MilvusServiceBlockingStub blockingStub , DropAliasReq request ) {
131- String title = String .format ("Drop alias %s" , request .getAlias ());
132+ String title = String .format ("DropAlias %s" , request .getAlias ());
132133 io .milvus .grpc .DropAliasRequest dropAliasRequest = io .milvus .grpc .DropAliasRequest .newBuilder ()
133134 .setAlias (request .getAlias ())
134135 .build ();
@@ -139,7 +140,7 @@ public Void dropAlias(MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub,
139140 }
140141
141142 public Void alterAlias (MilvusServiceGrpc .MilvusServiceBlockingStub blockingStub , AlterAliasReq request ) {
142- String title = String .format ("Alter alias %s for collection %s" , request .getAlias (), request .getCollectionName ());
143+ String title = String .format ("AlterAlias %s for collection %s" , request .getAlias (), request .getCollectionName ());
143144 io .milvus .grpc .AlterAliasRequest alterAliasRequest = io .milvus .grpc .AlterAliasRequest .newBuilder ()
144145 .setCollectionName (request .getCollectionName ())
145146 .setAlias (request .getAlias ())
@@ -151,7 +152,7 @@ public Void alterAlias(MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub,
151152 }
152153
153154 public DescribeAliasResp describeAlias (MilvusServiceGrpc .MilvusServiceBlockingStub blockingStub , DescribeAliasReq request ) {
154- String title = String .format ("Describe alias %s" , request .getAlias ());
155+ String title = String .format ("DescribeAlias %s" , request .getAlias ());
155156 io .milvus .grpc .DescribeAliasRequest describeAliasRequest = io .milvus .grpc .DescribeAliasRequest .newBuilder ()
156157 .setAlias (request .getAlias ())
157158 .build ();
@@ -166,7 +167,7 @@ public DescribeAliasResp describeAlias(MilvusServiceGrpc.MilvusServiceBlockingSt
166167 }
167168
168169 public ListAliasResp listAliases (MilvusServiceGrpc .MilvusServiceBlockingStub blockingStub , ListAliasesReq request ) {
169- String title = "List aliases " ;
170+ String title = "ListAliases " ;
170171 io .milvus .grpc .ListAliasesRequest listAliasesRequest = io .milvus .grpc .ListAliasesRequest .newBuilder ()
171172 .setCollectionName (request .getCollectionName ())
172173 .build ();
@@ -179,4 +180,68 @@ public ListAliasResp listAliases(MilvusServiceGrpc.MilvusServiceBlockingStub blo
179180 .alias (response .getAliasesList ())
180181 .build ();
181182 }
183+
184+ public CheckHealthResp checkHealth (MilvusServiceGrpc .MilvusServiceBlockingStub blockingStub ) {
185+ String title = "CheckHealth" ;
186+ CheckHealthResponse response = blockingStub .checkHealth (CheckHealthRequest .newBuilder ().build ());
187+ rpcUtils .handleResponse (title , response .getStatus ());
188+
189+ List <String > states = new ArrayList <>();
190+ response .getQuotaStatesList ().forEach (s ->states .add (s .name ()));
191+ return CheckHealthResp .builder ()
192+ .isHealthy (response .getIsHealthy ())
193+ .reasons (response .getReasonsList ().stream ().collect (Collectors .toList ()))
194+ .quotaStates (states )
195+ .build ();
196+ }
197+
198+ public GetPersistentSegmentInfoResp getPersistentSegmentInfo (MilvusServiceGrpc .MilvusServiceBlockingStub blockingStub ,
199+ GetPersistentSegmentInfoReq request ) {
200+ String title = String .format ("GetPersistentSegmentInfo collectionName %s" , request .getCollectionName ());
201+ GetPersistentSegmentInfoResponse response = blockingStub .getPersistentSegmentInfo (GetPersistentSegmentInfoRequest .newBuilder ()
202+ .setCollectionName (request .getCollectionName ())
203+ .build ());
204+ rpcUtils .handleResponse (title , response .getStatus ());
205+
206+ List <GetPersistentSegmentInfoResp .PersistentSegmentInfo > segmentInfos = new ArrayList <>();
207+ response .getInfosList ().forEach (info ->{segmentInfos .add (GetPersistentSegmentInfoResp .PersistentSegmentInfo .builder ()
208+ .segmentID (info .getSegmentID ())
209+ .collectionID (info .getCollectionID ())
210+ .partitionID (info .getPartitionID ())
211+ .numOfRows (info .getNumRows ())
212+ .state (info .getState ().name ())
213+ .level (info .getLevel ().name ())
214+ .isSorted (info .getIsSorted ())
215+ .build ());});
216+ return GetPersistentSegmentInfoResp .builder ()
217+ .segmentInfos (segmentInfos )
218+ .build ();
219+ }
220+
221+ public GetQuerySegmentInfoResp getQuerySegmentInfo (MilvusServiceGrpc .MilvusServiceBlockingStub blockingStub ,
222+ GetQuerySegmentInfoReq request ) {
223+ String title = String .format ("GetQuerySegmentInfo collectionName %s" , request .getCollectionName ());
224+ GetQuerySegmentInfoResponse response = blockingStub .getQuerySegmentInfo (GetQuerySegmentInfoRequest .newBuilder ()
225+ .setCollectionName (request .getCollectionName ())
226+ .build ());
227+ rpcUtils .handleResponse (title , response .getStatus ());
228+
229+ List <GetQuerySegmentInfoResp .QuerySegmentInfo > segmentInfos = new ArrayList <>();
230+ response .getInfosList ().forEach (info ->{segmentInfos .add (GetQuerySegmentInfoResp .QuerySegmentInfo .builder ()
231+ .segmentID (info .getSegmentID ())
232+ .collectionID (info .getCollectionID ())
233+ .partitionID (info .getPartitionID ())
234+ .memSize (info .getMemSize ())
235+ .numOfRows (info .getNumRows ())
236+ .indexName (info .getIndexName ())
237+ .indexID (info .getIndexID ())
238+ .state (info .getState ().name ())
239+ .level (info .getLevel ().name ())
240+ .nodeIDs (info .getNodeIdsList ())
241+ .isSorted (info .getIsSorted ())
242+ .build ());});
243+ return GetQuerySegmentInfoResp .builder ()
244+ .segmentInfos (segmentInfos )
245+ .build ();
246+ }
182247}
0 commit comments